summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/expressions/function/dstr
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/tests/test262/language/expressions/function/dstr
parentInitial commit. (diff)
downloadfirefox-esr-upstream.tar.xz
firefox-esr-upstream.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/language/expressions/function/dstr')
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-init-iter-close.js74
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-init-iter-get-err-array-prototype.js65
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-init-iter-get-err.js59
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-init-iter-no-close.js74
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-name-iter-val.js73
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-elem-init.js65
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-elem-iter.js66
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-elision-init.js72
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-elision-iter.js69
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-empty-init.js68
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-empty-iter.js65
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-rest-init.js69
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-rest-iter.js72
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-val-null.js66
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-exhausted.js64
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js65
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-fn-name-class.js67
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-fn-name-cover.js66
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-fn-name-fn.js66
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-fn-name-gen.js67
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-hole.js60
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-skipped.js69
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-throws.js57
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-undef.js63
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-unresolvable.js64
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-iter-complete.js67
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-iter-done.js62
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-iter-step-err.js66
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js83
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-iter-val-err.js77
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-iter-val.js73
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-obj-id-init.js65
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-obj-id.js65
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-obj-prop-id-init.js75
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-obj-prop-id.js75
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-obj-val-null.js66
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-obj-val-undef.js66
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elision-exhausted.js70
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elision-step-err.js73
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elision.js79
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-empty.js62
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-ary-elem.js86
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-ary-elision.js92
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-ary-empty.js75
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-ary-rest.js71
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-id-direct.js66
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-id-elision-next-err.js59
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-id-elision.js67
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-id-exhausted.js63
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-id-iter-step-err.js70
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-id-iter-val-err.js72
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-id.js64
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-init-ary.js60
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-init-id.js60
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-init-obj.js60
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-not-final-ary.js60
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-not-final-id.js60
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-not-final-obj.js60
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-obj-id.js64
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-obj-prop-id.js71
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/browser.js0
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-init-iter-close.js74
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-init-iter-get-err-array-prototype.js65
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-init-iter-get-err.js59
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-init-iter-no-close.js74
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-name-iter-val.js73
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-elem-init.js65
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-elem-iter.js66
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-elision-init.js72
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-elision-iter.js69
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-empty-init.js68
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-empty-iter.js65
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-rest-init.js69
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-rest-iter.js72
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-val-null.js66
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-exhausted.js64
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-arrow.js65
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-class.js67
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-cover.js66
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-fn.js66
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-gen.js67
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-hole.js60
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-skipped.js69
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-throws.js57
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-undef.js63
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-unresolvable.js64
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-iter-complete.js67
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-iter-done.js62
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-iter-step-err.js66
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-iter-val-array-prototype.js83
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-iter-val-err.js77
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-iter-val.js73
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-obj-id-init.js65
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-obj-id.js65
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-obj-prop-id-init.js75
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-obj-prop-id.js75
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-obj-val-null.js66
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-obj-val-undef.js66
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elision-exhausted.js70
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elision-step-err.js73
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elision.js79
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-empty.js62
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-ary-elem.js86
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-ary-elision.js92
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-ary-empty.js75
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-ary-rest.js71
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-id-direct.js66
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-id-elision-next-err.js59
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-id-elision.js67
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-id-exhausted.js63
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-id-iter-step-err.js70
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-id-iter-val-err.js72
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-id.js64
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-init-ary.js60
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-init-id.js60
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-init-obj.js60
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-not-final-ary.js60
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-not-final-id.js60
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-not-final-obj.js60
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-obj-id.js64
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-obj-prop-id.js71
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-obj-init-null.js53
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-obj-init-undefined.js53
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-empty.js63
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-get-value-err.js60
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-fn-name-arrow.js64
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-fn-name-class.js66
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-fn-name-cover.js65
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-fn-name-fn.js65
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-fn-name-gen.js66
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-skipped.js68
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-throws.js60
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-unresolvable.js64
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-trailing-comma.js58
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-list-err.js61
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-ary-init.js67
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-ary-trailing-comma.js58
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-ary-value-null.js55
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-ary.js65
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-eval-err.js57
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-id-get-value-err.js62
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-id-init-skipped.js80
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-id-init-throws.js60
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-id-init-unresolvable.js64
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-id-init.js61
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-id-trailing-comma.js62
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-id.js61
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-obj-init.js67
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-obj-value-null.js55
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-obj-value-undef.js55
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-obj.js65
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-rest-getter.js60
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-rest-skip-non-enumerable.js68
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-rest-val-obj.js67
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/obj-init-null.js53
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/obj-init-undefined.js53
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-empty.js63
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-get-value-err.js60
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-fn-name-arrow.js64
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-fn-name-class.js66
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-fn-name-cover.js65
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-fn-name-fn.js65
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-fn-name-gen.js66
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-skipped.js68
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-throws.js60
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-unresolvable.js64
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-trailing-comma.js58
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-list-err.js61
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-ary-init.js67
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-ary-trailing-comma.js58
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-ary-value-null.js55
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-ary.js65
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-eval-err.js57
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-id-get-value-err.js62
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-id-init-skipped.js80
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-id-init-throws.js60
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-id-init-unresolvable.js64
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-id-init.js61
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-id-trailing-comma.js62
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-id.js61
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-obj-init.js67
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-obj-value-null.js55
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-obj-value-undef.js55
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-obj.js65
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-rest-getter.js60
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-rest-skip-non-enumerable.js68
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-rest-val-obj.js67
-rw-r--r--js/src/tests/test262/language/expressions/function/dstr/shell.js0
188 files changed, 12248 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-init-iter-close.js b/js/src/tests/test262/language/expressions/function/dstr/ary-init-iter-close.js
new file mode 100644
index 0000000000..ef9cd5e1fa
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/ary-init-iter-close.js
@@ -0,0 +1,74 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-close.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: Iterator is closed when not exhausted by pattern evaluation (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([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/expressions/function/dstr/ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/expressions/function/dstr/ary-init-iter-get-err-array-prototype.js
new file mode 100644
index 0000000000..413a4afa13
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr.template
+/*---
+description: Abrupt completion returned by GetIterator (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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];
+
+var f = function([x, y, z]) {};
+
+assert.throws(TypeError, function() {
+ f([1, 2, 3]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-init-iter-get-err.js b/js/src/tests/test262/language/expressions/function/dstr/ary-init-iter-get-err.js
new file mode 100644
index 0000000000..f286cb6592
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr.template
+/*---
+description: Abrupt completion returned by GetIterator (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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();
+};
+
+var f = function([x]) {};
+
+assert.throws(Test262Error, function() {
+ f(iter);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-init-iter-no-close.js b/js/src/tests/test262/language/expressions/function/dstr/ary-init-iter-no-close.js
new file mode 100644
index 0000000000..c0db91a6f5
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/ary-init-iter-no-close.js
@@ -0,0 +1,74 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-no-close.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: Iterator is not closed when exhausted by pattern evaluation (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([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/expressions/function/dstr/ary-name-iter-val.js b/js/src/tests/test262/language/expressions/function/dstr/ary-name-iter-val.js
new file mode 100644
index 0000000000..0fdfb289ce
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/ary-name-iter-val.js
@@ -0,0 +1,73 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-name-iter-val.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: SingleNameBinding with normal value iteration (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([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/expressions/function/dstr/ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..cf0aef0802
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-elem-init.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([[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/expressions/function/dstr/ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..19c1d07954
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-elem-iter.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([[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/expressions/function/dstr/ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..454db5252e
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-elision-init.js
@@ -0,0 +1,72 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([[,] = 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/expressions/function/dstr/ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..e2450a165b
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-elision-iter.js
@@ -0,0 +1,69 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([[,] = 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/expressions/function/dstr/ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..1401ae634b
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,68 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([[] = 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/expressions/function/dstr/ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..41141e6a47
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-empty-iter.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([[] = 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/expressions/function/dstr/ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..344413a860
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-rest-init.js
@@ -0,0 +1,69 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([[...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/expressions/function/dstr/ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..19ddb663f0
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-rest-iter.js
@@ -0,0 +1,72 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([[...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/expressions/function/dstr/ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-ary-val-null.js
new file mode 100644
index 0000000000..1314c9664f
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr.template
+/*---
+description: Nested array destructuring with a null value (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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).
+---*/
+
+var f = function([[x]]) {};
+
+assert.throws(TypeError, function() {
+ f([null]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..733d89fe4e
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-exhausted.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: Destructuring initializer with an exhausted iterator (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([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/expressions/function/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..8e3e750011
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-fn-name-arrow.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-arrow.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: SingleNameBinding does assign name to arrow functions (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([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/expressions/function/dstr/ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..315d4c8538
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-fn-name-class.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-class.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([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/expressions/function/dstr/ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..c7cdb8f3eb
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-fn-name-cover.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-cover.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([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/expressions/function/dstr/ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..22ee936236
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-fn-name-fn.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-fn.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([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/expressions/function/dstr/ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..c9624b4eec
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-gen.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([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/expressions/function/dstr/ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..bbbd4daed1
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-hole.js
@@ -0,0 +1,60 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: Destructuring initializer with a "hole" (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([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/expressions/function/dstr/ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..abe552c186
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-skipped.js
@@ -0,0 +1,69 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([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/expressions/function/dstr/ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-throws.js
new file mode 100644
index 0000000000..e27197f2e9
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr.template
+/*---
+description: Destructuring initializer returns an abrupt completion (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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).
+---*/
+
+var f = function([x = (function() { throw new Test262Error(); })()]) {};
+
+assert.throws(Test262Error, function() {
+ f([undefined]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..a746086945
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-undef.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: Destructuring initializer with an undefined value (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([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/expressions/function/dstr/ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-init-unresolvable.js
new file mode 100644
index 0000000000..f095fdb598
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr.template
+/*---
+description: Destructuring initializer is an unresolvable reference (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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.
+---*/
+
+var f = function([ x = unresolvableReference ]) {};
+
+assert.throws(ReferenceError, function() {
+ f([]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..6e03774969
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-iter-complete.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: SingleNameBinding when value iteration completes (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([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/expressions/function/dstr/ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..f95c31ee9a
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-iter-done.js
@@ -0,0 +1,62 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([_, 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/expressions/function/dstr/ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-iter-step-err.js
new file mode 100644
index 0000000000..d40ff3a244
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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();
+ }
+ };
+};
+
+var f = function([x]) {};
+
+assert.throws(Test262Error, function() {
+ f(g);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js
new file mode 100644
index 0000000000..f918ba42ed
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-iter-val-array-prototype.js
@@ -0,0 +1,83 @@
+// 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-expr.template
+/*---
+description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, generators, destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([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/expressions/function/dstr/ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-iter-val-err.js
new file mode 100644
index 0000000000..0a960f1b37
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+ }
+ };
+};
+
+var f = function([x]) {};
+
+assert.throws(Test262Error, function() {
+ f(g);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..5ec9c6c814
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-id-iter-val.js
@@ -0,0 +1,73 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([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/expressions/function/dstr/ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..07bdf9def8
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-obj-id-init.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([{ 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/expressions/function/dstr/ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..b1b3746689
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-obj-id.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([{ 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/expressions/function/dstr/ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..4376ca8cb7
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-obj-prop-id-init.js
@@ -0,0 +1,75 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([{ 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/expressions/function/dstr/ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..ba873ba4e9
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-obj-prop-id.js
@@ -0,0 +1,75 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([{ 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/expressions/function/dstr/ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-obj-val-null.js
new file mode 100644
index 0000000000..e6e7ef21ff
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr.template
+/*---
+description: Nested object destructuring with a null value (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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).
+---*/
+
+var f = function([{ x }]) {};
+
+assert.throws(TypeError, function() {
+ f([null]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elem-obj-val-undef.js
new file mode 100644
index 0000000000..a511091446
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr.template
+/*---
+description: Nested object destructuring with a value of `undefined` (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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).
+---*/
+
+var f = function([{ x }]) {};
+
+assert.throws(TypeError, function() {
+ f([]);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..f601a84a67
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elision-exhausted.js
@@ -0,0 +1,70 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-exhausted.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: Elision accepts exhausted iterator (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([,]) {
+
+ callCount = callCount + 1;
+};
+
+f(iter);
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elision-step-err.js
new file mode 100644
index 0000000000..7f1fc5107c
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr.template
+/*---
+description: Elision advances iterator and forwards abrupt completions (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+}();
+
+var f = function([,]) {};
+
+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/expressions/function/dstr/ary-ptrn-elision.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elision.js
new file mode 100644
index 0000000000..f214aac224
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-elision.js
@@ -0,0 +1,79 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: Elision advances iterator (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([,]) {
+ 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/expressions/function/dstr/ary-ptrn-empty.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-empty.js
new file mode 100644
index 0000000000..c924d6b660
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-empty.js
@@ -0,0 +1,62 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-empty.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: No iteration occurs for an "empty" array binding pattern (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([]) {
+ 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/expressions/function/dstr/ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..75abfebf36
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-ary-elem.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elem.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: Rest element containing an array BindingElementList pattern (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([...[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/expressions/function/dstr/ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..9cfcb0e536
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-ary-elision.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elision.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: Rest element containing an elision (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([...[,]]) {
+ 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/expressions/function/dstr/ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..0a7ca0e09b
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-ary-empty.js
@@ -0,0 +1,75 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-empty.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: Rest element containing an "empty" array pattern (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([...[]]) {
+ 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/expressions/function/dstr/ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..afc6fedad8
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-ary-rest.js
@@ -0,0 +1,71 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-rest.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: Rest element containing a rest element (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([...[...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/expressions/function/dstr/ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-id-direct.js
new file mode 100644
index 0000000000..a91ae6cebe
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-id-direct.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-direct.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: Lone rest element (direct binding) (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+includes: [compareArray.js]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([...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/expressions/function/dstr/ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-id-elision-next-err.js
new file mode 100644
index 0000000000..90c16c0c75
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr.template
+/*---
+description: Rest element following elision elements (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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(); })();
+
+var f = function([, ...x]) {};
+
+assert.throws(Test262Error, function() {
+ f(iter);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..2c737d7500
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-id-elision.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: Rest element following elision elements (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([ , , ...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/expressions/function/dstr/ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..7bc02a7e6d
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-id-exhausted.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: RestElement applied to an exhausted iterator (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([, , ...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/expressions/function/dstr/ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-id-iter-step-err.js
new file mode 100644
index 0000000000..6af9a53058
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+}();
+
+var f = function([...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/expressions/function/dstr/ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-id-iter-val-err.js
new file mode 100644
index 0000000000..cbd5d774b4
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+ }
+ };
+};
+
+var f = function([...x]) {};
+
+assert.throws(Test262Error, function() {
+ f(iter);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-id.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..3d82f6f874
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-id.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: Lone rest element (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([...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/expressions/function/dstr/ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..5bec964c48
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/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/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: Rest element (nested array pattern) does not support initializer (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([...[ x ] = []]) {
+
+ callCount = callCount + 1;
+};
+
+f([]);
+assert.sameValue(callCount, 1, 'function invoked exactly once');
diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..9073e2938a
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/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/ary-ptrn-rest-init-id.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: Rest element (identifier) does not support initializer (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([...x = []]) {
+
+ callCount = callCount + 1;
+};
+
+f([]);
+assert.sameValue(callCount, 1, 'function invoked exactly once');
diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..011a6bf0b7
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/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/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: Rest element (nested object pattern) does not support initializer (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([...{ x } = []]) {
+
+ callCount = callCount + 1;
+};
+
+f([]);
+assert.sameValue(callCount, 1, 'function invoked exactly once');
diff --git a/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..8f08fcc3f8
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/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/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: Rest element (array binding pattern) may not be followed by any element (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([...[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/expressions/function/dstr/ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..1c036150d6
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/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/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: Rest element (identifier) may not be followed by any element (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([...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/expressions/function/dstr/ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..d64f4630fc
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/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/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: Rest element (object binding pattern) may not be followed by any element (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([...{ 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/expressions/function/dstr/ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..b571068c3b
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-obj-id.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-id.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: Rest element containing an object binding pattern (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([...{ 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/expressions/function/dstr/ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..1d659a2a31
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,71 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: Rest element containing an object binding pattern (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([...{ 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/expressions/function/dstr/browser.js b/js/src/tests/test262/language/expressions/function/dstr/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/browser.js
diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-init-iter-close.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-init-iter-close.js
new file mode 100644
index 0000000000..5a7cd2f3bd
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-init-iter-close.js
@@ -0,0 +1,74 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-close.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: Iterator is closed when not exhausted by pattern evaluation (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([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/expressions/function/dstr/dflt-ary-init-iter-get-err-array-prototype.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-init-iter-get-err-array-prototype.js
new file mode 100644
index 0000000000..0677758d61
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr-dflt.template
+/*---
+description: Abrupt completion returned by GetIterator (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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];
+
+var f = function([x, y, z] = [1, 2, 3]) {};
+
+assert.throws(TypeError, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-init-iter-get-err.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-init-iter-get-err.js
new file mode 100644
index 0000000000..2434f8b0f5
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr-dflt.template
+/*---
+description: Abrupt completion returned by GetIterator (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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();
+};
+
+var f = function([x] = iter) {};
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-init-iter-no-close.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-init-iter-no-close.js
new file mode 100644
index 0000000000..1dbe14c4bf
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-init-iter-no-close.js
@@ -0,0 +1,74 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-init-iter-no-close.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: Iterator is not closed when exhausted by pattern evaluation (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([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/expressions/function/dstr/dflt-ary-name-iter-val.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-name-iter-val.js
new file mode 100644
index 0000000000..7d286a97b8
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-name-iter-val.js
@@ -0,0 +1,73 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-name-iter-val.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: SingleNameBinding with normal value iteration (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([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/expressions/function/dstr/dflt-ary-ptrn-elem-ary-elem-init.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-elem-init.js
new file mode 100644
index 0000000000..bb53c433ea
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-elem-init.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([[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/expressions/function/dstr/dflt-ary-ptrn-elem-ary-elem-iter.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-elem-iter.js
new file mode 100644
index 0000000000..0a7410d00c
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-elem-iter.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elem-iter.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([[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/expressions/function/dstr/dflt-ary-ptrn-elem-ary-elision-init.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-elision-init.js
new file mode 100644
index 0000000000..60a88a0839
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-elision-init.js
@@ -0,0 +1,72 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-init.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([[,] = 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/expressions/function/dstr/dflt-ary-ptrn-elem-ary-elision-iter.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-elision-iter.js
new file mode 100644
index 0000000000..e9e472a0ae
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-elision-iter.js
@@ -0,0 +1,69 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-elision-iter.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([[,] = 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/expressions/function/dstr/dflt-ary-ptrn-elem-ary-empty-init.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-empty-init.js
new file mode 100644
index 0000000000..bd8f7aad3e
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-empty-init.js
@@ -0,0 +1,68 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-init.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([[] = 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/expressions/function/dstr/dflt-ary-ptrn-elem-ary-empty-iter.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-empty-iter.js
new file mode 100644
index 0000000000..63b693e69a
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-empty-iter.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-empty-iter.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([[] = 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/expressions/function/dstr/dflt-ary-ptrn-elem-ary-rest-init.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-rest-init.js
new file mode 100644
index 0000000000..f053301274
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-rest-init.js
@@ -0,0 +1,69 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-init.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is used (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([[...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/expressions/function/dstr/dflt-ary-ptrn-elem-ary-rest-iter.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-rest-iter.js
new file mode 100644
index 0000000000..36e814c2e8
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-rest-iter.js
@@ -0,0 +1,72 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-ary-rest-iter.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: BindingElement with array binding pattern and initializer is not used (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([[...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/expressions/function/dstr/dflt-ary-ptrn-elem-ary-val-null.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-ary-val-null.js
new file mode 100644
index 0000000000..ea52caf041
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr-dflt.template
+/*---
+description: Nested array destructuring with a null value (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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).
+---*/
+
+var f = function([[x]] = [null]) {};
+
+assert.throws(TypeError, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-exhausted.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-exhausted.js
new file mode 100644
index 0000000000..9ab1e72d91
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-exhausted.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-exhausted.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: Destructuring initializer with an exhausted iterator (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([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/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..606879c24d
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-arrow.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-arrow.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: SingleNameBinding does assign name to arrow functions (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([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/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-class.js
new file mode 100644
index 0000000000..e455100f33
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-class.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-class.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([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/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..303a7ff91b
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-cover.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-cover.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: SingleNameBinding does assign name to "anonymous" functions "through" cover grammar (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([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/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..b26b8018be
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-fn.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-fn.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([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/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..1292b732c4
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-fn-name-gen.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-fn-name-gen.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([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/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-hole.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-hole.js
new file mode 100644
index 0000000000..615c76fe1c
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-hole.js
@@ -0,0 +1,60 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-hole.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: Destructuring initializer with a "hole" (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([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/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-skipped.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-skipped.js
new file mode 100644
index 0000000000..7f383fd9c7
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-skipped.js
@@ -0,0 +1,69 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-skipped.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([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/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-throws.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-throws.js
new file mode 100644
index 0000000000..ce744fd4da
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr-dflt.template
+/*---
+description: Destructuring initializer returns an abrupt completion (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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).
+---*/
+
+var f = function([x = (function() { throw new Test262Error(); })()] = [undefined]) {};
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-undef.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-undef.js
new file mode 100644
index 0000000000..06cbd9f0d6
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-undef.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-init-undef.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: Destructuring initializer with an undefined value (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([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/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-init-unresolvable.js
new file mode 100644
index 0000000000..4dd14270f3
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr-dflt.template
+/*---
+description: Destructuring initializer is an unresolvable reference (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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.
+---*/
+
+var f = function([ x = unresolvableReference ] = []) {};
+
+assert.throws(ReferenceError, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-iter-complete.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-iter-complete.js
new file mode 100644
index 0000000000..f93c353849
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-iter-complete.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-complete.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: SingleNameBinding when value iteration completes (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([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/expressions/function/dstr/dflt-ary-ptrn-elem-id-iter-done.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-iter-done.js
new file mode 100644
index 0000000000..b79a097fb7
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-iter-done.js
@@ -0,0 +1,62 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-done.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([_, 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/expressions/function/dstr/dflt-ary-ptrn-elem-id-iter-step-err.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-iter-step-err.js
new file mode 100644
index 0000000000..77c450f310
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr-dflt.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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();
+ }
+ };
+};
+
+var f = function([x] = g) {};
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-iter-val-array-prototype.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-iter-val-array-prototype.js
new file mode 100644
index 0000000000..64234cc410
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-iter-val-array-prototype.js
@@ -0,0 +1,83 @@
+// 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-expr-dflt.template
+/*---
+description: Array destructuring uses overriden Array.prototype[Symbol.iterator] (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([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/expressions/function/dstr/dflt-ary-ptrn-elem-id-iter-val-err.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-iter-val-err.js
new file mode 100644
index 0000000000..3898e00d48
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr-dflt.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+ }
+ };
+};
+
+var f = function([x] = g) {};
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-iter-val.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-iter-val.js
new file mode 100644
index 0000000000..75a456f786
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-id-iter-val.js
@@ -0,0 +1,73 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-id-iter-val.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: SingleNameBinding when value iteration was completed previously (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([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/expressions/function/dstr/dflt-ary-ptrn-elem-obj-id-init.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-obj-id-init.js
new file mode 100644
index 0000000000..d5da147760
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-obj-id-init.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id-init.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([{ 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/expressions/function/dstr/dflt-ary-ptrn-elem-obj-id.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-obj-id.js
new file mode 100644
index 0000000000..4f704d2995
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-obj-id.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-id.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([{ 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/expressions/function/dstr/dflt-ary-ptrn-elem-obj-prop-id-init.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-obj-prop-id-init.js
new file mode 100644
index 0000000000..9ba50914cb
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-obj-prop-id-init.js
@@ -0,0 +1,75 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id-init.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is used (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([{ 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/expressions/function/dstr/dflt-ary-ptrn-elem-obj-prop-id.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-obj-prop-id.js
new file mode 100644
index 0000000000..fe893eff00
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-obj-prop-id.js
@@ -0,0 +1,75 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elem-obj-prop-id.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: BindingElement with object binding pattern and initializer is not used (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([{ 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/expressions/function/dstr/dflt-ary-ptrn-elem-obj-val-null.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-obj-val-null.js
new file mode 100644
index 0000000000..09af32a068
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr-dflt.template
+/*---
+description: Nested object destructuring with a null value (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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).
+---*/
+
+var f = function([{ x }] = [null]) {};
+
+assert.throws(TypeError, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-obj-val-undef.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elem-obj-val-undef.js
new file mode 100644
index 0000000000..4b3a535a2b
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr-dflt.template
+/*---
+description: Nested object destructuring with a value of `undefined` (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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).
+---*/
+
+var f = function([{ x }] = []) {};
+
+assert.throws(TypeError, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elision-exhausted.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elision-exhausted.js
new file mode 100644
index 0000000000..7792543226
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elision-exhausted.js
@@ -0,0 +1,70 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision-exhausted.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: Elision accepts exhausted iterator (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([,] = iter) {
+
+ callCount = callCount + 1;
+};
+
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elision-step-err.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elision-step-err.js
new file mode 100644
index 0000000000..f498125aa2
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr-dflt.template
+/*---
+description: Elision advances iterator and forwards abrupt completions (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+}();
+
+var f = function([,] = 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/expressions/function/dstr/dflt-ary-ptrn-elision.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elision.js
new file mode 100644
index 0000000000..cf230f2386
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-elision.js
@@ -0,0 +1,79 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-elision.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: Elision advances iterator (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([,] = 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/expressions/function/dstr/dflt-ary-ptrn-empty.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-empty.js
new file mode 100644
index 0000000000..e19af14d4c
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-empty.js
@@ -0,0 +1,62 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-empty.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: No iteration occurs for an "empty" array binding pattern (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([] = 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/expressions/function/dstr/dflt-ary-ptrn-rest-ary-elem.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-ary-elem.js
new file mode 100644
index 0000000000..861cc8858f
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-ary-elem.js
@@ -0,0 +1,86 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elem.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: Rest element containing an array BindingElementList pattern (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([...[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/expressions/function/dstr/dflt-ary-ptrn-rest-ary-elision.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-ary-elision.js
new file mode 100644
index 0000000000..deda96d7e4
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-ary-elision.js
@@ -0,0 +1,92 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-elision.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: Rest element containing an elision (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([...[,]] = 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/expressions/function/dstr/dflt-ary-ptrn-rest-ary-empty.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-ary-empty.js
new file mode 100644
index 0000000000..bdf7034c33
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-ary-empty.js
@@ -0,0 +1,75 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-empty.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: Rest element containing an "empty" array pattern (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([...[]] = 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/expressions/function/dstr/dflt-ary-ptrn-rest-ary-rest.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-ary-rest.js
new file mode 100644
index 0000000000..8c34d5fb01
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-ary-rest.js
@@ -0,0 +1,71 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-ary-rest.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: Rest element containing a rest element (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([...[...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/expressions/function/dstr/dflt-ary-ptrn-rest-id-direct.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-id-direct.js
new file mode 100644
index 0000000000..477530f12f
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-id-direct.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-direct.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: Lone rest element (direct binding) (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+includes: [compareArray.js]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([...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/expressions/function/dstr/dflt-ary-ptrn-rest-id-elision-next-err.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-id-elision-next-err.js
new file mode 100644
index 0000000000..73952b8ec5
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr-dflt.template
+/*---
+description: Rest element following elision elements (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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(); })();
+
+var f = function([, ...x] = iter) {};
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-id-elision.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-id-elision.js
new file mode 100644
index 0000000000..58a0567566
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-id-elision.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-elision.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: Rest element following elision elements (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([ , , ...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/expressions/function/dstr/dflt-ary-ptrn-rest-id-exhausted.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-id-exhausted.js
new file mode 100644
index 0000000000..e67b400ba5
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-id-exhausted.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id-exhausted.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: RestElement applied to an exhausted iterator (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([, , ...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/expressions/function/dstr/dflt-ary-ptrn-rest-id-iter-step-err.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-id-iter-step-err.js
new file mode 100644
index 0000000000..f399cb9547
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr-dflt.template
+/*---
+description: Error forwarding when IteratorStep returns an abrupt completion (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+}();
+
+var f = function([...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/expressions/function/dstr/dflt-ary-ptrn-rest-id-iter-val-err.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-id-iter-val-err.js
new file mode 100644
index 0000000000..3356dec995
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr-dflt.template
+/*---
+description: Error forwarding when IteratorValue returns an abrupt completion (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [Symbol.iterator, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+ }
+ };
+};
+
+var f = function([...x] = iter) {};
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-id.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-id.js
new file mode 100644
index 0000000000..a98268c917
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-id.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-id.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: Lone rest element (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([...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/expressions/function/dstr/dflt-ary-ptrn-rest-init-ary.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-init-ary.js
new file mode 100644
index 0000000000..a26e3fcb0a
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-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/ary-ptrn-rest-init-ary.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: Rest element (nested array pattern) does not support initializer (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([...[ x ] = []] = []) {
+
+ callCount = callCount + 1;
+};
+
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-init-id.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-init-id.js
new file mode 100644
index 0000000000..cb6668ccea
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-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/ary-ptrn-rest-init-id.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: Rest element (identifier) does not support initializer (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([...x = []] = []) {
+
+ callCount = callCount + 1;
+};
+
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-init-obj.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-init-obj.js
new file mode 100644
index 0000000000..b654efce51
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-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/ary-ptrn-rest-init-obj.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: Rest element (nested object pattern) does not support initializer (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([...{ x } = []] = []) {
+
+ callCount = callCount + 1;
+};
+
+f();
+assert.sameValue(callCount, 1, 'function invoked exactly once');
diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-not-final-ary.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-not-final-ary.js
new file mode 100644
index 0000000000..d3b8c0dc3c
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-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/ary-ptrn-rest-not-final-ary.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: Rest element (array binding pattern) may not be followed by any element (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([...[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/expressions/function/dstr/dflt-ary-ptrn-rest-not-final-id.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-not-final-id.js
new file mode 100644
index 0000000000..cfefd556a5
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-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/ary-ptrn-rest-not-final-id.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: Rest element (identifier) may not be followed by any element (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([...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/expressions/function/dstr/dflt-ary-ptrn-rest-not-final-obj.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-not-final-obj.js
new file mode 100644
index 0000000000..80ebd93ce0
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-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/ary-ptrn-rest-not-final-obj.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: Rest element (object binding pattern) may not be followed by any element (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([...{ 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/expressions/function/dstr/dflt-ary-ptrn-rest-obj-id.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-obj-id.js
new file mode 100644
index 0000000000..6a708643a0
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-obj-id.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-id.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: Rest element containing an object binding pattern (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([...{ 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/expressions/function/dstr/dflt-ary-ptrn-rest-obj-prop-id.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-obj-prop-id.js
new file mode 100644
index 0000000000..15497db7b2
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-ary-ptrn-rest-obj-prop-id.js
@@ -0,0 +1,71 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/ary-ptrn-rest-obj-prop-id.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: Rest element containing an object binding pattern (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function([...{ 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/expressions/function/dstr/dflt-obj-init-null.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-init-null.js
new file mode 100644
index 0000000000..39ff450035
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr-dflt.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (null) (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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 f = function({} = null) {};
+
+assert.throws(TypeError, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-init-undefined.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-init-undefined.js
new file mode 100644
index 0000000000..067c51ec7f
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr-dflt.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (undefined) (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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 f = function({} = undefined) {};
+
+assert.throws(TypeError, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-empty.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-empty.js
new file mode 100644
index 0000000000..ff313f6465
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-empty.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-empty.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: No property access occurs for an "empty" object binding pattern (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function({} = 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/expressions/function/dstr/dflt-obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-get-value-err.js
new file mode 100644
index 0000000000..df1a49b049
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr-dflt.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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();
+ }
+});
+
+var f = function({ poisoned } = poisonedProperty) {};
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..f4ed156c43
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-fn-name-arrow.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to arrow functions (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function({ 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/expressions/function/dstr/dflt-obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..26bbfd3130
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-fn-name-class.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function({ 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/expressions/function/dstr/dflt-obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..5ca05b670f
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-fn-name-cover.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function({ 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/expressions/function/dstr/dflt-obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..87ebbd0db8
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-fn-name-fn.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function({ 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/expressions/function/dstr/dflt-obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..ce56f7ff23
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function({ 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/expressions/function/dstr/dflt-obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..0e720d6a6e
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-skipped.js
@@ -0,0 +1,68 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-skipped.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function({ 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/expressions/function/dstr/dflt-obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-throws.js
new file mode 100644
index 0000000000..bb9cb31969
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr-dflt.template
+/*---
+description: Error thrown when evaluating the initializer (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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();
+}
+
+var f = function({ x = thrower() } = {}) {};
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-init-unresolvable.js
new file mode 100644
index 0000000000..1f30fd328d
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr-dflt.template
+/*---
+description: Destructuring initializer is an unresolvable reference (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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.
+---*/
+
+var f = function({ x = unresolvableReference } = {}) {};
+
+assert.throws(ReferenceError, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..ca164ee83d
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-id-trailing-comma.js
@@ -0,0 +1,58 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-trailing-comma.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function({ 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/expressions/function/dstr/dflt-obj-ptrn-list-err.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-list-err.js
new file mode 100644
index 0000000000..c474937463
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr-dflt.template
+/*---
+description: Binding property list evaluation is interrupted by an abrupt completion (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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();
+}
+
+var f = function({ 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/expressions/function/dstr/dflt-obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..94513c1e22
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-ary-init.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-init.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: Object binding pattern with "nested" array binding pattern using initializer (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function({ 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/expressions/function/dstr/dflt-obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..1082c765a4
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-ary-trailing-comma.js
@@ -0,0 +1,58 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function({ 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/expressions/function/dstr/dflt-obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-ary-value-null.js
new file mode 100644
index 0000000000..b502dccac1
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr-dflt.template
+/*---
+description: Object binding pattern with "nested" array binding pattern taking the `null` value (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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 f = function({ 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/expressions/function/dstr/dflt-obj-ptrn-prop-ary.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..6ba8fca917
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-ary.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: Object binding pattern with "nested" array binding pattern not using initializer (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function({ 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/expressions/function/dstr/dflt-obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-eval-err.js
new file mode 100644
index 0000000000..d51f98ee29
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr-dflt.template
+/*---
+description: Evaluation of property name returns an abrupt completion (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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();
+}
+
+var f = function({ [thrower()]: x } = {}) {};
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-id-get-value-err.js
new file mode 100644
index 0000000000..62b1a90946
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr-dflt.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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();
+ }
+});
+
+var f = function({ poisoned: x = ++initEvalCount } = poisonedProperty) {};
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+assert.sameValue(initEvalCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..bb5d788af7
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-id-init-skipped.js
@@ -0,0 +1,80 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function({ 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/expressions/function/dstr/dflt-obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-id-init-throws.js
new file mode 100644
index 0000000000..a9b56e6ce1
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr-dflt.template
+/*---
+description: Error thrown when evaluating the initializer (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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();
+}
+
+var f = function({ x: y = thrower() } = {}) {};
+
+assert.throws(Test262Error, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-id-init-unresolvable.js
new file mode 100644
index 0000000000..ad657f957c
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr-dflt.template
+/*---
+description: Destructuring initializer is an unresolvable reference (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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.
+---*/
+
+var f = function({ x: y = unresolvableReference } = {}) {};
+
+assert.throws(ReferenceError, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..4ce963ec7c
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-id-init.js
@@ -0,0 +1,61 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: Binding as specified via property name, identifier, and initializer (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function({ 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/expressions/function/dstr/dflt-obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..45db6b64d2
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-id-trailing-comma.js
@@ -0,0 +1,62 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function({ 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/expressions/function/dstr/dflt-obj-ptrn-prop-id.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..f947966f79
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-id.js
@@ -0,0 +1,61 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: Binding as specified via property name and identifier (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function({ 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/expressions/function/dstr/dflt-obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..a49217e15c
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-obj-init.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-init.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern using initializer (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function({ 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/expressions/function/dstr/dflt-obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-obj-value-null.js
new file mode 100644
index 0000000000..d323e25d38
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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 f = function({ 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/expressions/function/dstr/dflt-obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-obj-value-undef.js
new file mode 100644
index 0000000000..52748be323
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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 f = function({ w: { x, y, z } = undefined } = { }) {};
+
+assert.throws(TypeError, function() {
+ f();
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-obj.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..3f872708e1
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-prop-obj.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: Object binding pattern with "nested" object binding pattern not using initializer (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding, default-parameters]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function({ 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/expressions/function/dstr/dflt-obj-ptrn-rest-getter.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..7991ebe7fb
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-rest-getter.js
@@ -0,0 +1,60 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-getter.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: Getter is called when obj is being deconstructed to a rest Object (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [object-rest, destructuring-binding, default-parameters]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function({...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/expressions/function/dstr/dflt-obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..49a97715ae
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-rest-skip-non-enumerable.js
@@ -0,0 +1,68 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: Rest object doesn't contain non-enumerable properties (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [object-rest, destructuring-binding, default-parameters]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function({...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/expressions/function/dstr/dflt-obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..59fab7659d
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/dflt-obj-ptrn-rest-val-obj.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-val-obj.case
+// - src/dstr-binding/default/func-expr-dflt.template
+/*---
+description: Rest object contains just unextracted data (function expression (default parameter))
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [object-rest, destructuring-binding, default-parameters]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function({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/expressions/function/dstr/obj-init-null.js b/js/src/tests/test262/language/expressions/function/dstr/obj-init-null.js
new file mode 100644
index 0000000000..22a89be415
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (null) (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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 f = function({}) {};
+
+assert.throws(TypeError, function() {
+ f(null);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/function/dstr/obj-init-undefined.js b/js/src/tests/test262/language/expressions/function/dstr/obj-init-undefined.js
new file mode 100644
index 0000000000..e33f15a702
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr.template
+/*---
+description: Value specifed for object binding pattern must be object coercible (undefined) (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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 f = function({}) {};
+
+assert.throws(TypeError, function() {
+ f(undefined);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-empty.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-empty.js
new file mode 100644
index 0000000000..670c514037
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-empty.js
@@ -0,0 +1,63 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-empty.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: No property access occurs for an "empty" object binding pattern (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function({}) {
+ 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/expressions/function/dstr/obj-ptrn-id-get-value-err.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-get-value-err.js
new file mode 100644
index 0000000000..9ba7becf45
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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();
+ }
+});
+
+var f = function({ poisoned }) {};
+
+assert.throws(Test262Error, function() {
+ f(poisonedProperty);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-fn-name-arrow.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-fn-name-arrow.js
new file mode 100644
index 0000000000..45bfd250f2
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-fn-name-arrow.js
@@ -0,0 +1,64 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-arrow.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: SingleNameBinding assigns `name` to arrow functions (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function({ 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/expressions/function/dstr/obj-ptrn-id-init-fn-name-class.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-fn-name-class.js
new file mode 100644
index 0000000000..8d624ebc9a
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-fn-name-class.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-class.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" classes (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function({ 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/expressions/function/dstr/obj-ptrn-id-init-fn-name-cover.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-fn-name-cover.js
new file mode 100644
index 0000000000..77a4382458
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-fn-name-cover.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-cover.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: SingleNameBinding assigns `name` to "anonymous" functions "through" cover grammar (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function({ 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/expressions/function/dstr/obj-ptrn-id-init-fn-name-fn.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-fn-name-fn.js
new file mode 100644
index 0000000000..e26c192533
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-fn-name-fn.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-fn.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" functions (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function({ 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/expressions/function/dstr/obj-ptrn-id-init-fn-name-gen.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-fn-name-gen.js
new file mode 100644
index 0000000000..e24a2c0684
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-fn-name-gen.js
@@ -0,0 +1,66 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-fn-name-gen.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: SingleNameBinding assigns name to "anonymous" generator functions (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [generators, destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function({ 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/expressions/function/dstr/obj-ptrn-id-init-skipped.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-skipped.js
new file mode 100644
index 0000000000..624c628473
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-skipped.js
@@ -0,0 +1,68 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-init-skipped.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function({ 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/expressions/function/dstr/obj-ptrn-id-init-throws.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-throws.js
new file mode 100644
index 0000000000..d93fba3d71
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr.template
+/*---
+description: Error thrown when evaluating the initializer (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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();
+}
+
+var f = function({ x = thrower() }) {};
+
+assert.throws(Test262Error, function() {
+ f({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-init-unresolvable.js
new file mode 100644
index 0000000000..3d0fd3ca7b
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr.template
+/*---
+description: Destructuring initializer is an unresolvable reference (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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.
+---*/
+
+var f = function({ x = unresolvableReference }) {};
+
+assert.throws(ReferenceError, function() {
+ f({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-trailing-comma.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-trailing-comma.js
new file mode 100644
index 0000000000..1dda45cabb
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-id-trailing-comma.js
@@ -0,0 +1,58 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-id-trailing-comma.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function({ 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/expressions/function/dstr/obj-ptrn-list-err.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-list-err.js
new file mode 100644
index 0000000000..22862d4f3b
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr.template
+/*---
+description: Binding property list evaluation is interrupted by an abrupt completion (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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();
+}
+
+var f = function({ 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/expressions/function/dstr/obj-ptrn-prop-ary-init.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-ary-init.js
new file mode 100644
index 0000000000..00a22b17bc
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-ary-init.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-init.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: Object binding pattern with "nested" array binding pattern using initializer (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function({ 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/expressions/function/dstr/obj-ptrn-prop-ary-trailing-comma.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-ary-trailing-comma.js
new file mode 100644
index 0000000000..e1562352c6
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-ary-trailing-comma.js
@@ -0,0 +1,58 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary-trailing-comma.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function({ 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/expressions/function/dstr/obj-ptrn-prop-ary-value-null.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-ary-value-null.js
new file mode 100644
index 0000000000..c99c84dc32
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr.template
+/*---
+description: Object binding pattern with "nested" array binding pattern taking the `null` value (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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 f = function({ 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/expressions/function/dstr/obj-ptrn-prop-ary.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-ary.js
new file mode 100644
index 0000000000..d5f5feab97
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-ary.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-ary.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: Object binding pattern with "nested" array binding pattern not using initializer (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function({ 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/expressions/function/dstr/obj-ptrn-prop-eval-err.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-eval-err.js
new file mode 100644
index 0000000000..876cde65a3
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr.template
+/*---
+description: Evaluation of property name returns an abrupt completion (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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();
+}
+
+var f = function({ [thrower()]: x }) {};
+
+assert.throws(Test262Error, function() {
+ f({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-id-get-value-err.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-id-get-value-err.js
new file mode 100644
index 0000000000..2f403ac7f5
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr.template
+/*---
+description: Error thrown when accessing the corresponding property of the value object (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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();
+ }
+});
+
+var f = function({ poisoned: x = ++initEvalCount }) {};
+
+assert.throws(Test262Error, function() {
+ f(poisonedProperty);
+});
+
+assert.sameValue(initEvalCount, 0);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-id-init-skipped.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-id-init-skipped.js
new file mode 100644
index 0000000000..b5f3c99e70
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-id-init-skipped.js
@@ -0,0 +1,80 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init-skipped.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: Destructuring initializer is not evaluated when value is not `undefined` (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function({ 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/expressions/function/dstr/obj-ptrn-prop-id-init-throws.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-id-init-throws.js
new file mode 100644
index 0000000000..e3e3745f54
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr.template
+/*---
+description: Error thrown when evaluating the initializer (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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();
+}
+
+var f = function({ x: y = thrower() }) {};
+
+assert.throws(Test262Error, function() {
+ f({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-id-init-unresolvable.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-id-init-unresolvable.js
new file mode 100644
index 0000000000..f8db30d45e
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr.template
+/*---
+description: Destructuring initializer is an unresolvable reference (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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.
+---*/
+
+var f = function({ x: y = unresolvableReference }) {};
+
+assert.throws(ReferenceError, function() {
+ f({});
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-id-init.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-id-init.js
new file mode 100644
index 0000000000..bcb826d0ab
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-id-init.js
@@ -0,0 +1,61 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-init.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: Binding as specified via property name, identifier, and initializer (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function({ 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/expressions/function/dstr/obj-ptrn-prop-id-trailing-comma.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-id-trailing-comma.js
new file mode 100644
index 0000000000..17207afe6b
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-id-trailing-comma.js
@@ -0,0 +1,62 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id-trailing-comma.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: Trailing comma is allowed following BindingPropertyList (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function({ 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/expressions/function/dstr/obj-ptrn-prop-id.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-id.js
new file mode 100644
index 0000000000..9b75e6791b
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-id.js
@@ -0,0 +1,61 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-id.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: Binding as specified via property name and identifier (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function({ 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/expressions/function/dstr/obj-ptrn-prop-obj-init.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-obj-init.js
new file mode 100644
index 0000000000..0106390cd8
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-obj-init.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj-init.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: Object binding pattern with "nested" object binding pattern using initializer (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function({ 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/expressions/function/dstr/obj-ptrn-prop-obj-value-null.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-obj-value-null.js
new file mode 100644
index 0000000000..08942b8e9b
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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 f = function({ 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/expressions/function/dstr/obj-ptrn-prop-obj-value-undef.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-obj-value-undef.js
new file mode 100644
index 0000000000..9b11a750cc
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/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/func-expr.template
+/*---
+description: Object binding pattern with "nested" object binding pattern taking the `null` value (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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 f = function({ w: { x, y, z } = undefined }) {};
+
+assert.throws(TypeError, function() {
+ f({ });
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-obj.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-obj.js
new file mode 100644
index 0000000000..57e8dcd72e
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-prop-obj.js
@@ -0,0 +1,65 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-prop-obj.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: Object binding pattern with "nested" object binding pattern not using initializer (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [destructuring-binding]
+flags: [generated]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function({ 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/expressions/function/dstr/obj-ptrn-rest-getter.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-rest-getter.js
new file mode 100644
index 0000000000..4742f63daf
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-rest-getter.js
@@ -0,0 +1,60 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-getter.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: Getter is called when obj is being deconstructed to a rest Object (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function({...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/expressions/function/dstr/obj-ptrn-rest-skip-non-enumerable.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-rest-skip-non-enumerable.js
new file mode 100644
index 0000000000..a947afad0a
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-rest-skip-non-enumerable.js
@@ -0,0 +1,68 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-skip-non-enumerable.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: Rest object doesn't contain non-enumerable properties (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function({...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/expressions/function/dstr/obj-ptrn-rest-val-obj.js b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-rest-val-obj.js
new file mode 100644
index 0000000000..418291f83a
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/obj-ptrn-rest-val-obj.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/dstr-binding/obj-ptrn-rest-val-obj.case
+// - src/dstr-binding/default/func-expr.template
+/*---
+description: Rest object contains just unextracted data (function expression)
+esid: sec-function-definitions-runtime-semantics-evaluation
+features: [object-rest, destructuring-binding]
+flags: [generated]
+includes: [propertyHelper.js]
+info: |
+ FunctionExpression : function ( FormalParameters ) { FunctionBody }
+
+ [...]
+ 3. Let closure 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;
+var f;
+f = function({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/expressions/function/dstr/shell.js b/js/src/tests/test262/language/expressions/function/dstr/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/expressions/function/dstr/shell.js