summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/module-code
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/language/module-code')
-rw-r--r--js/src/tests/test262/language/module-code/browser.js0
-rw-r--r--js/src/tests/test262/language/module-code/comment-multi-line-html-close.js18
-rw-r--r--js/src/tests/test262/language/module-code/comment-single-line-html-close.js17
-rw-r--r--js/src/tests/test262/language/module-code/comment-single-line-html-open.js17
-rw-r--r--js/src/tests/test262/language/module-code/early-dup-assert-key-export.js25
-rw-r--r--js/src/tests/test262/language/module-code/early-dup-assert-key-import-nobinding.js26
-rw-r--r--js/src/tests/test262/language/module-code/early-dup-assert-key-import-withbinding.js26
-rw-r--r--js/src/tests/test262/language/module-code/early-dup-export-as-star-as.js20
-rw-r--r--js/src/tests/test262/language/module-code/early-dup-export-decl.js19
-rw-r--r--js/src/tests/test262/language/module-code/early-dup-export-dflt-id.js20
-rw-r--r--js/src/tests/test262/language/module-code/early-dup-export-dflt.js18
-rw-r--r--js/src/tests/test262/language/module-code/early-dup-export-id-as.js20
-rw-r--r--js/src/tests/test262/language/module-code/early-dup-export-id.js19
-rw-r--r--js/src/tests/test262/language/module-code/early-dup-export-star-as-dflt.js20
-rw-r--r--js/src/tests/test262/language/module-code/early-dup-lables.js19
-rw-r--r--js/src/tests/test262/language/module-code/early-dup-lex.js19
-rw-r--r--js/src/tests/test262/language/module-code/early-dup-top-function-async-generator.js21
-rw-r--r--js/src/tests/test262/language/module-code/early-dup-top-function-async.js21
-rw-r--r--js/src/tests/test262/language/module-code/early-dup-top-function-generator.js21
-rw-r--r--js/src/tests/test262/language/module-code/early-dup-top-function.js21
-rw-r--r--js/src/tests/test262/language/module-code/early-export-global.js20
-rw-r--r--js/src/tests/test262/language/module-code/early-export-ill-formed-string.js26
-rw-r--r--js/src/tests/test262/language/module-code/early-export-unresolvable.js18
-rw-r--r--js/src/tests/test262/language/module-code/early-import-arguments.js36
-rw-r--r--js/src/tests/test262/language/module-code/early-import-as-arguments.js36
-rw-r--r--js/src/tests/test262/language/module-code/early-import-as-eval.js36
-rw-r--r--js/src/tests/test262/language/module-code/early-import-eval.js36
-rw-r--r--js/src/tests/test262/language/module-code/early-lex-and-var.js19
-rw-r--r--js/src/tests/test262/language/module-code/early-new-target.js17
-rw-r--r--js/src/tests/test262/language/module-code/early-strict-mode.js16
-rw-r--r--js/src/tests/test262/language/module-code/early-super.js16
-rw-r--r--js/src/tests/test262/language/module-code/early-undef-break.js19
-rw-r--r--js/src/tests/test262/language/module-code/early-undef-continue.js19
-rw-r--r--js/src/tests/test262/language/module-code/eval-export-cls-semi.js18
-rw-r--r--js/src/tests/test262/language/module-code/eval-export-dflt-cls-anon-semi.js18
-rw-r--r--js/src/tests/test262/language/module-code/eval-export-dflt-cls-anon.js36
-rw-r--r--js/src/tests/test262/language/module-code/eval-export-dflt-cls-name-meth.js37
-rw-r--r--js/src/tests/test262/language/module-code/eval-export-dflt-cls-named-semi.js18
-rw-r--r--js/src/tests/test262/language/module-code/eval-export-dflt-cls-named.js36
-rw-r--r--js/src/tests/test262/language/module-code/eval-export-dflt-expr-cls-anon.js35
-rw-r--r--js/src/tests/test262/language/module-code/eval-export-dflt-expr-cls-name-meth.js38
-rw-r--r--js/src/tests/test262/language/module-code/eval-export-dflt-expr-cls-named.js35
-rw-r--r--js/src/tests/test262/language/module-code/eval-export-dflt-expr-err-eval.js34
-rw-r--r--js/src/tests/test262/language/module-code/eval-export-dflt-expr-err-get-value.js34
-rw-r--r--js/src/tests/test262/language/module-code/eval-export-dflt-expr-fn-anon.js35
-rw-r--r--js/src/tests/test262/language/module-code/eval-export-dflt-expr-fn-named.js35
-rw-r--r--js/src/tests/test262/language/module-code/eval-export-dflt-expr-gen-anon.js36
-rw-r--r--js/src/tests/test262/language/module-code/eval-export-dflt-expr-gen-named.js36
-rw-r--r--js/src/tests/test262/language/module-code/eval-export-dflt-expr-in.js30
-rw-r--r--js/src/tests/test262/language/module-code/eval-export-dflt-fun-anon-semi.js18
-rw-r--r--js/src/tests/test262/language/module-code/eval-export-dflt-fun-named-semi.js18
-rw-r--r--js/src/tests/test262/language/module-code/eval-export-dflt-gen-anon-semi.js19
-rw-r--r--js/src/tests/test262/language/module-code/eval-export-dflt-gen-named-semi.js19
-rw-r--r--js/src/tests/test262/language/module-code/eval-export-fun-semi.js18
-rw-r--r--js/src/tests/test262/language/module-code/eval-export-gen-semi.js19
-rw-r--r--js/src/tests/test262/language/module-code/eval-gtbndng-indirect-faux-assertion.js72
-rw-r--r--js/src/tests/test262/language/module-code/eval-gtbndng-indirect-trlng-comma.js26
-rw-r--r--js/src/tests/test262/language/module-code/eval-gtbndng-indirect-trlng-comma_FIXTURE.js5
-rw-r--r--js/src/tests/test262/language/module-code/eval-gtbndng-indirect-update-as.js37
-rw-r--r--js/src/tests/test262/language/module-code/eval-gtbndng-indirect-update-as_FIXTURE.js10
-rw-r--r--js/src/tests/test262/language/module-code/eval-gtbndng-indirect-update-dflt.js27
-rw-r--r--js/src/tests/test262/language/module-code/eval-gtbndng-indirect-update-dflt_FIXTURE.js8
-rw-r--r--js/src/tests/test262/language/module-code/eval-gtbndng-indirect-update.js35
-rw-r--r--js/src/tests/test262/language/module-code/eval-gtbndng-indirect-update_FIXTURE.js10
-rw-r--r--js/src/tests/test262/language/module-code/eval-gtbndng-local-bndng-cls.js38
-rw-r--r--js/src/tests/test262/language/module-code/eval-gtbndng-local-bndng-const.js27
-rw-r--r--js/src/tests/test262/language/module-code/eval-gtbndng-local-bndng-let.js30
-rw-r--r--js/src/tests/test262/language/module-code/eval-gtbndng-local-bndng-var.js43
-rw-r--r--js/src/tests/test262/language/module-code/eval-rqstd-abrupt-err-type_FIXTURE.js5
-rw-r--r--js/src/tests/test262/language/module-code/eval-rqstd-abrupt-err-uri_FIXTURE.js5
-rw-r--r--js/src/tests/test262/language/module-code/eval-rqstd-abrupt.js23
-rw-r--r--js/src/tests/test262/language/module-code/eval-rqstd-once.js36
-rw-r--r--js/src/tests/test262/language/module-code/eval-rqstd-once_FIXTURE.js16
-rw-r--r--js/src/tests/test262/language/module-code/eval-rqstd-order-1_FIXTURE.js5
-rw-r--r--js/src/tests/test262/language/module-code/eval-rqstd-order-2_FIXTURE.js5
-rw-r--r--js/src/tests/test262/language/module-code/eval-rqstd-order-3_FIXTURE.js5
-rw-r--r--js/src/tests/test262/language/module-code/eval-rqstd-order-4_FIXTURE.js7
-rw-r--r--js/src/tests/test262/language/module-code/eval-rqstd-order-5_FIXTURE.js5
-rw-r--r--js/src/tests/test262/language/module-code/eval-rqstd-order-6_FIXTURE.js7
-rw-r--r--js/src/tests/test262/language/module-code/eval-rqstd-order-7_FIXTURE.js5
-rw-r--r--js/src/tests/test262/language/module-code/eval-rqstd-order-8_FIXTURE.js7
-rw-r--r--js/src/tests/test262/language/module-code/eval-rqstd-order-9_FIXTURE.js5
-rw-r--r--js/src/tests/test262/language/module-code/eval-rqstd-order.js43
-rw-r--r--js/src/tests/test262/language/module-code/eval-self-abrupt.js20
-rw-r--r--js/src/tests/test262/language/module-code/eval-self-once.js48
-rw-r--r--js/src/tests/test262/language/module-code/eval-this.js48
-rw-r--r--js/src/tests/test262/language/module-code/export-default-asyncfunction-declaration-binding-exists.js24
-rw-r--r--js/src/tests/test262/language/module-code/export-default-asyncfunction-declaration-binding.js21
-rw-r--r--js/src/tests/test262/language/module-code/export-default-asyncgenerator-declaration-binding-exists.js24
-rw-r--r--js/src/tests/test262/language/module-code/export-default-asyncgenerator-declaration-binding.js21
-rw-r--r--js/src/tests/test262/language/module-code/export-default-function-declaration-binding-exists.js25
-rw-r--r--js/src/tests/test262/language/module-code/export-default-function-declaration-binding.js21
-rw-r--r--js/src/tests/test262/language/module-code/export-default-generator-declaration-binding-exists.js24
-rw-r--r--js/src/tests/test262/language/module-code/export-default-generator-declaration-binding.js21
-rw-r--r--js/src/tests/test262/language/module-code/export-expname-binding-index.js51
-rw-r--r--js/src/tests/test262/language/module-code/export-expname-binding-index_FIXTURE.js7
-rw-r--r--js/src/tests/test262/language/module-code/export-expname-binding-string.js21
-rw-r--r--js/src/tests/test262/language/module-code/export-expname-from-as-unpaired-surrogate.js22
-rw-r--r--js/src/tests/test262/language/module-code/export-expname-from-binding-string.js26
-rw-r--r--js/src/tests/test262/language/module-code/export-expname-from-star-string.js23
-rw-r--r--js/src/tests/test262/language/module-code/export-expname-from-star-unpaired-surrogate.js22
-rw-r--r--js/src/tests/test262/language/module-code/export-expname-from-star.js20
-rw-r--r--js/src/tests/test262/language/module-code/export-expname-from-string-binding.js24
-rw-r--r--js/src/tests/test262/language/module-code/export-expname-from-string-string.js24
-rw-r--r--js/src/tests/test262/language/module-code/export-expname-from-string.js25
-rw-r--r--js/src/tests/test262/language/module-code/export-expname-from-unpaired-surrogate.js22
-rw-r--r--js/src/tests/test262/language/module-code/export-expname-import-string-binding.js20
-rw-r--r--js/src/tests/test262/language/module-code/export-expname-import-unpaired-surrogate.js22
-rw-r--r--js/src/tests/test262/language/module-code/export-expname-string-binding.js24
-rw-r--r--js/src/tests/test262/language/module-code/export-expname-unpaired-surrogate.js25
-rw-r--r--js/src/tests/test262/language/module-code/export-expname_FIXTURE.js7
-rw-r--r--js/src/tests/test262/language/module-code/export-star-as-dflt.js31
-rw-r--r--js/src/tests/test262/language/module-code/export-star-as-dflt_FIXTURE.js5
-rw-r--r--js/src/tests/test262/language/module-code/import-assertion-1_FIXTURE.js4
-rw-r--r--js/src/tests/test262/language/module-code/import-assertion-2_FIXTURE.js4
-rw-r--r--js/src/tests/test262/language/module-code/import-assertion-3_FIXTURE.js4
-rw-r--r--js/src/tests/test262/language/module-code/import-assertion-empty.js33
-rw-r--r--js/src/tests/test262/language/module-code/import-assertion-key-identifiername.js34
-rw-r--r--js/src/tests/test262/language/module-code/import-assertion-key-string-double.js34
-rw-r--r--js/src/tests/test262/language/module-code/import-assertion-key-string-single.js34
-rw-r--r--js/src/tests/test262/language/module-code/import-assertion-many.js34
-rw-r--r--js/src/tests/test262/language/module-code/import-assertion-newlines.js52
-rw-r--r--js/src/tests/test262/language/module-code/import-assertion-trlng-comma.js34
-rw-r--r--js/src/tests/test262/language/module-code/import-assertion-value-string-double.js34
-rw-r--r--js/src/tests/test262/language/module-code/import-assertion-value-string-single.js34
-rw-r--r--js/src/tests/test262/language/module-code/instn-iee-bndng-cls.js56
-rw-r--r--js/src/tests/test262/language/module-code/instn-iee-bndng-cls_FIXTURE.js22
-rw-r--r--js/src/tests/test262/language/module-code/instn-iee-bndng-const.js56
-rw-r--r--js/src/tests/test262/language/module-code/instn-iee-bndng-const_FIXTURE.js22
-rw-r--r--js/src/tests/test262/language/module-code/instn-iee-bndng-fun.js64
-rw-r--r--js/src/tests/test262/language/module-code/instn-iee-bndng-fun_FIXTURE.js22
-rw-r--r--js/src/tests/test262/language/module-code/instn-iee-bndng-gen.js66
-rw-r--r--js/src/tests/test262/language/module-code/instn-iee-bndng-gen_FIXTURE.js22
-rw-r--r--js/src/tests/test262/language/module-code/instn-iee-bndng-let.js56
-rw-r--r--js/src/tests/test262/language/module-code/instn-iee-bndng-let_FIXTURE.js22
-rw-r--r--js/src/tests/test262/language/module-code/instn-iee-bndng-var.js65
-rw-r--r--js/src/tests/test262/language/module-code/instn-iee-bndng-var_FIXTURE.js22
-rw-r--r--js/src/tests/test262/language/module-code/instn-iee-err-ambiguous-1_FIXTURE.js5
-rw-r--r--js/src/tests/test262/language/module-code/instn-iee-err-ambiguous-2_FIXTURE.js5
-rw-r--r--js/src/tests/test262/language/module-code/instn-iee-err-ambiguous-as.js40
-rw-r--r--js/src/tests/test262/language/module-code/instn-iee-err-ambiguous.js40
-rw-r--r--js/src/tests/test262/language/module-code/instn-iee-err-ambiguous_FIXTURE.js6
-rw-r--r--js/src/tests/test262/language/module-code/instn-iee-err-circular-as.js29
-rw-r--r--js/src/tests/test262/language/module-code/instn-iee-err-circular.js29
-rw-r--r--js/src/tests/test262/language/module-code/instn-iee-err-circular_FIXTURE.js5
-rw-r--r--js/src/tests/test262/language/module-code/instn-iee-err-dflt-thru-star-as.js28
-rw-r--r--js/src/tests/test262/language/module-code/instn-iee-err-dflt-thru-star-dflt_FIXTURE.js6
-rw-r--r--js/src/tests/test262/language/module-code/instn-iee-err-dflt-thru-star-int_FIXTURE.js5
-rw-r--r--js/src/tests/test262/language/module-code/instn-iee-err-dflt-thru-star.js28
-rw-r--r--js/src/tests/test262/language/module-code/instn-iee-err-not-found-as.js28
-rw-r--r--js/src/tests/test262/language/module-code/instn-iee-err-not-found-empty_FIXTURE.js5
-rw-r--r--js/src/tests/test262/language/module-code/instn-iee-err-not-found.js28
-rw-r--r--js/src/tests/test262/language/module-code/instn-iee-iee-cycle-2_FIXTURE.js17
-rw-r--r--js/src/tests/test262/language/module-code/instn-iee-iee-cycle.js52
-rw-r--r--js/src/tests/test262/language/module-code/instn-iee-star-cycle-2_FIXTURE.js5
-rw-r--r--js/src/tests/test262/language/module-code/instn-iee-star-cycle-indirect-x_FIXTURE.js9
-rw-r--r--js/src/tests/test262/language/module-code/instn-iee-star-cycle.js46
-rw-r--r--js/src/tests/test262/language/module-code/instn-iee-trlng-comma.js24
-rw-r--r--js/src/tests/test262/language/module-code/instn-iee-trlng-comma_FIXTURE.js5
-rw-r--r--js/src/tests/test262/language/module-code/instn-local-bndng-cls.js47
-rw-r--r--js/src/tests/test262/language/module-code/instn-local-bndng-const.js47
-rw-r--r--js/src/tests/test262/language/module-code/instn-local-bndng-export-cls.js33
-rw-r--r--js/src/tests/test262/language/module-code/instn-local-bndng-export-const.js32
-rw-r--r--js/src/tests/test262/language/module-code/instn-local-bndng-export-fun.js35
-rw-r--r--js/src/tests/test262/language/module-code/instn-local-bndng-export-gen.js35
-rw-r--r--js/src/tests/test262/language/module-code/instn-local-bndng-export-let.js32
-rw-r--r--js/src/tests/test262/language/module-code/instn-local-bndng-export-var.js35
-rw-r--r--js/src/tests/test262/language/module-code/instn-local-bndng-for-dup.js26
-rw-r--r--js/src/tests/test262/language/module-code/instn-local-bndng-for.js39
-rw-r--r--js/src/tests/test262/language/module-code/instn-local-bndng-fun.js52
-rw-r--r--js/src/tests/test262/language/module-code/instn-local-bndng-gen.js53
-rw-r--r--js/src/tests/test262/language/module-code/instn-local-bndng-let.js47
-rw-r--r--js/src/tests/test262/language/module-code/instn-local-bndng-var-dup.js26
-rw-r--r--js/src/tests/test262/language/module-code/instn-local-bndng-var.js40
-rw-r--r--js/src/tests/test262/language/module-code/instn-named-bndng-cls.js49
-rw-r--r--js/src/tests/test262/language/module-code/instn-named-bndng-const.js49
-rw-r--r--js/src/tests/test262/language/module-code/instn-named-bndng-dflt-cls.js42
-rw-r--r--js/src/tests/test262/language/module-code/instn-named-bndng-dflt-expr.js40
-rw-r--r--js/src/tests/test262/language/module-code/instn-named-bndng-dflt-fun-anon.js53
-rw-r--r--js/src/tests/test262/language/module-code/instn-named-bndng-dflt-fun-named.js53
-rw-r--r--js/src/tests/test262/language/module-code/instn-named-bndng-dflt-gen-anon.js56
-rw-r--r--js/src/tests/test262/language/module-code/instn-named-bndng-dflt-gen-named.js56
-rw-r--r--js/src/tests/test262/language/module-code/instn-named-bndng-dflt-named.js30
-rw-r--r--js/src/tests/test262/language/module-code/instn-named-bndng-dflt-star.js31
-rw-r--r--js/src/tests/test262/language/module-code/instn-named-bndng-fun.js60
-rw-r--r--js/src/tests/test262/language/module-code/instn-named-bndng-gen.js62
-rw-r--r--js/src/tests/test262/language/module-code/instn-named-bndng-let.js49
-rw-r--r--js/src/tests/test262/language/module-code/instn-named-bndng-trlng-comma.js57
-rw-r--r--js/src/tests/test262/language/module-code/instn-named-bndng-var.js55
-rw-r--r--js/src/tests/test262/language/module-code/instn-named-err-ambiguous-1_FIXTURE.js5
-rw-r--r--js/src/tests/test262/language/module-code/instn-named-err-ambiguous-2_FIXTURE.js5
-rw-r--r--js/src/tests/test262/language/module-code/instn-named-err-ambiguous-as.js45
-rw-r--r--js/src/tests/test262/language/module-code/instn-named-err-ambiguous.js45
-rw-r--r--js/src/tests/test262/language/module-code/instn-named-err-ambiguous_FIXTURE.js6
-rw-r--r--js/src/tests/test262/language/module-code/instn-named-err-dflt-thru-star-as.js33
-rw-r--r--js/src/tests/test262/language/module-code/instn-named-err-dflt-thru-star-dflt.js33
-rw-r--r--js/src/tests/test262/language/module-code/instn-named-err-dflt-thru-star-dflt_FIXTURE.js6
-rw-r--r--js/src/tests/test262/language/module-code/instn-named-err-dflt-thru-star-int_FIXTURE.js5
-rw-r--r--js/src/tests/test262/language/module-code/instn-named-err-not-found-as.js33
-rw-r--r--js/src/tests/test262/language/module-code/instn-named-err-not-found-dflt.js33
-rw-r--r--js/src/tests/test262/language/module-code/instn-named-err-not-found-empty_FIXTURE.js5
-rw-r--r--js/src/tests/test262/language/module-code/instn-named-err-not-found.js33
-rw-r--r--js/src/tests/test262/language/module-code/instn-named-id-name.js56
-rw-r--r--js/src/tests/test262/language/module-code/instn-named-iee-cycle-2_FIXTURE.js17
-rw-r--r--js/src/tests/test262/language/module-code/instn-named-iee-cycle.js63
-rw-r--r--js/src/tests/test262/language/module-code/instn-named-star-cycle-2_FIXTURE.js5
-rw-r--r--js/src/tests/test262/language/module-code/instn-named-star-cycle-indirect-x_FIXTURE.js9
-rw-r--r--js/src/tests/test262/language/module-code/instn-named-star-cycle.js53
-rw-r--r--js/src/tests/test262/language/module-code/instn-once.js41
-rw-r--r--js/src/tests/test262/language/module-code/instn-resolve-empty-export.js41
-rw-r--r--js/src/tests/test262/language/module-code/instn-resolve-empty-export_FIXTURE.js5
-rw-r--r--js/src/tests/test262/language/module-code/instn-resolve-empty-import.js47
-rw-r--r--js/src/tests/test262/language/module-code/instn-resolve-empty-import_FIXTURE.js5
-rw-r--r--js/src/tests/test262/language/module-code/instn-resolve-err-syntax-1.js22
-rw-r--r--js/src/tests/test262/language/module-code/instn-resolve-err-syntax-1_FIXTURE.js5
-rw-r--r--js/src/tests/test262/language/module-code/instn-resolve-err-syntax-2.js22
-rw-r--r--js/src/tests/test262/language/module-code/instn-resolve-err-syntax-2_FIXTURE.js5
-rw-r--r--js/src/tests/test262/language/module-code/instn-resolve-order-depth-child_FIXTURE.js5
-rw-r--r--js/src/tests/test262/language/module-code/instn-resolve-order-depth-reference_FIXTURE.js5
-rw-r--r--js/src/tests/test262/language/module-code/instn-resolve-order-depth-syntax_FIXTURE.js5
-rw-r--r--js/src/tests/test262/language/module-code/instn-resolve-order-depth.js16
-rw-r--r--js/src/tests/test262/language/module-code/instn-resolve-order-src-reference_FIXTURE.js5
-rw-r--r--js/src/tests/test262/language/module-code/instn-resolve-order-src-syntax_FIXTURE.js5
-rw-r--r--js/src/tests/test262/language/module-code/instn-resolve-order-src-valid_FIXTURE.js5
-rw-r--r--js/src/tests/test262/language/module-code/instn-resolve-order-src.js17
-rw-r--r--js/src/tests/test262/language/module-code/instn-same-global-set_FIXTURE.js5
-rw-r--r--js/src/tests/test262/language/module-code/instn-same-global.js22
-rw-r--r--js/src/tests/test262/language/module-code/instn-star-ambiguous-1_FIXTURE.js6
-rw-r--r--js/src/tests/test262/language/module-code/instn-star-ambiguous-2_FIXTURE.js6
-rw-r--r--js/src/tests/test262/language/module-code/instn-star-ambiguous.js38
-rw-r--r--js/src/tests/test262/language/module-code/instn-star-ambiguous_FIXTURE.js6
-rw-r--r--js/src/tests/test262/language/module-code/instn-star-as-props-dflt-skip.js61
-rw-r--r--js/src/tests/test262/language/module-code/instn-star-binding.js34
-rw-r--r--js/src/tests/test262/language/module-code/instn-star-equality-other_FIXTURE.js6
-rw-r--r--js/src/tests/test262/language/module-code/instn-star-equality.js46
-rw-r--r--js/src/tests/test262/language/module-code/instn-star-err-not-found-empty_FIXTURE.js5
-rw-r--r--js/src/tests/test262/language/module-code/instn-star-err-not-found-faulty_FIXTURE.js5
-rw-r--r--js/src/tests/test262/language/module-code/instn-star-err-not-found.js32
-rw-r--r--js/src/tests/test262/language/module-code/instn-star-id-name.js48
-rw-r--r--js/src/tests/test262/language/module-code/instn-star-iee-cycle-2_FIXTURE.js17
-rw-r--r--js/src/tests/test262/language/module-code/instn-star-iee-cycle.js58
-rw-r--r--js/src/tests/test262/language/module-code/instn-star-props-circular-a_FIXTURE.js6
-rw-r--r--js/src/tests/test262/language/module-code/instn-star-props-circular-b_FIXTURE.js6
-rw-r--r--js/src/tests/test262/language/module-code/instn-star-props-circular.js43
-rw-r--r--js/src/tests/test262/language/module-code/instn-star-props-dflt-keep-indirect-def_FIXTURE.js5
-rw-r--r--js/src/tests/test262/language/module-code/instn-star-props-dflt-keep-indirect-reexport_FIXTURE.js5
-rw-r--r--js/src/tests/test262/language/module-code/instn-star-props-dflt-keep-indirect.js38
-rw-r--r--js/src/tests/test262/language/module-code/instn-star-props-dflt-keep-local-named_FIXTURE.js6
-rw-r--r--js/src/tests/test262/language/module-code/instn-star-props-dflt-keep-local-prod_FIXTURE.js5
-rw-r--r--js/src/tests/test262/language/module-code/instn-star-props-dflt-keep-local.js43
-rw-r--r--js/src/tests/test262/language/module-code/instn-star-props-dflt-skip-named_FIXTURE.js7
-rw-r--r--js/src/tests/test262/language/module-code/instn-star-props-dflt-skip-prod_FIXTURE.js6
-rw-r--r--js/src/tests/test262/language/module-code/instn-star-props-dflt-skip-star-as-named-end_FIXTURE.js7
-rw-r--r--js/src/tests/test262/language/module-code/instn-star-props-dflt-skip-star-as-named_FIXTURE.js5
-rw-r--r--js/src/tests/test262/language/module-code/instn-star-props-dflt-skip-star-as-prod-end_FIXTURE.js6
-rw-r--r--js/src/tests/test262/language/module-code/instn-star-props-dflt-skip-star-as-prod_FIXTURE.js5
-rw-r--r--js/src/tests/test262/language/module-code/instn-star-props-dflt-skip-star-named_FIXTURE.js5
-rw-r--r--js/src/tests/test262/language/module-code/instn-star-props-dflt-skip-star-prod_FIXTURE.js5
-rw-r--r--js/src/tests/test262/language/module-code/instn-star-props-dflt-skip.js48
-rw-r--r--js/src/tests/test262/language/module-code/instn-star-props-nrml-1_FIXTURE.js27
-rw-r--r--js/src/tests/test262/language/module-code/instn-star-props-nrml-indirect_FIXTURE.js6
-rw-r--r--js/src/tests/test262/language/module-code/instn-star-props-nrml-star_FIXTURE.js24
-rw-r--r--js/src/tests/test262/language/module-code/instn-star-props-nrml.js74
-rw-r--r--js/src/tests/test262/language/module-code/instn-star-star-cycle-2_FIXTURE.js5
-rw-r--r--js/src/tests/test262/language/module-code/instn-star-star-cycle-indirect-x_FIXTURE.js9
-rw-r--r--js/src/tests/test262/language/module-code/instn-star-star-cycle.js50
-rw-r--r--js/src/tests/test262/language/module-code/instn-uniq-env-rec-other_FIXTURE.js17
-rw-r--r--js/src/tests/test262/language/module-code/instn-uniq-env-rec.js74
-rw-r--r--js/src/tests/test262/language/module-code/invalid-private-names-call-expression-bad-reference.js41
-rw-r--r--js/src/tests/test262/language/module-code/invalid-private-names-call-expression-this.js41
-rw-r--r--js/src/tests/test262/language/module-code/invalid-private-names-member-expression-bad-reference.js41
-rw-r--r--js/src/tests/test262/language/module-code/invalid-private-names-member-expression-this.js41
-rw-r--r--js/src/tests/test262/language/module-code/namespace/Symbol.iterator.js15
-rw-r--r--js/src/tests/test262/language/module-code/namespace/Symbol.toStringTag.js32
-rw-r--r--js/src/tests/test262/language/module-code/namespace/browser.js0
-rw-r--r--js/src/tests/test262/language/module-code/namespace/internals/browser.js0
-rw-r--r--js/src/tests/test262/language/module-code/namespace/internals/define-own-property.js140
-rw-r--r--js/src/tests/test262/language/module-code/namespace/internals/delete-exported-init.js49
-rw-r--r--js/src/tests/test262/language/module-code/namespace/internals/delete-exported-uninit.js69
-rw-r--r--js/src/tests/test262/language/module-code/namespace/internals/delete-non-exported.js39
-rw-r--r--js/src/tests/test262/language/module-code/namespace/internals/enumerate-binding-uninit.js45
-rw-r--r--js/src/tests/test262/language/module-code/namespace/internals/get-nested-namespace-dflt-skip-named-end_FIXTURE.js7
-rw-r--r--js/src/tests/test262/language/module-code/namespace/internals/get-nested-namespace-dflt-skip-named_FIXTURE.js5
-rw-r--r--js/src/tests/test262/language/module-code/namespace/internals/get-nested-namespace-dflt-skip-prod-end_FIXTURE.js6
-rw-r--r--js/src/tests/test262/language/module-code/namespace/internals/get-nested-namespace-dflt-skip-prod_FIXTURE.js5
-rw-r--r--js/src/tests/test262/language/module-code/namespace/internals/get-nested-namespace-dflt-skip.js46
-rw-r--r--js/src/tests/test262/language/module-code/namespace/internals/get-nested-namespace-props-nrml-1_FIXTURE.js5
-rw-r--r--js/src/tests/test262/language/module-code/namespace/internals/get-nested-namespace-props-nrml-2_FIXTURE.js24
-rw-r--r--js/src/tests/test262/language/module-code/namespace/internals/get-nested-namespace-props-nrml-3_FIXTURE.js6
-rw-r--r--js/src/tests/test262/language/module-code/namespace/internals/get-nested-namespace-props-nrml.js55
-rw-r--r--js/src/tests/test262/language/module-code/namespace/internals/get-own-property-str-found-init.js63
-rw-r--r--js/src/tests/test262/language/module-code/namespace/internals/get-own-property-str-found-uninit.js54
-rw-r--r--js/src/tests/test262/language/module-code/namespace/internals/get-own-property-str-not-found.js69
-rw-r--r--js/src/tests/test262/language/module-code/namespace/internals/get-own-property-sym.js29
-rw-r--r--js/src/tests/test262/language/module-code/namespace/internals/get-prototype-of.js15
-rw-r--r--js/src/tests/test262/language/module-code/namespace/internals/get-str-found-init.js28
-rw-r--r--js/src/tests/test262/language/module-code/namespace/internals/get-str-found-uninit.js38
-rw-r--r--js/src/tests/test262/language/module-code/namespace/internals/get-str-initialize.js28
-rw-r--r--js/src/tests/test262/language/module-code/namespace/internals/get-str-not-found.js26
-rw-r--r--js/src/tests/test262/language/module-code/namespace/internals/get-str-update.js27
-rw-r--r--js/src/tests/test262/language/module-code/namespace/internals/get-sym-found.js21
-rw-r--r--js/src/tests/test262/language/module-code/namespace/internals/get-sym-not-found.js21
-rw-r--r--js/src/tests/test262/language/module-code/namespace/internals/has-property-str-found-init.js36
-rw-r--r--js/src/tests/test262/language/module-code/namespace/internals/has-property-str-found-uninit.js38
-rw-r--r--js/src/tests/test262/language/module-code/namespace/internals/has-property-str-not-found.js41
-rw-r--r--js/src/tests/test262/language/module-code/namespace/internals/has-property-sym-found.js20
-rw-r--r--js/src/tests/test262/language/module-code/namespace/internals/has-property-sym-not-found.js21
-rw-r--r--js/src/tests/test262/language/module-code/namespace/internals/is-extensible.js14
-rw-r--r--js/src/tests/test262/language/module-code/namespace/internals/object-hasOwnProperty-binding-uninit.js45
-rw-r--r--js/src/tests/test262/language/module-code/namespace/internals/object-keys-binding-uninit.js48
-rw-r--r--js/src/tests/test262/language/module-code/namespace/internals/object-propertyIsEnumerable-binding-uninit.js41
-rw-r--r--js/src/tests/test262/language/module-code/namespace/internals/own-property-keys-binding-types.js81
-rw-r--r--js/src/tests/test262/language/module-code/namespace/internals/own-property-keys-binding-types_FIXTURE.js7
-rw-r--r--js/src/tests/test262/language/module-code/namespace/internals/own-property-keys-sort.js83
-rw-r--r--js/src/tests/test262/language/module-code/namespace/internals/prevent-extensions.js18
-rw-r--r--js/src/tests/test262/language/module-code/namespace/internals/set-prototype-of-null.js17
-rw-r--r--js/src/tests/test262/language/module-code/namespace/internals/set-prototype-of.js19
-rw-r--r--js/src/tests/test262/language/module-code/namespace/internals/set.js59
-rw-r--r--js/src/tests/test262/language/module-code/namespace/internals/shell.js0
-rw-r--r--js/src/tests/test262/language/module-code/namespace/shell.js0
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-export-arrow-function.js15
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-export-block-stmt-list.js15
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-export-block-stmt.js15
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-export-class-decl-meth-static.js15
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-export-class-decl-meth.js15
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-export-class-decl-method-gen-static.js16
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-export-class-decl-method-gen.js16
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-export-class-expr-meth-gen-static.js16
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-export-class-expr-meth-gen.js16
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-export-class-expr-meth-static.js15
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-export-class-expr-meth.js15
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-export-do-while.js15
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-export-for-const.js16
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-export-for-in-const.js16
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-export-for-in-let.js16
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-export-for-in-lhs.js16
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-export-for-in-var.js16
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-export-for-let.js16
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-export-for-lhs.js16
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-export-for-of-const.js16
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-export-for-of-let.js16
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-export-for-of-lhs.js16
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-export-for-of-var.js16
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-export-for-var.js16
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-export-function-decl.js15
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-export-function-expr.js15
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-export-generator-decl.js16
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-export-generator-expr.js15
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-export-if-else.js15
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-export-if-if.js15
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-export-labeled.js15
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-export-object-gen-method.js16
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-export-object-getter.js15
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-export-object-method.js15
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-export-object-setter.js15
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-export-switch-case-dflt.js15
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-export-switch-case.js15
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-export-switch-dftl.js15
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-export-try-catch-finally.js17
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-export-try-catch.js17
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-export-try-finally.js17
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-export-try-try.js17
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-export-while.js15
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-import-arrow-function.js15
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-import-block-stmt-list.js15
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-import-block-stmt.js15
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-import-class-decl-meth-static.js15
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-import-class-decl-meth.js15
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-import-class-decl-method-gen-static.js16
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-import-class-decl-method-gen.js16
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-import-class-expr-meth-gen-static.js16
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-import-class-expr-meth-gen.js16
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-import-class-expr-meth-static.js15
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-import-class-expr-meth.js15
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-import-do-while.js15
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-import-for-const.js16
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-import-for-in-const.js16
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-import-for-in-let.js16
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-import-for-in-lhs.js16
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-import-for-in-var.js16
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-import-for-let.js16
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-import-for-lhs.js16
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-import-for-of-const.js16
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-import-for-of-let.js16
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-import-for-of-lhs.js16
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-import-for-of-var.js16
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-import-for-var.js16
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-import-function-decl.js15
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-import-function-expr.js15
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-import-generator-decl.js16
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-import-generator-expr.js15
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-import-if-else.js15
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-import-if-if.js15
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-import-labeled.js15
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-import-object-gen-method.js16
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-import-object-getter.js15
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-import-object-method.js15
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-import-object-setter.js15
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-import-switch-case-dflt.js15
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-import-switch-case.js15
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-import-switch-dftl.js15
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-import-try-catch-finally.js17
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-import-try-catch.js17
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-import-try-finally.js17
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-import-try-try.js17
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-decl-pos-import-while.js15
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-export-dflt-const.js16
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-export-dflt-expr.js27
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-export-dflt-let.js16
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-export-dflt-var.js16
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-hoist-lex-fun.js26
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-hoist-lex-gen.js28
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-invoke-anon-fun-decl.js27
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-invoke-anon-gen-decl.js29
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-return.js33
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-semi-dflt-expr.js28
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-semi-export-star.js28
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-semi-name-space-export.js29
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-semi-named-export-from.js28
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-semi-named-export.js28
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-syntax-1.js22
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-syntax-2.js22
-rw-r--r--js/src/tests/test262/language/module-code/parse-err-yield.js33
-rw-r--r--js/src/tests/test262/language/module-code/parse-export-empty.js42
-rw-r--r--js/src/tests/test262/language/module-code/private-identifiers-not-empty.js19
-rw-r--r--js/src/tests/test262/language/module-code/privatename-not-valid-earlyerr-module-1.js24
-rw-r--r--js/src/tests/test262/language/module-code/privatename-not-valid-earlyerr-module-2.js24
-rw-r--r--js/src/tests/test262/language/module-code/privatename-not-valid-earlyerr-module-3.js22
-rw-r--r--js/src/tests/test262/language/module-code/privatename-not-valid-earlyerr-module-4.js28
-rw-r--r--js/src/tests/test262/language/module-code/privatename-not-valid-earlyerr-module-5.js24
-rw-r--r--js/src/tests/test262/language/module-code/privatename-not-valid-earlyerr-module-6.js22
-rw-r--r--js/src/tests/test262/language/module-code/privatename-not-valid-earlyerr-module-7.js22
-rw-r--r--js/src/tests/test262/language/module-code/privatename-not-valid-earlyerr-module-8.js22
-rw-r--r--js/src/tests/test262/language/module-code/privatename-valid-no-earlyerr.js50
-rw-r--r--js/src/tests/test262/language/module-code/shell.js14
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/await-awaits-thenable-not-callable.js19
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/await-awaits-thenables-that-throw.js30
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/await-awaits-thenables.js21
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/await-dynamic-import-rejection.js54
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/await-dynamic-import-resolution.js55
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/await-expr-func-expression.js50
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/await-expr-new-expr-reject.js47
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/await-expr-new-expr.js44
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/await-expr-regexp.js57
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/await-expr-reject-throws.js92
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/await-expr-resolution.js59
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/await-void-expr.js29
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/browser.js0
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/dfs-invariant-async_FIXTURE.js5
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/dfs-invariant-direct-1_FIXTURE.js5
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/dfs-invariant-direct-2_FIXTURE.js5
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/dfs-invariant-indirect_FIXTURE.js5
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/dfs-invariant.js43
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/dynamic-import-rejection.js55
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/dynamic-import-resolution.js53
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/early-errors-await-not-simple-assignment-target.js18
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/if-await-expr.js33
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/module-async-import-async-resolution-ticks.js87
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/module-import-rejection-body.js77
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/module-import-rejection-body_FIXTURE.js10
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/module-import-rejection-tick.js77
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/module-import-rejection-tick_FIXTURE.js13
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/module-import-rejection.js77
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/module-import-rejection_FIXTURE.js12
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/module-import-resolution.js82
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/module-import-resolution_FIXTURE.js15
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/module-import-unwrapped.js96
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/module-import-unwrapped_FIXTURE.js10
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/module-self-import-async-resolution-ticks.js89
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/module-sync-import-async-resolution-ticks.js82
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/new-await-parens.js20
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/new-await-script-code.js15
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/new-await.js18
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/no-operand.js18
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/shell.js0
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/await-expr-dyn-import.js44
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-array-literal.js79
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-func-expression.js85
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-identifier.js80
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-literal-number.js79
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-literal-string.js79
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-nested.js75
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-new-expr.js76
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-null.js79
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-obj-literal.js79
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-regexp.js79
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-template-literal.js79
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-this.js79
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/browser.js0
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/catch-parameter.js47
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/early-does-not-propagate-to-fn-declaration-body.js39
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/early-does-not-propagate-to-fn-declaration-params.js41
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/early-does-not-propagate-to-fn-expr-body.js31
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/early-does-not-propagate-to-fn-expr-params.js31
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/early-no-escaped-await.js26
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-array-literal.js71
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-func-expression.js77
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-identifier.js72
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-literal-number.js71
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-literal-string.js71
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-nested.js67
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-new-expr.js68
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-null.js71
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-obj-literal.js71
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-regexp.js71
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-template-literal.js71
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-this.js71
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-array-literal.js67
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-func-expression.js73
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-identifier.js68
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-literal-number.js67
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-literal-string.js67
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-nested.js63
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-new-expr.js64
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-null.js67
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-obj-literal.js67
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-regexp.js67
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-template-literal.js67
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-this.js67
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-array-literal.js71
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-func-expression.js77
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-identifier.js72
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-literal-number.js71
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-literal-string.js71
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-nested.js67
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-new-expr.js68
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-null.js71
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-obj-literal.js71
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-regexp.js71
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-template-literal.js71
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-this.js71
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-array-literal.js64
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-func-expression.js70
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-identifier.js65
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-literal-number.js64
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-literal-string.js64
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-nested.js60
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-new-expr.js61
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-null.js64
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-obj-literal.js64
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-regexp.js64
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-template-literal.js64
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-this.js64
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-array-literal.js67
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-func-expression.js73
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-identifier.js68
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-literal-number.js67
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-literal-string.js67
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-nested.js63
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-new-expr.js64
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-null.js67
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-obj-literal.js67
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-regexp.js67
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-template-literal.js67
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-this.js67
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-array-literal.js70
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-func-expression.js76
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-identifier.js71
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-literal-number.js70
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-literal-string.js70
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-nested.js66
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-new-expr.js67
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-null.js70
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-obj-literal.js70
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-regexp.js70
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-template-literal.js70
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-this.js70
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-array-literal.js76
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-func-expression.js82
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-identifier.js77
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-literal-number.js76
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-literal-string.js76
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-nested.js72
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-new-expr.js73
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-null.js76
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-obj-literal.js76
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-regexp.js76
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-template-literal.js76
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-this.js76
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-array-literal.js78
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-func-expression.js84
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-identifier.js79
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-literal-number.js78
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-literal-string.js78
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-nested.js74
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-new-expr.js75
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-null.js78
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-obj-literal.js78
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-regexp.js78
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-template-literal.js78
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-this.js78
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-array-literal.js78
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-func-expression.js84
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-identifier.js79
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-literal-number.js78
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-literal-string.js78
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-nested.js74
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-new-expr.js75
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-null.js78
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-obj-literal.js78
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-regexp.js78
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-template-literal.js78
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-this.js78
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-array-literal.js53
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-func-expression.js59
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-identifier.js54
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-literal-number.js53
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-literal-string.js53
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-nested.js49
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-new-expr.js50
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-null.js53
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-obj-literal.js53
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-regexp.js53
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-template-literal.js53
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-this.js53
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-array-literal.js51
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-func-expression.js57
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-identifier.js52
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-literal-number.js51
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-literal-string.js51
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-nested.js47
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-new-expr.js48
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-null.js51
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-obj-literal.js51
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-regexp.js51
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-template-literal.js51
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-this.js51
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/shell.js0
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-array-literal.js45
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-func-expression.js51
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-identifier.js46
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-literal-number.js45
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-literal-string.js45
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-nested.js41
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-new-expr.js42
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-null.js45
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-obj-literal.js45
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-regexp.js45
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-template-literal.js45
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-this.js45
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-array-literal.js70
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-func-expression.js76
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-identifier.js71
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-literal-number.js70
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-literal-string.js70
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-nested.js66
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-new-expr.js67
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-null.js70
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-obj-literal.js70
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-regexp.js70
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-template-literal.js70
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-this.js70
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-array-literal.js46
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-func-expression.js52
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-identifier.js47
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-literal-number.js46
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-literal-string.js46
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-nested.js42
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-new-expr.js43
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-null.js46
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-obj-literal.js46
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-regexp.js46
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-template-literal.js46
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-this.js46
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-array-literal.js46
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-func-expression.js52
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-identifier.js47
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-literal-number.js46
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-literal-string.js46
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-nested.js42
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-new-expr.js43
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-null.js46
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-obj-literal.js46
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-regexp.js46
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-template-literal.js46
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-this.js46
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-array-literal.js50
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-func-expression.js56
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-identifier.js51
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-literal-number.js50
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-literal-string.js50
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-nested.js46
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-new-expr.js47
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-null.js50
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-obj-literal.js50
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-regexp.js50
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-template-literal.js50
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-this.js50
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/top-level-ticks-2.js47
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/top-level-ticks.js47
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/void-await-expr.js36
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/while-dynamic-evaluation.js49
-rw-r--r--js/src/tests/test262/language/module-code/verify-dfs-a_FIXTURE.js9
-rw-r--r--js/src/tests/test262/language/module-code/verify-dfs-b_FIXTURE.js7
-rw-r--r--js/src/tests/test262/language/module-code/verify-dfs.js35
695 files changed, 25722 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/module-code/browser.js b/js/src/tests/test262/language/module-code/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/browser.js
diff --git a/js/src/tests/test262/language/module-code/comment-multi-line-html-close.js b/js/src/tests/test262/language/module-code/comment-multi-line-html-close.js
new file mode 100644
index 0000000000..9fb6b9ba8a
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/comment-multi-line-html-close.js
@@ -0,0 +1,18 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ HTML-like comments are not available in module code
+ (MultiLineHTMLCloseComment)
+esid: sec-html-like-comments
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+/*
+*/-->
diff --git a/js/src/tests/test262/language/module-code/comment-single-line-html-close.js b/js/src/tests/test262/language/module-code/comment-single-line-html-close.js
new file mode 100644
index 0000000000..00881df8e7
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/comment-single-line-html-close.js
@@ -0,0 +1,17 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ HTML-like comments are not available in module code
+ (SingleLineHTMLCloseComment)
+esid: sec-html-like-comments
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+-->
diff --git a/js/src/tests/test262/language/module-code/comment-single-line-html-open.js b/js/src/tests/test262/language/module-code/comment-single-line-html-open.js
new file mode 100644
index 0000000000..3e8580eadc
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/comment-single-line-html-open.js
@@ -0,0 +1,17 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ HTML-like comments are not available in module code
+ (SingleLineHTMLOpenComment)
+esid: sec-html-like-comments
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+<!--
diff --git a/js/src/tests/test262/language/module-code/early-dup-assert-key-export.js b/js/src/tests/test262/language/module-code/early-dup-assert-key-export.js
new file mode 100644
index 0000000000..a2be110bf0
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/early-dup-assert-key-export.js
@@ -0,0 +1,25 @@
+// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) error:SyntaxError module -- requires shell-options
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: AssertClause may not have duplicate keys (export declaration)
+esid: sec-modules
+info: |
+ AssertClause:assert{AssertEntries,opt}
+
+ - It is a Syntax Error if AssertClauseToAssertions of AssertClause has two
+ entries a and b such that a.[[Key]] is b.[[Key]].
+features: [import-assertions]
+flags: [module]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+export * from './import-assertion-3_FIXTURE.js' assert {
+ test262_a: '',
+ test262_b: '',
+ 'test262_\u0061': ''
+};
diff --git a/js/src/tests/test262/language/module-code/early-dup-assert-key-import-nobinding.js b/js/src/tests/test262/language/module-code/early-dup-assert-key-import-nobinding.js
new file mode 100644
index 0000000000..f1df4b5ea7
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/early-dup-assert-key-import-nobinding.js
@@ -0,0 +1,26 @@
+// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) error:SyntaxError module -- requires shell-options
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ AssertClause may not have duplicate keys (import declaration without binding)
+esid: sec-modules
+info: |
+ AssertClause:assert{AssertEntries,opt}
+
+ - It is a Syntax Error if AssertClauseToAssertions of AssertClause has two
+ entries a and b such that a.[[Key]] is b.[[Key]].
+features: [import-assertions]
+flags: [module]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+import './import-assertion-2_FIXTURE.js' assert {
+ test262_a: '',
+ test262_b: '',
+ 'test262_\u0061': ''
+};
diff --git a/js/src/tests/test262/language/module-code/early-dup-assert-key-import-withbinding.js b/js/src/tests/test262/language/module-code/early-dup-assert-key-import-withbinding.js
new file mode 100644
index 0000000000..fa659c9bda
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/early-dup-assert-key-import-withbinding.js
@@ -0,0 +1,26 @@
+// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) error:SyntaxError module -- requires shell-options
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ AssertClause may not have duplicate keys (import declaration with binding)
+esid: sec-modules
+info: |
+ AssertClause:assert{AssertEntries,opt}
+
+ - It is a Syntax Error if AssertClauseToAssertions of AssertClause has two
+ entries a and b such that a.[[Key]] is b.[[Key]].
+features: [import-assertions]
+flags: [module]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+import x from './import-assertion-1_FIXTURE.js' assert {
+ test262_a: '',
+ test262_b: '',
+ 'test262_\u0061': ''
+};
diff --git a/js/src/tests/test262/language/module-code/early-dup-export-as-star-as.js b/js/src/tests/test262/language/module-code/early-dup-export-as-star-as.js
new file mode 100644
index 0000000000..ad351b5124
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/early-dup-export-as-star-as.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2018 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-module-semantics-static-semantics-early-errors
+description: >
+ It is a Syntax Error if the ExportedNames of ModuleItemList contains any
+ duplicate entries.
+flags: [module]
+features: [export-star-as-namespace-from-module]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+var x;
+export { x as z };
+export * as z from './early-dup-export-as-star-as.js';
diff --git a/js/src/tests/test262/language/module-code/early-dup-export-decl.js b/js/src/tests/test262/language/module-code/early-dup-export-decl.js
new file mode 100644
index 0000000000..f761d415f9
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/early-dup-export-decl.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 15.2.1.1
+description: >
+ It is a Syntax Error if the ExportedNames of ModuleItemList contains any
+ duplicate entries.
+flags: [module]
+negative:
+ phase: parse
+ type: SyntaxError
+features: [generators]
+---*/
+
+$DONOTEVALUATE();
+
+export function f() {}
+export function *f() {}
diff --git a/js/src/tests/test262/language/module-code/early-dup-export-dflt-id.js b/js/src/tests/test262/language/module-code/early-dup-export-dflt-id.js
new file mode 100644
index 0000000000..4ebb6baa0d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/early-dup-export-dflt-id.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-module-semantics-static-semantics-early-errors
+es6id: 15.2.1.1
+description: >
+ It is a Syntax Error if the ExportedNames of ModuleItemList contains any
+ duplicate entries.
+flags: [module]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+var x, y;
+export default x;
+export { y as default };
diff --git a/js/src/tests/test262/language/module-code/early-dup-export-dflt.js b/js/src/tests/test262/language/module-code/early-dup-export-dflt.js
new file mode 100644
index 0000000000..610b4e84f6
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/early-dup-export-dflt.js
@@ -0,0 +1,18 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 15.2.1.1
+description: >
+ It is a Syntax Error if the ExportedNames of ModuleItemList contains any
+ duplicate entries.
+flags: [module]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+export default var x = null;
+export default var x = null;
diff --git a/js/src/tests/test262/language/module-code/early-dup-export-id-as.js b/js/src/tests/test262/language/module-code/early-dup-export-id-as.js
new file mode 100644
index 0000000000..f8ab423a4d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/early-dup-export-id-as.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-module-semantics-static-semantics-early-errors
+es6id: 15.2.1.1
+description: >
+ It is a Syntax Error if the ExportedNames of ModuleItemList contains any
+ duplicate entries.
+flags: [module]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+var x, y;
+export { x as z };
+export { y as z };
diff --git a/js/src/tests/test262/language/module-code/early-dup-export-id.js b/js/src/tests/test262/language/module-code/early-dup-export-id.js
new file mode 100644
index 0000000000..9eb8891bfb
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/early-dup-export-id.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 15.2.1.1
+description: >
+ It is a Syntax Error if the ExportedNames of ModuleItemList contains any
+ duplicate entries.
+flags: [module]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+var x;
+export { x };
+export { x };
diff --git a/js/src/tests/test262/language/module-code/early-dup-export-star-as-dflt.js b/js/src/tests/test262/language/module-code/early-dup-export-star-as-dflt.js
new file mode 100644
index 0000000000..7c14643161
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/early-dup-export-star-as-dflt.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2018 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-module-semantics-static-semantics-early-errors
+description: >
+ It is a Syntax Error if the ExportedNames of ModuleItemList contains any
+ duplicate entries.
+flags: [module]
+features: [export-star-as-namespace-from-module]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+var x;
+export default x;
+export * as default from './early-dup-export-start-as-dflt.js';
diff --git a/js/src/tests/test262/language/module-code/early-dup-lables.js b/js/src/tests/test262/language/module-code/early-dup-lables.js
new file mode 100644
index 0000000000..548d27cab8
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/early-dup-lables.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 15.2.1.1
+description: >
+ It is a Syntax Error if ContainsDuplicateLabels of ModuleItemList with
+ argument « » is true.
+flags: [module]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+label: {
+ label: 0;
+}
diff --git a/js/src/tests/test262/language/module-code/early-dup-lex.js b/js/src/tests/test262/language/module-code/early-dup-lex.js
new file mode 100644
index 0000000000..055ef63fee
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/early-dup-lex.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-module-semantics-static-semantics-early-errors
+description: >
+ It is a Syntax Error if the LexicallyDeclaredNames of ModuleItemList
+ contains any duplicate entries.
+flags: [module]
+features: [let, const]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+let x;
+const x = 0;
diff --git a/js/src/tests/test262/language/module-code/early-dup-top-function-async-generator.js b/js/src/tests/test262/language/module-code/early-dup-top-function-async-generator.js
new file mode 100644
index 0000000000..9a9b0b5032
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/early-dup-top-function-async-generator.js
@@ -0,0 +1,21 @@
+// |reftest| error:SyntaxError module
+// Copyright 2021 Chengzhong Wu. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-module-semantics-static-semantics-early-errors
+description: >
+ It is a Syntax Error if the LexicallyDeclaredNames of ModuleItemList
+ contains any duplicate entries.
+ At the top level of a Module, function declarations are treated like
+ lexical declarations rather than like var declarations.
+flags: [module]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function x() {}
+async function* x() {}
diff --git a/js/src/tests/test262/language/module-code/early-dup-top-function-async.js b/js/src/tests/test262/language/module-code/early-dup-top-function-async.js
new file mode 100644
index 0000000000..dec4dbe904
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/early-dup-top-function-async.js
@@ -0,0 +1,21 @@
+// |reftest| error:SyntaxError module
+// Copyright 2021 Chengzhong Wu. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-module-semantics-static-semantics-early-errors
+description: >
+ It is a Syntax Error if the LexicallyDeclaredNames of ModuleItemList
+ contains any duplicate entries.
+ At the top level of a Module, function declarations are treated like
+ lexical declarations rather than like var declarations.
+flags: [module]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function x() {}
+async function x() {}
diff --git a/js/src/tests/test262/language/module-code/early-dup-top-function-generator.js b/js/src/tests/test262/language/module-code/early-dup-top-function-generator.js
new file mode 100644
index 0000000000..9e6c9743df
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/early-dup-top-function-generator.js
@@ -0,0 +1,21 @@
+// |reftest| error:SyntaxError module
+// Copyright 2021 Chengzhong Wu. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-module-semantics-static-semantics-early-errors
+description: >
+ It is a Syntax Error if the LexicallyDeclaredNames of ModuleItemList
+ contains any duplicate entries.
+ At the top level of a Module, function declarations are treated like
+ lexical declarations rather than like var declarations.
+flags: [module]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function x() {}
+function* x() {}
diff --git a/js/src/tests/test262/language/module-code/early-dup-top-function.js b/js/src/tests/test262/language/module-code/early-dup-top-function.js
new file mode 100644
index 0000000000..6b358065cc
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/early-dup-top-function.js
@@ -0,0 +1,21 @@
+// |reftest| error:SyntaxError module
+// Copyright 2021 Chengzhong Wu. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-module-semantics-static-semantics-early-errors
+description: >
+ It is a Syntax Error if the LexicallyDeclaredNames of ModuleItemList
+ contains any duplicate entries.
+ At the top level of a Module, function declarations are treated like
+ lexical declarations rather than like var declarations.
+flags: [module]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function x() {}
+function x() {}
diff --git a/js/src/tests/test262/language/module-code/early-export-global.js b/js/src/tests/test262/language/module-code/early-export-global.js
new file mode 100644
index 0000000000..b3490f8edd
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/early-export-global.js
@@ -0,0 +1,20 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-module-semantics-static-semantics-early-errors
+es6id: 15.2.1.1
+description: Exporting a global binding
+info: |
+ It is a Syntax Error if any element of the ExportedBindings of
+ ModuleItemList does not also occur in either the VarDeclaredNames of
+ ModuleItemList, or the LexicallyDeclaredNames of ModuleItemList.
+flags: [module]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+export { Number };
diff --git a/js/src/tests/test262/language/module-code/early-export-ill-formed-string.js b/js/src/tests/test262/language/module-code/early-export-ill-formed-string.js
new file mode 100644
index 0000000000..22a8248f11
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/early-export-ill-formed-string.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2020 Bradley Farias. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Ill formed unicode cannot be an exported name
+esid: sec-module-semantics
+info: |
+ ModuleExportName : StringLiteral
+
+ It is a Syntax Error if IsStringWellFormedUnicode of the StringValue of StringLiteral is *false*.
+flags: [module]
+negative:
+ phase: parse
+ type: SyntaxError
+features: [arbitrary-module-namespace-names]
+---*/
+
+$DONOTEVALUATE();
+
+// 🌙 is '\uD83C\uDF19'
+export {Moon as "\uD83C",} from "./early-export-ill-formed-string.js";
+export {"\uD83C"} from "./early-export-ill-formed-string.js";
+import {'\uD83C' as Usagi} from "./early-export-ill-formed-string.js";
+
+function Moon() {}
diff --git a/js/src/tests/test262/language/module-code/early-export-unresolvable.js b/js/src/tests/test262/language/module-code/early-export-unresolvable.js
new file mode 100644
index 0000000000..2bb5ad5209
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/early-export-unresolvable.js
@@ -0,0 +1,18 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 15.2.1.1
+description: >
+ It is a Syntax Error if any element of the ExportedBindings of
+ ModuleItemList does not also occur in either the VarDeclaredNames of
+ ModuleItemList, or the LexicallyDeclaredNames of ModuleItemList.
+flags: [module]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+export { unresolvable };
diff --git a/js/src/tests/test262/language/module-code/early-import-arguments.js b/js/src/tests/test262/language/module-code/early-import-arguments.js
new file mode 100644
index 0000000000..7e9aee7412
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/early-import-arguments.js
@@ -0,0 +1,36 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: ImportedBinding is a BindingIdentifier and cannot be "arguments"
+esid: sec-imports
+info: |
+ ImportSpecifier :
+ ImportedBinding
+ IdentifierName as ImportedBinding
+
+ ImportedBinding :
+ BindingIdentifier
+
+ 12.1.1 Static Semantics : Early Errors
+
+ BindingIdentifier : Identifier
+
+ - It is a Syntax Error if the code matched by this production is contained
+ in strict mode code and the StringValue of Identifier is "arguments" or
+ "eval".
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+// Create an appropriately-named ExportEntry in order to avoid false positives
+// (e.g. cases where the implementation does not generate the expected early
+// error but does produce a SyntaxError for unresolvable bindings).
+var x;
+export { x as arguments };
+
+import { arguments } from './early-import-arguments.js';
diff --git a/js/src/tests/test262/language/module-code/early-import-as-arguments.js b/js/src/tests/test262/language/module-code/early-import-as-arguments.js
new file mode 100644
index 0000000000..25ccbe2e1f
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/early-import-as-arguments.js
@@ -0,0 +1,36 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: ImportedBinding is a BindingIdentifier and cannot be "arguments"
+esid: sec-imports
+info: |
+ ImportSpecifier :
+ ImportedBinding
+ IdentifierName as ImportedBinding
+
+ ImportedBinding :
+ BindingIdentifier
+
+ 12.1.1 Static Semantics : Early Errors
+
+ BindingIdentifier : Identifier
+
+ - It is a Syntax Error if the code matched by this production is contained
+ in strict mode code and the StringValue of Identifier is "arguments" or
+ "eval".
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+// Create an appropriately-named ExportEntry in order to avoid false positives
+// (e.g. cases where the implementation does not generate the expected early
+// error but does produce a SyntaxError for unresolvable bindings).
+var x;
+export { x };
+
+import { x as arguments } from './early-import-as-arguments.js';
diff --git a/js/src/tests/test262/language/module-code/early-import-as-eval.js b/js/src/tests/test262/language/module-code/early-import-as-eval.js
new file mode 100644
index 0000000000..26344f6900
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/early-import-as-eval.js
@@ -0,0 +1,36 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: ImportedBinding is a BindingIdentifier and cannot be "eval"
+esid: sec-imports
+info: |
+ ImportSpecifier :
+ ImportedBinding
+ IdentifierName as ImportedBinding
+
+ ImportedBinding :
+ BindingIdentifier
+
+ 12.1.1 Static Semantics : Early Errors
+
+ BindingIdentifier : Identifier
+
+ - It is a Syntax Error if the code matched by this production is contained
+ in strict mode code and the StringValue of Identifier is "arguments" or
+ "eval".
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+// Create an appropriately-named ExportEntry in order to avoid false positives
+// (e.g. cases where the implementation does not generate the expected early
+// error but does produce a SyntaxError for unresolvable bindings).
+var x;
+export { x };
+
+import { x as eval } from './early-import-as-eval.js';
diff --git a/js/src/tests/test262/language/module-code/early-import-eval.js b/js/src/tests/test262/language/module-code/early-import-eval.js
new file mode 100644
index 0000000000..e50095b840
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/early-import-eval.js
@@ -0,0 +1,36 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: ImportedBinding is a BindingIdentifier and cannot be "eval"
+esid: sec-imports
+info: |
+ ImportSpecifier :
+ ImportedBinding
+ IdentifierName as ImportedBinding
+
+ ImportedBinding :
+ BindingIdentifier
+
+ 12.1.1 Static Semantics : Early Errors
+
+ BindingIdentifier : Identifier
+
+ - It is a Syntax Error if the code matched by this production is contained
+ in strict mode code and the StringValue of Identifier is "arguments" or
+ "eval".
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+// Create an appropriately-named ExportEntry in order to avoid false positives
+// (e.g. cases where the implementation does not generate the expected early
+// error but does produce a SyntaxError for unresolvable bindings).
+var x;
+export { x as eval };
+
+import { eval } from './early-import-eval.js';
diff --git a/js/src/tests/test262/language/module-code/early-lex-and-var.js b/js/src/tests/test262/language/module-code/early-lex-and-var.js
new file mode 100644
index 0000000000..063d2757d2
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/early-lex-and-var.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 10.2.1
+description: >
+ It is a Syntax Error if any element of the LexicallyDeclaredNames of
+ ModuleItemList also occurs in the VarDeclaredNames of ModuleItemList.
+flags: [module]
+features: [let]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+let x;
+var x;
diff --git a/js/src/tests/test262/language/module-code/early-new-target.js b/js/src/tests/test262/language/module-code/early-new-target.js
new file mode 100644
index 0000000000..cdd3ea5542
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/early-new-target.js
@@ -0,0 +1,17 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 15.2.1.1
+description: >
+ It is a Syntax Error if ModuleItemList Contains NewTarget
+flags: [module]
+negative:
+ phase: parse
+ type: SyntaxError
+features: [new.target]
+---*/
+
+$DONOTEVALUATE();
+
+new.target;
diff --git a/js/src/tests/test262/language/module-code/early-strict-mode.js b/js/src/tests/test262/language/module-code/early-strict-mode.js
new file mode 100644
index 0000000000..a76e8555b6
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/early-strict-mode.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Module code is always strict mode code.
+es6id: 10.2.1
+esid: sec-strict-mode-code
+flags: [module]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+var public;
diff --git a/js/src/tests/test262/language/module-code/early-super.js b/js/src/tests/test262/language/module-code/early-super.js
new file mode 100644
index 0000000000..5bcd495f44
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/early-super.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 15.2.1.1
+description: >
+ It is a Syntax Error if ModuleItemList Contains super.
+flags: [module]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+super;
diff --git a/js/src/tests/test262/language/module-code/early-undef-break.js b/js/src/tests/test262/language/module-code/early-undef-break.js
new file mode 100644
index 0000000000..11ac54b1b7
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/early-undef-break.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 15.2.1.1
+description: >
+ It is a Syntax Error if ContainsUndefinedBreakTarget of ModuleItemList with
+ argument « » is true.
+flags: [module]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+while (false) {
+ break undef;
+}
diff --git a/js/src/tests/test262/language/module-code/early-undef-continue.js b/js/src/tests/test262/language/module-code/early-undef-continue.js
new file mode 100644
index 0000000000..7ab5d376f0
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/early-undef-continue.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2015 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 15.2.1.1
+description: >
+ It is a Syntax Error if ContainsUndefinedContinueTarget of ModuleItemList
+ with arguments « » and « » is true.
+flags: [module]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+while (false) {
+ continue undef;
+}
diff --git a/js/src/tests/test262/language/module-code/eval-export-cls-semi.js b/js/src/tests/test262/language/module-code/eval-export-cls-semi.js
new file mode 100644
index 0000000000..37c2886b1f
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-export-cls-semi.js
@@ -0,0 +1,18 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ An exported class declaration does not need to be terminated with a
+ semicolon or newline
+esid: sec-moduleevaluation
+flags: [module]
+---*/
+
+var count = 0;
+
+export class C {} if (true) { count += 1; }
+
+assert.sameValue(count, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/eval-export-dflt-cls-anon-semi.js b/js/src/tests/test262/language/module-code/eval-export-dflt-cls-anon-semi.js
new file mode 100644
index 0000000000..7aecfe6f89
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-export-dflt-cls-anon-semi.js
@@ -0,0 +1,18 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ An exported default "anonymous" class declaration does not need to be
+ terminated with a semicolon or newline
+esid: sec-moduleevaluation
+flags: [module]
+---*/
+
+var count = 0;
+
+export default class {} if (true) { count += 1; }
+
+assert.sameValue(count, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/eval-export-dflt-cls-anon.js b/js/src/tests/test262/language/module-code/eval-export-dflt-cls-anon.js
new file mode 100644
index 0000000000..946a6f0378
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-export-dflt-cls-anon.js
@@ -0,0 +1,36 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Default "anonymous" class declaration is correctly initialized upon
+ evaluation
+esid: sec-moduleevaluation
+info: |
+ [...]
+ 16. Let result be the result of evaluating module.[[ECMAScriptCode]].
+ [...]
+
+ 15.2.3.11 Runtime Semantics: Evaluation
+
+ ExportDeclaration : export default ClassDeclaration
+
+ [...]
+ 3. Let className be the sole element of BoundNames of ClassDeclaration.
+ 4. If className is "*default*", then
+ a. Let hasNameProperty be ? HasOwnProperty(value, "name").
+ b. If hasNameProperty is false, perform SetFunctionName(value,
+ "default").
+ c. Let env be the running execution context's LexicalEnvironment.
+ d. Perform ? InitializeBoundName("*default*", value, env).
+ 5. Return NormalCompletion(empty).
+flags: [module]
+---*/
+
+export default class { valueOf() { return 45; } }
+import C from './eval-export-dflt-cls-anon.js';
+
+assert.sameValue(new C().valueOf(), 45, 'binding initialized');
+assert.sameValue(C.name, 'default', 'correct name is assigned');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/eval-export-dflt-cls-name-meth.js b/js/src/tests/test262/language/module-code/eval-export-dflt-cls-name-meth.js
new file mode 100644
index 0000000000..1242fa4ab4
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-export-dflt-cls-name-meth.js
@@ -0,0 +1,37 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Default "anonymous" class declaration containing a static `name` method is
+ correctly initialized upon evaluation
+esid: sec-moduleevaluation
+info: |
+ [...]
+ 16. Let result be the result of evaluating module.[[ECMAScriptCode]].
+ [...]
+
+ 15.2.3.11 Runtime Semantics: Evaluation
+
+ ExportDeclaration : export default ClassDeclaration
+
+ [...]
+ 3. Let className be the sole element of BoundNames of ClassDeclaration.
+ 4. If className is "*default*", then
+ a. Let hasNameProperty be ? HasOwnProperty(value, "name").
+ b. If hasNameProperty is false, perform SetFunctionName(value,
+ "default").
+ c. Let env be the running execution context's LexicalEnvironment.
+ d. Perform ? InitializeBoundName("*default*", value, env).
+ 5. Return NormalCompletion(empty).
+flags: [module]
+---*/
+
+export default class { static name() { return 'name method'; } }
+import C from './eval-export-dflt-cls-name-meth.js';
+
+assert.sameValue(
+ C.name(), 'name method', '`name` property is not over-written'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/eval-export-dflt-cls-named-semi.js b/js/src/tests/test262/language/module-code/eval-export-dflt-cls-named-semi.js
new file mode 100644
index 0000000000..a7d3a03409
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-export-dflt-cls-named-semi.js
@@ -0,0 +1,18 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ An exported default "named" class declaration does not need to be
+ terminated with a semicolon or newline
+esid: sec-moduleevaluation
+flags: [module]
+---*/
+
+var count = 0;
+
+export default class C {} if (true) { count += 1; }
+
+assert.sameValue(count, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/eval-export-dflt-cls-named.js b/js/src/tests/test262/language/module-code/eval-export-dflt-cls-named.js
new file mode 100644
index 0000000000..f3f30ec72d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-export-dflt-cls-named.js
@@ -0,0 +1,36 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Default "named" class declaration is correctly initialized upon
+ evaluation
+esid: sec-moduleevaluation
+info: |
+ [...]
+ 16. Let result be the result of evaluating module.[[ECMAScriptCode]].
+ [...]
+
+ 15.2.3.11 Runtime Semantics: Evaluation
+
+ ExportDeclaration : export default ClassDeclaration
+
+ [...]
+ 3. Let className be the sole element of BoundNames of ClassDeclaration.
+ 4. If className is "*default*", then
+ a. Let hasNameProperty be ? HasOwnProperty(value, "name").
+ b. If hasNameProperty is false, perform SetFunctionName(value,
+ "default").
+ c. Let env be the running execution context's LexicalEnvironment.
+ d. Perform ? InitializeBoundName("*default*", value, env).
+ 5. Return NormalCompletion(empty).
+flags: [module]
+---*/
+
+export default class cName { valueOf() { return 45; } }
+import C from './eval-export-dflt-cls-named.js';
+
+assert.sameValue(new C().valueOf(), 45, 'binding initialized');
+assert.sameValue(C.name, 'cName', 'correct name is assigned');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/eval-export-dflt-expr-cls-anon.js b/js/src/tests/test262/language/module-code/eval-export-dflt-expr-cls-anon.js
new file mode 100644
index 0000000000..2e953b3e41
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-export-dflt-expr-cls-anon.js
@@ -0,0 +1,35 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Default AssignmentExpression (which can be recognized as an "anonymous"
+ class declaration) is correctly initialized upon evaluation
+esid: sec-moduleevaluation
+info: |
+ [...]
+ 16. Let result be the result of evaluating module.[[ECMAScriptCode]].
+ [...]
+
+ 15.2.3.11 Runtime Semantics: Evaluation
+
+ ExportDeclaration : export default AssignmentExpression;
+
+ [...]
+ 3. If IsAnonymousFunctionDefinition(AssignmentExpression) is true, then
+ a. Let hasNameProperty be ? HasOwnProperty(value, "name").
+ b. If hasNameProperty is false, perform SetFunctionName(value,
+ "default").
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Perform ? InitializeBoundName("*default*", value, env).
+ [...]
+flags: [module]
+---*/
+
+export default (class { valueOf() { return 45; } });
+import C from './eval-export-dflt-expr-cls-anon.js';
+
+assert.sameValue(new C().valueOf(), 45, 'binding initialized');
+assert.sameValue(C.name, 'default', 'correct name is assigned');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/eval-export-dflt-expr-cls-name-meth.js b/js/src/tests/test262/language/module-code/eval-export-dflt-expr-cls-name-meth.js
new file mode 100644
index 0000000000..8af5e458c9
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-export-dflt-expr-cls-name-meth.js
@@ -0,0 +1,38 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Default AssignmentExpression (which can be recognized as an "anonymous"
+ class declaration with a static `name` method) is correctly initialized
+ upon evaluation
+esid: sec-moduleevaluation
+info: |
+ [...]
+ 16. Let result be the result of evaluating module.[[ECMAScriptCode]].
+ [...]
+
+ 15.2.3.11 Runtime Semantics: Evaluation
+
+ ExportDeclaration : export default ClassDeclaration
+
+ [...]
+ 3. Let className be the sole element of BoundNames of ClassDeclaration.
+ 4. If className is "*default*", then
+ a. Let hasNameProperty be ? HasOwnProperty(value, "name").
+ b. If hasNameProperty is false, perform SetFunctionName(value,
+ "default").
+ c. Let env be the running execution context's LexicalEnvironment.
+ d. Perform ? InitializeBoundName("*default*", value, env).
+ 5. Return NormalCompletion(empty).
+flags: [module]
+---*/
+
+export default (class { static name() { return 'name method'; } });
+import C from './eval-export-dflt-expr-cls-name-meth.js';
+
+assert.sameValue(
+ C.name(), 'name method', '`name` property is not over-written'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/eval-export-dflt-expr-cls-named.js b/js/src/tests/test262/language/module-code/eval-export-dflt-expr-cls-named.js
new file mode 100644
index 0000000000..581c916ecb
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-export-dflt-expr-cls-named.js
@@ -0,0 +1,35 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Default AssignmentExpression (which can be recognized as a "named" class
+ declaration) is correctly initialized upon evaluation
+esid: sec-moduleevaluation
+info: |
+ [...]
+ 16. Let result be the result of evaluating module.[[ECMAScriptCode]].
+ [...]
+
+ 15.2.3.11 Runtime Semantics: Evaluation
+
+ ExportDeclaration : export default AssignmentExpression;
+
+ [...]
+ 3. If IsAnonymousFunctionDefinition(AssignmentExpression) is true, then
+ a. Let hasNameProperty be ? HasOwnProperty(value, "name").
+ b. If hasNameProperty is false, perform SetFunctionName(value,
+ "default").
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Perform ? InitializeBoundName("*default*", value, env).
+ [...]
+flags: [module]
+---*/
+
+export default (class cName { valueOf() { return 45; } });
+import C from './eval-export-dflt-expr-cls-named.js';
+
+assert.sameValue(new C().valueOf(), 45, 'binding initialized');
+assert.sameValue(C.name, 'cName', 'correct name is assigned');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/eval-export-dflt-expr-err-eval.js b/js/src/tests/test262/language/module-code/eval-export-dflt-expr-err-eval.js
new file mode 100644
index 0000000000..1755f063f8
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-export-dflt-expr-err-eval.js
@@ -0,0 +1,34 @@
+// |reftest| error:Test262Error module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Abrupt completions resulting from evaluation on AssignmentExpression are
+ forwarded to the runtime.
+esid: sec-moduleevaluation
+info: |
+ [...]
+ 16. Let result be the result of evaluating module.[[ECMAScriptCode]].
+ [...]
+
+ 15.2.3.11 Runtime Semantics: Evaluation
+
+ ExportDeclaration : export default AssignmentExpression;
+
+ [...]
+ 1. Let rhs be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(rhs).
+
+ 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) is true, throw a ReferenceError exception.
+negative:
+ phase: runtime
+ type: Test262Error
+flags: [module]
+---*/
+
+export default (function() { throw new Test262Error(); })();
diff --git a/js/src/tests/test262/language/module-code/eval-export-dflt-expr-err-get-value.js b/js/src/tests/test262/language/module-code/eval-export-dflt-expr-err-get-value.js
new file mode 100644
index 0000000000..2b79516522
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-export-dflt-expr-err-get-value.js
@@ -0,0 +1,34 @@
+// |reftest| error:ReferenceError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Abrupt completions resulting from value retrieval are forwarded to the
+ runtime.
+esid: sec-moduleevaluation
+info: |
+ [...]
+ 16. Let result be the result of evaluating module.[[ECMAScriptCode]].
+ [...]
+
+ 15.2.3.11 Runtime Semantics: Evaluation
+
+ ExportDeclaration : export default AssignmentExpression;
+
+ [...]
+ 1. Let rhs be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(rhs).
+
+ 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) is true, throw a ReferenceError exception.
+negative:
+ phase: runtime
+ type: ReferenceError
+flags: [module]
+---*/
+
+export default unresolvable;
diff --git a/js/src/tests/test262/language/module-code/eval-export-dflt-expr-fn-anon.js b/js/src/tests/test262/language/module-code/eval-export-dflt-expr-fn-anon.js
new file mode 100644
index 0000000000..2eb93f0447
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-export-dflt-expr-fn-anon.js
@@ -0,0 +1,35 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Default AssignmentExpression (which can be recognized as an "anonymous"
+ function declaration) is correctly initialized upon evaluation
+esid: sec-moduleevaluation
+info: |
+ [...]
+ 16. Let result be the result of evaluating module.[[ECMAScriptCode]].
+ [...]
+
+ 15.2.3.11 Runtime Semantics: Evaluation
+
+ ExportDeclaration : export default AssignmentExpression;
+
+ [...]
+ 3. If IsAnonymousFunctionDefinition(AssignmentExpression) is true, then
+ a. Let hasNameProperty be ? HasOwnProperty(value, "name").
+ b. If hasNameProperty is false, perform SetFunctionName(value,
+ "default").
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Perform ? InitializeBoundName("*default*", value, env).
+ [...]
+flags: [module]
+---*/
+
+export default (function() { return 99; });
+import f from './eval-export-dflt-expr-fn-anon.js';
+
+assert.sameValue(f(), 99, 'binding initialized');
+assert.sameValue(f.name, 'default', 'correct name is assigned');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/eval-export-dflt-expr-fn-named.js b/js/src/tests/test262/language/module-code/eval-export-dflt-expr-fn-named.js
new file mode 100644
index 0000000000..4c98af0129
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-export-dflt-expr-fn-named.js
@@ -0,0 +1,35 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Default AssignmentExpression (which can be recognized as a "named" function
+ declaration) is correctly initialized upon evaluation
+esid: sec-moduleevaluation
+info: |
+ [...]
+ 16. Let result be the result of evaluating module.[[ECMAScriptCode]].
+ [...]
+
+ 15.2.3.11 Runtime Semantics: Evaluation
+
+ ExportDeclaration : export default AssignmentExpression;
+
+ [...]
+ 3. If IsAnonymousFunctionDefinition(AssignmentExpression) is true, then
+ a. Let hasNameProperty be ? HasOwnProperty(value, "name").
+ b. If hasNameProperty is false, perform SetFunctionName(value,
+ "default").
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Perform ? InitializeBoundName("*default*", value, env).
+ [...]
+flags: [module]
+---*/
+
+export default (function fName() { return 7; });
+import f from './eval-export-dflt-expr-fn-named.js';
+
+assert.sameValue(f(), 7, 'binding initialized');
+assert.sameValue(f.name, 'fName', 'correct name is assigned');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/eval-export-dflt-expr-gen-anon.js b/js/src/tests/test262/language/module-code/eval-export-dflt-expr-gen-anon.js
new file mode 100644
index 0000000000..5726573935
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-export-dflt-expr-gen-anon.js
@@ -0,0 +1,36 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Default AssignmentExpression (which can be recognized as an "anonymous"
+ generator function declaration) is correctly initialized upon evaluation
+esid: sec-moduleevaluation
+info: |
+ [...]
+ 16. Let result be the result of evaluating module.[[ECMAScriptCode]].
+ [...]
+
+ 15.2.3.11 Runtime Semantics: Evaluation
+
+ ExportDeclaration : export default AssignmentExpression;
+
+ [...]
+ 3. If IsAnonymousFunctionDefinition(AssignmentExpression) is true, then
+ a. Let hasNameProperty be ? HasOwnProperty(value, "name").
+ b. If hasNameProperty is false, perform SetFunctionName(value,
+ "default").
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Perform ? InitializeBoundName("*default*", value, env).
+ [...]
+flags: [module]
+features: [generators]
+---*/
+
+export default (function* () { return 24601; });
+import g from './eval-export-dflt-expr-gen-anon.js';
+
+assert.sameValue(g().next().value, 24601, 'binding initialized');
+assert.sameValue(g.name, 'default', 'correct name is assigned');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/eval-export-dflt-expr-gen-named.js b/js/src/tests/test262/language/module-code/eval-export-dflt-expr-gen-named.js
new file mode 100644
index 0000000000..e268817720
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-export-dflt-expr-gen-named.js
@@ -0,0 +1,36 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Default AssignmentExpression (which can be recognized as a "named"
+ generator function declaration) is correctly initialized upon evaluation
+esid: sec-moduleevaluation
+info: |
+ [...]
+ 16. Let result be the result of evaluating module.[[ECMAScriptCode]].
+ [...]
+
+ 15.2.3.11 Runtime Semantics: Evaluation
+
+ ExportDeclaration : export default AssignmentExpression;
+
+ [...]
+ 3. If IsAnonymousFunctionDefinition(AssignmentExpression) is true, then
+ a. Let hasNameProperty be ? HasOwnProperty(value, "name").
+ b. If hasNameProperty is false, perform SetFunctionName(value,
+ "default").
+ 4. Let env be the running execution context's LexicalEnvironment.
+ 5. Perform ? InitializeBoundName("*default*", value, env).
+ [...]
+flags: [module]
+features: [generators]
+---*/
+
+export default (function* gName() { return 88; });
+import g from './eval-export-dflt-expr-gen-named.js';
+
+assert.sameValue(g().next().value, 88, 'binding initialized');
+assert.sameValue(g.name, 'gName', 'correct name is assigned');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/eval-export-dflt-expr-in.js b/js/src/tests/test262/language/module-code/eval-export-dflt-expr-in.js
new file mode 100644
index 0000000000..26aaa3854c
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-export-dflt-expr-in.js
@@ -0,0 +1,30 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ The `in` operator may occur within an exported AssignmentExpression
+esid: sec-moduleevaluation
+info: |
+ [...]
+ 16. Let result be the result of evaluating module.[[ECMAScriptCode]].
+ [...]
+
+ 15.2.3 Exports
+
+ Syntax
+
+ ExportDeclaration :
+
+ export default [lookahead ∉ { function, class }] AssignmentExpression[In];
+flags: [module]
+---*/
+
+var x = { x: true };
+
+export default 'x' in x;
+import f from './eval-export-dflt-expr-in.js';
+
+assert.sameValue(f, true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/eval-export-dflt-fun-anon-semi.js b/js/src/tests/test262/language/module-code/eval-export-dflt-fun-anon-semi.js
new file mode 100644
index 0000000000..b5baeb0fd8
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-export-dflt-fun-anon-semi.js
@@ -0,0 +1,18 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ An exported default "anonymous" function declaration does not need to be
+ terminated with a semicolon or newline
+esid: sec-moduleevaluation
+flags: [module]
+---*/
+
+var count = 0;
+
+export default function() {} if (true) { count += 1; }
+
+assert.sameValue(count, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/eval-export-dflt-fun-named-semi.js b/js/src/tests/test262/language/module-code/eval-export-dflt-fun-named-semi.js
new file mode 100644
index 0000000000..dadc923fbc
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-export-dflt-fun-named-semi.js
@@ -0,0 +1,18 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ An exported default "named" function declaration does not need to be
+ terminated with a semicolon or newline
+esid: sec-moduleevaluation
+flags: [module]
+---*/
+
+var count = 0;
+
+export default function f() {} if (true) { count += 1; }
+
+assert.sameValue(count, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/eval-export-dflt-gen-anon-semi.js b/js/src/tests/test262/language/module-code/eval-export-dflt-gen-anon-semi.js
new file mode 100644
index 0000000000..c286b18cac
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-export-dflt-gen-anon-semi.js
@@ -0,0 +1,19 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ An exported default "anonymous" generator function declaration does not
+ need to be terminated with a semicolon or newline
+esid: sec-moduleevaluation
+flags: [module]
+features: [generators]
+---*/
+
+var count = 0;
+
+export default function* () {} if (true) { count += 1; }
+
+assert.sameValue(count, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/eval-export-dflt-gen-named-semi.js b/js/src/tests/test262/language/module-code/eval-export-dflt-gen-named-semi.js
new file mode 100644
index 0000000000..6655a4fae5
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-export-dflt-gen-named-semi.js
@@ -0,0 +1,19 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ An exported default "named" generator function declaration does not need to
+ be terminated with a semicolon or newline
+esid: sec-moduleevaluation
+flags: [module]
+features: [generators]
+---*/
+
+var count = 0;
+
+export default function* g() {} if (true) { count += 1; }
+
+assert.sameValue(count, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/eval-export-fun-semi.js b/js/src/tests/test262/language/module-code/eval-export-fun-semi.js
new file mode 100644
index 0000000000..dbb3531bd1
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-export-fun-semi.js
@@ -0,0 +1,18 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ An exported function declaration does not need to be terminated with a
+ semicolon or newline
+esid: sec-moduleevaluation
+flags: [module]
+---*/
+
+var count = 0;
+
+export function f() {} if (true) { count += 1; }
+
+assert.sameValue(count, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/eval-export-gen-semi.js b/js/src/tests/test262/language/module-code/eval-export-gen-semi.js
new file mode 100644
index 0000000000..d5fdd1f7c9
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-export-gen-semi.js
@@ -0,0 +1,19 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ An exported generator function declaration does not need to be terminated
+ with a semicolon or newline
+esid: sec-moduleevaluation
+flags: [module]
+features: [generators]
+---*/
+
+var count = 0;
+
+export function* g() {} if (true) { count += 1; }
+
+assert.sameValue(count, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/eval-gtbndng-indirect-faux-assertion.js b/js/src/tests/test262/language/module-code/eval-gtbndng-indirect-faux-assertion.js
new file mode 100644
index 0000000000..0569084538
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-gtbndng-indirect-faux-assertion.js
@@ -0,0 +1,72 @@
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ AssertClause in ImportDeclaration may not be preceded by a line terminator
+esid: sec-modules
+info: |
+ ImportDeclaration:
+ import ModuleSpecifier[no LineTerminator here] AssertClause;
+
+ AssertClause:
+ assert {}
+ assert {AssertEntries ,opt}
+
+ AssertEntries:
+ AssertionKey : StringLiteral
+ AssertionKey : StringLiteral , AssertEntries
+
+ AssertionKey:
+ IdentifierName
+ StringLiteral
+
+ The restriction LineTerminator could be verified more simply with a negative
+ syntax test. This test is designed to parse successfully in order to verify
+ the restriction more precisely.
+features: [import-assertions, globalThis]
+flags: [module, raw]
+---*/
+
+var callCount = 0;
+
+// Define a property on the global "this" value so that the effect of the
+// expected IdentifierReference can be observed.
+Object.defineProperty(globalThis, 'assert', {
+ get: function() {
+ callCount += 1;
+ }
+});
+
+import x from './import-assertion-1_FIXTURE.js'
+assert
+{test262:''};
+
+if (x !== 262.1) {
+ throw 'module value incorrectly imported - first declaration';
+}
+
+if (callCount !== 1) {
+ throw 'IdentifierReference not recognized - first declaration';
+}
+
+import './import-assertion-2_FIXTURE.js'
+assert
+{test262:''};
+
+if (globalThis.test262 !== 262.2) {
+ throw 'module value incorrectly imported - second declaration';
+}
+
+if (callCount !== 2) {
+ throw 'IdentifierReference not recognized - second declaration';
+}
+
+export * from './import-assertion-3_FIXTURE.js'
+assert
+{test262:''};
+
+if (callCount !== 3) {
+ throw 'IdentifierReference not recognized - third declaration';
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/eval-gtbndng-indirect-trlng-comma.js b/js/src/tests/test262/language/module-code/eval-gtbndng-indirect-trlng-comma.js
new file mode 100644
index 0000000000..e3d6a9ad45
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-gtbndng-indirect-trlng-comma.js
@@ -0,0 +1,26 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ NamedImports in ImportDeclaration may contain a trailing comma
+esid: sec-moduleevaluation
+info: |
+ 8.1.1.5.1 GetBindingValue (N, S)
+
+ [...]
+ 3. If the binding for N is an indirect binding, then
+ a. Let M and N2 be the indirection values provided when this binding for
+ N was created.
+ b. Let targetEnv be M.[[Environment]].
+ c. If targetEnv is undefined, throw a ReferenceError exception.
+ d. Let targetER be targetEnv's EnvironmentRecord.
+ e. Return ? targetER.GetBindingValue(N2, S).
+flags: [module]
+---*/
+
+import { x , } from './eval-gtbndng-indirect-trlng-comma_FIXTURE.js';
+
+assert.sameValue(x, 1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/eval-gtbndng-indirect-trlng-comma_FIXTURE.js b/js/src/tests/test262/language/module-code/eval-gtbndng-indirect-trlng-comma_FIXTURE.js
new file mode 100644
index 0000000000..5275738273
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-gtbndng-indirect-trlng-comma_FIXTURE.js
@@ -0,0 +1,5 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export var x = 1;
diff --git a/js/src/tests/test262/language/module-code/eval-gtbndng-indirect-update-as.js b/js/src/tests/test262/language/module-code/eval-gtbndng-indirect-update-as.js
new file mode 100644
index 0000000000..c50235f790
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-gtbndng-indirect-update-as.js
@@ -0,0 +1,37 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Modifications to named bindings that occur after dependency has been
+ evaluated are reflected in local binding
+esid: sec-moduleevaluation
+info: |
+ 8.1.1.5.1 GetBindingValue (N, S)
+
+ [...]
+ 3. If the binding for N is an indirect binding, then
+ a. Let M and N2 be the indirection values provided when this binding for
+ N was created.
+ b. Let targetEnv be M.[[Environment]].
+ c. If targetEnv is undefined, throw a ReferenceError exception.
+ d. Let targetER be targetEnv's EnvironmentRecord.
+ e. Return ? targetER.GetBindingValue(N2, S).
+includes: [fnGlobalObject.js]
+flags: [module]
+---*/
+
+import { x as y, x as z } from './eval-gtbndng-indirect-update-as_FIXTURE.js';
+
+assert.sameValue(y, 1);
+assert.sameValue(z, 1);
+
+// This function is exposed on the global scope (instead of as an exported
+// binding) in order to avoid possible false positives from assuming correct
+// behavior of the semantics under test.
+fnGlobalObject().test262update();
+
+assert.sameValue(y, 2);
+assert.sameValue(z, 2);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/eval-gtbndng-indirect-update-as_FIXTURE.js b/js/src/tests/test262/language/module-code/eval-gtbndng-indirect-update-as_FIXTURE.js
new file mode 100644
index 0000000000..37a51bb18b
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-gtbndng-indirect-update-as_FIXTURE.js
@@ -0,0 +1,10 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+var x = 1;
+export { x };
+
+Function('return this;')().test262update = function() {
+ x = 2;
+};
diff --git a/js/src/tests/test262/language/module-code/eval-gtbndng-indirect-update-dflt.js b/js/src/tests/test262/language/module-code/eval-gtbndng-indirect-update-dflt.js
new file mode 100644
index 0000000000..d37b39f148
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-gtbndng-indirect-update-dflt.js
@@ -0,0 +1,27 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Modifications to default binding that occur after dependency has been
+ evaluated are reflected in local binding
+info: |
+ 8.1.1.5.1 GetBindingValue (N, S)
+
+ [...]
+ 3. If the binding for N is an indirect binding, then
+ a. Let M and N2 be the indirection values provided when this binding for
+ N was created.
+ b. Let targetEnv be M.[[Environment]].
+ c. If targetEnv is undefined, throw a ReferenceError exception.
+ d. Let targetER be targetEnv's EnvironmentRecord.
+ e. Return ? targetER.GetBindingValue(N2, S).
+flags: [module]
+---*/
+
+import val from './eval-gtbndng-indirect-update-dflt_FIXTURE.js';
+
+assert.sameValue(val(), 1);
+assert.sameValue(val, 2);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/eval-gtbndng-indirect-update-dflt_FIXTURE.js b/js/src/tests/test262/language/module-code/eval-gtbndng-indirect-update-dflt_FIXTURE.js
new file mode 100644
index 0000000000..635bcbb682
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-gtbndng-indirect-update-dflt_FIXTURE.js
@@ -0,0 +1,8 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export default function fn() {
+ fn = 2;
+ return 1;
+}
diff --git a/js/src/tests/test262/language/module-code/eval-gtbndng-indirect-update.js b/js/src/tests/test262/language/module-code/eval-gtbndng-indirect-update.js
new file mode 100644
index 0000000000..bf67e4df3e
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-gtbndng-indirect-update.js
@@ -0,0 +1,35 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Modifications to named bindings that occur after dependency has been
+ evaluated are reflected in local binding
+esid: sec-moduleevaluation
+info: |
+ 8.1.1.5.1 GetBindingValue (N, S)
+
+ [...]
+ 3. If the binding for N is an indirect binding, then
+ a. Let M and N2 be the indirection values provided when this binding for
+ N was created.
+ b. Let targetEnv be M.[[Environment]].
+ c. If targetEnv is undefined, throw a ReferenceError exception.
+ d. Let targetER be targetEnv's EnvironmentRecord.
+ e. Return ? targetER.GetBindingValue(N2, S).
+includes: [fnGlobalObject.js]
+flags: [module]
+---*/
+
+import { x } from './eval-gtbndng-indirect-update_FIXTURE.js';
+
+assert.sameValue(x, 1);
+
+// This function is exposed on the global scope (instead of as an exported
+// binding) in order to avoid possible false positives from assuming correct
+// behavior of the semantics under test.
+fnGlobalObject().test262update();
+
+assert.sameValue(x, 2);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/eval-gtbndng-indirect-update_FIXTURE.js b/js/src/tests/test262/language/module-code/eval-gtbndng-indirect-update_FIXTURE.js
new file mode 100644
index 0000000000..37a51bb18b
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-gtbndng-indirect-update_FIXTURE.js
@@ -0,0 +1,10 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+var x = 1;
+export { x };
+
+Function('return this;')().test262update = function() {
+ x = 2;
+};
diff --git a/js/src/tests/test262/language/module-code/eval-gtbndng-local-bndng-cls.js b/js/src/tests/test262/language/module-code/eval-gtbndng-local-bndng-cls.js
new file mode 100644
index 0000000000..38a0709b0e
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-gtbndng-local-bndng-cls.js
@@ -0,0 +1,38 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: References to local `let` bindings resolve successfully
+esid: sec-moduleevaluation
+info: |
+ 8.1.1.5.1 GetBindingValue (N, S)
+
+ [...]
+ 3. If the binding for N is an indirect binding, then
+ [...]
+ 5. Return the value currently bound to N in envRec.
+
+ 14.5.16 Runtime Semantics: Evaluation
+
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let status be the result of BindingClassDeclarationEvaluation of this
+ ClassDeclaration.
+ 2. ReturnIfAbrupt(status).
+ 3. Return NormalCompletion(empty).
+
+ 14.5.15 Runtime Semantics: BindingClassDeclarationEvaluation
+
+ [...]
+ 7. Perform ? InitializeBoundName(className, value, env).
+ [...]
+flags: [module]
+---*/
+
+class classBinding { valueOf() { return 33; } }
+assert.sameValue(new classBinding().valueOf(), 33);
+
+classBinding = 44;
+assert.sameValue(classBinding, 44);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/eval-gtbndng-local-bndng-const.js b/js/src/tests/test262/language/module-code/eval-gtbndng-local-bndng-const.js
new file mode 100644
index 0000000000..58c3c370ae
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-gtbndng-local-bndng-const.js
@@ -0,0 +1,27 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: References to local `const` bindings resolve successfully
+esid: sec-moduleevaluation
+info: |
+ 8.1.1.5.1 GetBindingValue (N, S)
+
+ [...]
+ 3. If the binding for N is an indirect binding, then
+ [...]
+ 5. Return the value currently bound to N in envRec.
+
+ 13.3.1.4 Runtime Semantics: Evaluation
+
+ LexicalBinding : BindingIdentifier Initializer
+
+ [...]
+ 6. Return InitializeReferencedBinding(lhs, value).
+flags: [module]
+---*/
+
+const constBinding = 89;
+assert.sameValue(constBinding, 89);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/eval-gtbndng-local-bndng-let.js b/js/src/tests/test262/language/module-code/eval-gtbndng-local-bndng-let.js
new file mode 100644
index 0000000000..604f6f962e
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-gtbndng-local-bndng-let.js
@@ -0,0 +1,30 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: References to local `let` bindings resolve successfully
+esid: sec-moduleevaluation
+info: |
+ 8.1.1.5.1 GetBindingValue (N, S)
+
+ [...]
+ 3. If the binding for N is an indirect binding, then
+ [...]
+ 5. Return the value currently bound to N in envRec.
+
+ 13.3.1.4 Runtime Semantics: Evaluation
+
+ LexicalBinding : BindingIdentifier Initializer
+
+ [...]
+ 6. Return InitializeReferencedBinding(lhs, value).
+flags: [module]
+---*/
+
+let letBinding = 1;
+assert.sameValue(letBinding, 1);
+
+letBinding = 2;
+assert.sameValue(letBinding, 2);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/eval-gtbndng-local-bndng-var.js b/js/src/tests/test262/language/module-code/eval-gtbndng-local-bndng-var.js
new file mode 100644
index 0000000000..b6a29e20ba
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-gtbndng-local-bndng-var.js
@@ -0,0 +1,43 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: References to local `var` bindings resolve successfully
+esid: sec-moduleevaluation
+info: |
+ 8.1.1.5.1 GetBindingValue (N, S)
+
+ [...]
+ 3. If the binding for N is an indirect binding, then
+ [...]
+ 5. Return the value currently bound to N in envRec.
+
+
+ 15.2.1.16.4 ModuleDeclarationInstantiation( )
+
+ [...]
+ 14. Let declaredVarNames be a new empty List.
+ 15. For each element d in varDeclarations do
+ a. For each element dn of the BoundNames of d do
+ i. If dn is not an element of declaredVarNames, then
+ 1. Perform ! envRec.CreateMutableBinding(dn, false).
+ 2. Call envRec.InitializeBinding(dn, undefined).
+ 3. Append dn to declaredVarNames.
+ [...]
+
+ 13.3.2.4 Runtime Semantics: Evaluation
+
+ VariableDeclaration : BindingIdentifier Initializer
+
+ [...]
+ 6. Return ? PutValue(lhs, value).
+flags: [module]
+---*/
+
+var varBinding = 1;
+assert.sameValue(varBinding, 1);
+
+varBinding = 2;
+assert.sameValue(varBinding, 2);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/eval-rqstd-abrupt-err-type_FIXTURE.js b/js/src/tests/test262/language/module-code/eval-rqstd-abrupt-err-type_FIXTURE.js
new file mode 100644
index 0000000000..ed8e35d49b
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-rqstd-abrupt-err-type_FIXTURE.js
@@ -0,0 +1,5 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+throw new TypeError();
diff --git a/js/src/tests/test262/language/module-code/eval-rqstd-abrupt-err-uri_FIXTURE.js b/js/src/tests/test262/language/module-code/eval-rqstd-abrupt-err-uri_FIXTURE.js
new file mode 100644
index 0000000000..769e7ba3f5
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-rqstd-abrupt-err-uri_FIXTURE.js
@@ -0,0 +1,5 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+throw new Error();
diff --git a/js/src/tests/test262/language/module-code/eval-rqstd-abrupt.js b/js/src/tests/test262/language/module-code/eval-rqstd-abrupt.js
new file mode 100644
index 0000000000..f02fee5f5b
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-rqstd-abrupt.js
@@ -0,0 +1,23 @@
+// |reftest| error:TypeError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Abrupt completion during module evaluation precludes further evaluation
+esid: sec-moduleevaluation
+info: |
+ [...]
+ 6. For each String required that is an element of
+ module.[[RequestedModules]] do,
+ a. Let requiredModule be ? HostResolveImportedModule(module, required).
+ b. Perform ? requiredModule.ModuleEvaluation().
+negative:
+ phase: runtime
+ type: TypeError
+flags: [module]
+---*/
+
+import './eval-rqstd-abrupt-err-type_FIXTURE.js';
+import './eval-rqstd-abrupt-err-uri_FIXTURE.js';
+
+throw new RangeError();
diff --git a/js/src/tests/test262/language/module-code/eval-rqstd-once.js b/js/src/tests/test262/language/module-code/eval-rqstd-once.js
new file mode 100644
index 0000000000..e9618caa1e
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-rqstd-once.js
@@ -0,0 +1,36 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Requested modules are evaluated exactly once
+esid: sec-moduleevaluation
+info: |
+ [...]
+ 4. If module.[[Evaluated]] is true, return undefined.
+ 5. Set module.[[Evaluated]] to true.
+ 6. For each String required that is an element of module.[[RequestedModules]] do,
+ a. Let requiredModule be ? HostResolveImportedModule(module, required).
+ b. Perform ? requiredModule.ModuleEvaluation().
+ [...]
+includes: [fnGlobalObject.js]
+flags: [module]
+features: [export-star-as-namespace-from-module]
+---*/
+
+import {} from './eval-rqstd-once_FIXTURE.js';
+import './eval-rqstd-once_FIXTURE.js';
+import * as ns1 from './eval-rqstd-once_FIXTURE.js';
+import dflt1 from './eval-rqstd-once_FIXTURE.js';
+export {} from './eval-rqstd-once_FIXTURE.js';
+import dflt2, {} from './eval-rqstd-once_FIXTURE.js';
+export * from './eval-rqstd-once_FIXTURE.js';
+export * as ns2 from './eval-rqstd-once_FIXTURE.js';
+export * as class from './eval-rqstd-once_FIXTURE.js';
+import dflt3, * as ns3 from './eval-rqstd-once_FIXTURE.js';
+export default null;
+
+var global = fnGlobalObject();
+
+assert.sameValue(global.test262, 262, 'global property was defined');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/eval-rqstd-once_FIXTURE.js b/js/src/tests/test262/language/module-code/eval-rqstd-once_FIXTURE.js
new file mode 100644
index 0000000000..7a26638e77
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-rqstd-once_FIXTURE.js
@@ -0,0 +1,16 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export default null;
+var global = Function('return this;')();
+
+if (global.test262) {
+ throw new Error('Module was evaluated more than once.');
+}
+
+global.test262 = 262;
+
+if (global.test262 !== 262) {
+ throw new Error('Module was unable to signal evaluation.');
+}
diff --git a/js/src/tests/test262/language/module-code/eval-rqstd-order-1_FIXTURE.js b/js/src/tests/test262/language/module-code/eval-rqstd-order-1_FIXTURE.js
new file mode 100644
index 0000000000..1ee69dc2c2
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-rqstd-order-1_FIXTURE.js
@@ -0,0 +1,5 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+Function('return this;')().test262 = '1';
diff --git a/js/src/tests/test262/language/module-code/eval-rqstd-order-2_FIXTURE.js b/js/src/tests/test262/language/module-code/eval-rqstd-order-2_FIXTURE.js
new file mode 100644
index 0000000000..3dc646f8d8
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-rqstd-order-2_FIXTURE.js
@@ -0,0 +1,5 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+Function('return this;')().test262 += '2';
diff --git a/js/src/tests/test262/language/module-code/eval-rqstd-order-3_FIXTURE.js b/js/src/tests/test262/language/module-code/eval-rqstd-order-3_FIXTURE.js
new file mode 100644
index 0000000000..8c9b8c92fd
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-rqstd-order-3_FIXTURE.js
@@ -0,0 +1,5 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+Function('return this;')().test262 += '3';
diff --git a/js/src/tests/test262/language/module-code/eval-rqstd-order-4_FIXTURE.js b/js/src/tests/test262/language/module-code/eval-rqstd-order-4_FIXTURE.js
new file mode 100644
index 0000000000..23767d33b9
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-rqstd-order-4_FIXTURE.js
@@ -0,0 +1,7 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+Function('return this;')().test262 += '4';
+
+export default null;
diff --git a/js/src/tests/test262/language/module-code/eval-rqstd-order-5_FIXTURE.js b/js/src/tests/test262/language/module-code/eval-rqstd-order-5_FIXTURE.js
new file mode 100644
index 0000000000..351090879a
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-rqstd-order-5_FIXTURE.js
@@ -0,0 +1,5 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+Function('return this;')().test262 += '5';
diff --git a/js/src/tests/test262/language/module-code/eval-rqstd-order-6_FIXTURE.js b/js/src/tests/test262/language/module-code/eval-rqstd-order-6_FIXTURE.js
new file mode 100644
index 0000000000..f21197bf24
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-rqstd-order-6_FIXTURE.js
@@ -0,0 +1,7 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+Function('return this;')().test262 += '6';
+
+export default null;
diff --git a/js/src/tests/test262/language/module-code/eval-rqstd-order-7_FIXTURE.js b/js/src/tests/test262/language/module-code/eval-rqstd-order-7_FIXTURE.js
new file mode 100644
index 0000000000..005566555b
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-rqstd-order-7_FIXTURE.js
@@ -0,0 +1,5 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+Function('return this;')().test262 += '7';
diff --git a/js/src/tests/test262/language/module-code/eval-rqstd-order-8_FIXTURE.js b/js/src/tests/test262/language/module-code/eval-rqstd-order-8_FIXTURE.js
new file mode 100644
index 0000000000..bfa538a890
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-rqstd-order-8_FIXTURE.js
@@ -0,0 +1,7 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+Function('return this;')().test262 += '8';
+
+export default null;
diff --git a/js/src/tests/test262/language/module-code/eval-rqstd-order-9_FIXTURE.js b/js/src/tests/test262/language/module-code/eval-rqstd-order-9_FIXTURE.js
new file mode 100644
index 0000000000..c651448cd2
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-rqstd-order-9_FIXTURE.js
@@ -0,0 +1,5 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2018 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+Function('return this;')().test262 += '9';
diff --git a/js/src/tests/test262/language/module-code/eval-rqstd-order.js b/js/src/tests/test262/language/module-code/eval-rqstd-order.js
new file mode 100644
index 0000000000..fbe65b410b
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-rqstd-order.js
@@ -0,0 +1,43 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Requested modules are evaluated prior to the requesting module in source
+ code order
+esid: sec-moduleevaluation
+info: |
+ [...]
+ 6. For each String required that is an element of
+ module.[[RequestedModules]] do,
+ a. Let requiredModule be ? HostResolveImportedModule(module, required).
+ b. Perform ? requiredModule.ModuleEvaluation().
+ [...]
+ 16. Let result be the result of evaluating module.[[ECMAScriptCode]].
+ [...]
+includes: [fnGlobalObject.js]
+flags: [module]
+features: [export-star-as-namespace-from-module]
+---*/
+
+assert.sameValue(fnGlobalObject().test262, '123456789');
+
+import {} from './eval-rqstd-order-1_FIXTURE.js';
+
+import './eval-rqstd-order-2_FIXTURE.js';
+
+import * as ns1 from './eval-rqstd-order-3_FIXTURE.js';
+
+import dflt1 from './eval-rqstd-order-4_FIXTURE.js';
+
+export {} from './eval-rqstd-order-5_FIXTURE.js';
+
+import dflt2, {} from './eval-rqstd-order-6_FIXTURE.js';
+
+export * from './eval-rqstd-order-7_FIXTURE.js';
+
+import dflt3, * as ns2 from './eval-rqstd-order-8_FIXTURE.js';
+
+export * as ns3 from './eval-rqstd-order-9_FIXTURE.js';
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/eval-self-abrupt.js b/js/src/tests/test262/language/module-code/eval-self-abrupt.js
new file mode 100644
index 0000000000..9039f207ac
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-self-abrupt.js
@@ -0,0 +1,20 @@
+// |reftest| error:Test262Error module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Abrupt completion from module evaluation is reported
+esid: sec-moduleevaluation
+info: |
+ [...]
+ 16. Let result be the result of evaluating module.[[ECMAScriptCode]].
+ 17. Suspend moduleCxt and remove it from the execution context stack.
+ 18. Resume the context that is now on the top of the execution context
+ stack as the running execution context.
+ 19. Return Completion(result).
+negative:
+ phase: runtime
+ type: Test262Error
+flags: [module]
+---*/
+
+throw new Test262Error();
diff --git a/js/src/tests/test262/language/module-code/eval-self-once.js b/js/src/tests/test262/language/module-code/eval-self-once.js
new file mode 100644
index 0000000000..5fdb10823f
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-self-once.js
@@ -0,0 +1,48 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Module is evaluated exactly once
+esid: sec-moduleevaluation
+info: |
+ Evaluate( ) Concrete Method
+ [...]
+ 4. Let result be InnerModuleEvaluation(module, stack, 0).
+ [...]
+
+ InnerModuleEvaluation( module, stack, index )
+ [...]
+ 2. If module.[[Status]] is "evaluated", then
+ a. If module.[[EvaluationError]] is undefined, return index.
+ b. Otherwise return module.[[EvaluationError]].
+ [...]
+ 6. For each String required that is an element of module.[[RequestedModules]] do,
+ a. Let requiredModule be ? HostResolveImportedModule(module, required).
+ [...]
+ c. Set index to ? InnerModuleEvaluation(requiredModule, stack, index).
+ [...]
+includes: [fnGlobalObject.js]
+flags: [module]
+features: [export-star-as-namespace-from-module]
+---*/
+
+import {} from './eval-self-once.js';
+import './eval-self-once.js';
+import * as ns1 from './eval-self-once.js';
+import dflt1 from './eval-self-once.js';
+export {} from './eval-self-once.js';
+import dflt2, {} from './eval-self-once.js';
+export * from './eval-self-once.js';
+export * as ns2 from './eval-self-once.js';
+import dflt3, * as ns from './eval-self-once.js';
+export default null;
+
+var global = fnGlobalObject();
+
+assert.sameValue(global.test262, undefined, 'global property initially unset');
+
+global.test262 = 262;
+
+assert.sameValue(global.test262, 262, 'global property was defined');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/eval-this.js b/js/src/tests/test262/language/module-code/eval-this.js
new file mode 100644
index 0000000000..c269282ffc
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/eval-this.js
@@ -0,0 +1,48 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Module Environment Records provide a this binding, and the value is
+ `undefined`.
+esid: sec-moduleevaluation
+info: |
+ [...]
+ 16. Let result be the result of evaluating module.[[ECMAScriptCode]].
+ [...]
+
+ 12.2.2 The this Keyword
+ 12.2.2.1 Runtime Semantics: Evaluation
+
+ PrimaryExpression : this
+
+ 1. Return ? ResolveThisBinding( ).
+
+ 8.3.4 ResolveThisBinding ( )
+
+ 1. Let envRec be GetThisEnvironment( ).
+ 2. Return ? envRec.GetThisBinding().
+
+ 8.3.3 GetThisEnvironment ( )
+
+ 1. Let lex be the running execution context's LexicalEnvironment.
+ 2. Repeat
+ a. Let envRec be lex's EnvironmentRecord.
+ b. Let exists be envRec.HasThisBinding().
+ c. If exists is true, return envRec.
+ d. Let outer be the value of lex's outer environment reference.
+ e. Let lex be outer.
+
+ 8.1.1.5.3 HasThisBinding ()
+
+ 1. Return true.
+
+ 8.1.1.5.4 GetThisBinding ()
+
+ 1. Return undefined.
+flags: [module]
+---*/
+
+assert.sameValue(this, undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/export-default-asyncfunction-declaration-binding-exists.js b/js/src/tests/test262/language/module-code/export-default-asyncfunction-declaration-binding-exists.js
new file mode 100644
index 0000000000..71b2d89320
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/export-default-asyncfunction-declaration-binding-exists.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ ExportDeclaration : HoistableDeclaration : AsyncFunctionDeclaration
+ esid: prod-HoistableDeclaration
+info: |
+ ExportDeclaration :
+ HoistableDeclaration[Yield, Await, Default]:
+
+ HoistableDeclaration[Yield, Await, Default]:
+ AsyncFunctionDeclaration[?Yield, ?Await, ?Default]
+
+flags: [module]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+class A {};
+export default async function A() {}
diff --git a/js/src/tests/test262/language/module-code/export-default-asyncfunction-declaration-binding.js b/js/src/tests/test262/language/module-code/export-default-asyncfunction-declaration-binding.js
new file mode 100644
index 0000000000..dcfb205350
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/export-default-asyncfunction-declaration-binding.js
@@ -0,0 +1,21 @@
+// |reftest| module
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ ExportDeclaration : HoistableDeclaration : AsyncFunctionDeclaration
+ esid: prod-HoistableDeclaration
+info: |
+ ExportDeclaration :
+ HoistableDeclaration[Yield, Await, Default]:
+
+ HoistableDeclaration[Yield, Await, Default]:
+ AsyncFunctionDeclaration[?Yield, ?Await, ?Default]
+
+flags: [module]
+---*/
+
+export default async function A() {}
+A.foo = '';
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/export-default-asyncgenerator-declaration-binding-exists.js b/js/src/tests/test262/language/module-code/export-default-asyncgenerator-declaration-binding-exists.js
new file mode 100644
index 0000000000..ffb2dcb937
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/export-default-asyncgenerator-declaration-binding-exists.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ ExportDeclaration : HoistableDeclaration : AsyncGeneratorDeclaration
+ esid: prod-HoistableDeclaration
+info: |
+ ExportDeclaration :
+ HoistableDeclaration[Yield, Await, Default]:
+
+ HoistableDeclaration[Yield, Await, Default]:
+ AsyncGeneratorDeclaration[?Yield, ?Await, ?Default]
+
+flags: [module]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+class AG {}
+export default async function * AG() {}
diff --git a/js/src/tests/test262/language/module-code/export-default-asyncgenerator-declaration-binding.js b/js/src/tests/test262/language/module-code/export-default-asyncgenerator-declaration-binding.js
new file mode 100644
index 0000000000..170a75658e
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/export-default-asyncgenerator-declaration-binding.js
@@ -0,0 +1,21 @@
+// |reftest| module
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ ExportDeclaration : HoistableDeclaration : AsyncGeneratorDeclaration
+ esid: prod-HoistableDeclaration
+info: |
+ ExportDeclaration :
+ HoistableDeclaration[Yield, Await, Default]:
+
+ HoistableDeclaration[Yield, Await, Default]:
+ AsyncGeneratorDeclaration[?Yield, ?Await, ?Default]
+
+flags: [module]
+---*/
+
+export default async function * AG() {}
+AG.foo = '';
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/export-default-function-declaration-binding-exists.js b/js/src/tests/test262/language/module-code/export-default-function-declaration-binding-exists.js
new file mode 100644
index 0000000000..78fb19d7dd
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/export-default-function-declaration-binding-exists.js
@@ -0,0 +1,25 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ ExportDeclaration : HoistableDeclaration : FunctionDeclaration
+ esid: prod-HoistableDeclaration
+info: |
+ ExportDeclaration :
+ HoistableDeclaration[Yield, Await, Default]:
+
+ HoistableDeclaration[Yield, Await, Default]:
+ FunctionDeclaration[?Yield, ?Await, ?Default]
+
+flags: [module]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+class F {}
+export default function F() {}
+
diff --git a/js/src/tests/test262/language/module-code/export-default-function-declaration-binding.js b/js/src/tests/test262/language/module-code/export-default-function-declaration-binding.js
new file mode 100644
index 0000000000..612b6ced4b
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/export-default-function-declaration-binding.js
@@ -0,0 +1,21 @@
+// |reftest| module
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ ExportDeclaration : HoistableDeclaration : FunctionDeclaration
+ esid: prod-HoistableDeclaration
+info: |
+ ExportDeclaration :
+ HoistableDeclaration[Yield, Await, Default]:
+
+ HoistableDeclaration[Yield, Await, Default]:
+ FunctionDeclaration[?Yield, ?Await, ?Default]
+
+flags: [module]
+---*/
+
+export default function F() {}
+F.foo = '';
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/export-default-generator-declaration-binding-exists.js b/js/src/tests/test262/language/module-code/export-default-generator-declaration-binding-exists.js
new file mode 100644
index 0000000000..d2e65d0dce
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/export-default-generator-declaration-binding-exists.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ ExportDeclaration : HoistableDeclaration : GeneratorDeclaration
+ esid: prod-HoistableDeclaration
+info: |
+ ExportDeclaration :
+ HoistableDeclaration[Yield, Await, Default]:
+
+ HoistableDeclaration[Yield, Await, Default]:
+ GeneratorDeclaration[?Yield, ?Await, ?Default]
+
+flags: [module]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+class G {}
+export default function * G() {}
diff --git a/js/src/tests/test262/language/module-code/export-default-generator-declaration-binding.js b/js/src/tests/test262/language/module-code/export-default-generator-declaration-binding.js
new file mode 100644
index 0000000000..c42d345f9c
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/export-default-generator-declaration-binding.js
@@ -0,0 +1,21 @@
+// |reftest| module
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ ExportDeclaration : HoistableDeclaration : GeneratorDeclaration
+ esid: prod-HoistableDeclaration
+info: |
+ ExportDeclaration :
+ HoistableDeclaration[Yield, Await, Default]:
+
+ HoistableDeclaration[Yield, Await, Default]:
+ GeneratorDeclaration[?Yield, ?Await, ?Default]
+
+flags: [module]
+---*/
+
+export default function * G() {}
+G.foo = '';
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/export-expname-binding-index.js b/js/src/tests/test262/language/module-code/export-expname-binding-index.js
new file mode 100644
index 0000000000..0b28b788e6
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/export-expname-binding-index.js
@@ -0,0 +1,51 @@
+// |reftest| module
+// Copyright (C) 2021 Alexey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-module-namespace-exotic-objects
+description: >
+ Internal methods of module namespace exotic objects are correct
+ with non-Identifier bindings that are integer indices.
+info: |
+ [[HasProperty]] ( P )
+
+ [...]
+ 3. If P is an element of exports, return true.
+ 4. Return false.
+
+ [[Get]] ( P, Receiver )
+
+ [...]
+ 13. Return ? targetEnv.GetBindingValue(binding.[[BindingName]], true).
+
+ [[Set]] ( P, V, Receiver )
+
+ 1. Return false.
+
+ [[Delete]] ( P )
+
+ [...]
+ 4. If P is an element of exports, return false.
+ 5. Return true.
+flags: [module]
+features: [arbitrary-module-namespace-names, Reflect]
+---*/
+import * as ns from "./export-expname-binding-index_FIXTURE.js";
+
+assert.sameValue(ns[0], 0);
+assert.sameValue(Reflect.get(ns, 1), 1);
+assert.sameValue(ns[2], undefined);
+
+assert.throws(TypeError, () => { ns[0] = 1; });
+assert(!Reflect.set(ns, 1, 1));
+assert.throws(TypeError, () => { ns[2] = 2; });
+
+assert(0 in ns);
+assert(Reflect.has(ns, 1));
+assert(!(2 in ns));
+
+assert.throws(TypeError, () => { delete ns[0]; });
+assert(!Reflect.deleteProperty(ns, 1));
+assert(delete ns[2]);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/export-expname-binding-index_FIXTURE.js b/js/src/tests/test262/language/module-code/export-expname-binding-index_FIXTURE.js
new file mode 100644
index 0000000000..74daa87190
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/export-expname-binding-index_FIXTURE.js
@@ -0,0 +1,7 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2021 Alexey Shvayka. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+var a = 0;
+var b = 1;
+export { a as "0", b as "1" };
diff --git a/js/src/tests/test262/language/module-code/export-expname-binding-string.js b/js/src/tests/test262/language/module-code/export-expname-binding-string.js
new file mode 100644
index 0000000000..c8f7bdca88
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/export-expname-binding-string.js
@@ -0,0 +1,21 @@
+// |reftest| module
+// Copyright (C) 2020 Bradley Farias. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Module Namespace Objects can have non-Identifier properties
+esid: prod-ExportSpecifier
+info: |
+ ExportSpecifier[From] :
+ IdentifierName `as` ModuleExportName
+
+ ModuleExportName : StringLiteral
+
+flags: [module]
+features: [arbitrary-module-namespace-names]
+---*/
+import * as Scouts from "./export-expname_FIXTURE.js";
+
+assert.sameValue(Scouts.Mercury, globalThis.Mercury);
+assert.sameValue(Scouts["☿"], globalThis.Mercury);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/export-expname-from-as-unpaired-surrogate.js b/js/src/tests/test262/language/module-code/export-expname-from-as-unpaired-surrogate.js
new file mode 100644
index 0000000000..5a3b6e15f9
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/export-expname-from-as-unpaired-surrogate.js
@@ -0,0 +1,22 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2020 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ ExportSpecifier : ModuleExportName
+ esid: prod-ExportSpecifier
+info: |
+ ModuleExportName : StringLiteral
+
+ It is a Syntax Error if IsStringWellFormedUnicode of the StringValue of
+ StringLiteral is *false*.
+flags: [module]
+features: [arbitrary-module-namespace-names]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+export { "☿" as "\uD83D" } from "./export-expname_FIXTURE.js";
diff --git a/js/src/tests/test262/language/module-code/export-expname-from-binding-string.js b/js/src/tests/test262/language/module-code/export-expname-from-binding-string.js
new file mode 100644
index 0000000000..7cf53c283f
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/export-expname-from-binding-string.js
@@ -0,0 +1,26 @@
+// |reftest| module
+// Copyright (C) 2020 Bradley Farias. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ ExportSpecifier : ModuleExportName
+ esid: prod-ExportSpecifier
+info: |
+ ExportFromClause :
+ NamedExports[+From]
+
+ ExportSpecifier[From] :
+ IdentifierName `as` ModuleExportName
+
+ ModuleExportName : StringLiteral
+
+flags: [module]
+features: [arbitrary-module-namespace-names]
+---*/
+import * as Scouts from "./export-expname-from-binding-string.js";
+export { Mercury as "☿" } from "./export-expname_FIXTURE.js";
+
+assert.sameValue(Scouts.Mercury, undefined);
+assert.sameValue(Scouts["☿"], globalThis.Mercury);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/export-expname-from-star-string.js b/js/src/tests/test262/language/module-code/export-expname-from-star-string.js
new file mode 100644
index 0000000000..8c6f2c5c8e
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/export-expname-from-star-string.js
@@ -0,0 +1,23 @@
+// |reftest| module
+// Copyright (C) 2020 Bradley Farias. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ ExportFromClause : `*` `as` ModuleExportName
+ esid: prod-ExportFromClause
+info: |
+ ExportFromClause :
+ `*` `as` ModuleExportName
+
+ ModuleExportName : StringLiteral
+
+flags: [module]
+features: [arbitrary-module-namespace-names]
+---*/
+import * as Scouts from "./export-expname-from-star-string.js";
+export * as "All" from "./export-expname_FIXTURE.js";
+
+assert.sameValue(Scouts["☿"], undefined);
+assert.sameValue(Scouts.All["☿"], globalThis.Mercury);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/export-expname-from-star-unpaired-surrogate.js b/js/src/tests/test262/language/module-code/export-expname-from-star-unpaired-surrogate.js
new file mode 100644
index 0000000000..b271c711af
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/export-expname-from-star-unpaired-surrogate.js
@@ -0,0 +1,22 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2020 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ ExportSpecifier : ModuleExportName
+ esid: prod-ExportSpecifier
+info: |
+ ModuleExportName : StringLiteral
+
+ It is a Syntax Error if IsStringWellFormedUnicode of the StringValue of
+ StringLiteral is *false*.
+flags: [module]
+features: [arbitrary-module-namespace-names]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+export "*" as "\uD83D" from "./export-expname_FIXTURE.js";
diff --git a/js/src/tests/test262/language/module-code/export-expname-from-star.js b/js/src/tests/test262/language/module-code/export-expname-from-star.js
new file mode 100644
index 0000000000..b455111740
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/export-expname-from-star.js
@@ -0,0 +1,20 @@
+// |reftest| module
+// Copyright (C) 2020 Bradley Farias. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ ExportFromClause : `*`
+ esid: prod-ExportFromClause
+info: |
+ ExportFromClause :
+ `*`
+
+flags: [module]
+features: [arbitrary-module-namespace-names]
+---*/
+import * as Scouts from "./export-expname-from-star.js";
+export * from "./export-expname_FIXTURE.js";
+
+assert.sameValue(Scouts["☿"], globalThis.Mercury);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/export-expname-from-string-binding.js b/js/src/tests/test262/language/module-code/export-expname-from-string-binding.js
new file mode 100644
index 0000000000..31d5f22e02
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/export-expname-from-string-binding.js
@@ -0,0 +1,24 @@
+// |reftest| module
+// Copyright (C) 2020 Bradley Farias. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ ExportFromClause : NamedExports
+ esid: prod-ExportFromClause
+info: |
+ ExportFromClause :
+ NamedExports[+From]
+
+ NamedExports[From] :
+ [+From] ModuleExportName as IdentifierName
+
+flags: [module]
+features: [arbitrary-module-namespace-names]
+---*/
+import * as Scouts from "./export-expname-from-string-binding.js";
+export { "☿" as Ami } from "./export-expname_FIXTURE.js";
+
+assert.sameValue(Scouts["☿"], undefined);
+assert.sameValue(Scouts.Ami, globalThis.Mercury);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/export-expname-from-string-string.js b/js/src/tests/test262/language/module-code/export-expname-from-string-string.js
new file mode 100644
index 0000000000..49db039eff
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/export-expname-from-string-string.js
@@ -0,0 +1,24 @@
+// |reftest| module
+// Copyright (C) 2020 Bradley Farias. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ ExportFromClause : NamedExports
+ esid: prod-ExportFromClause
+info: |
+ ExportFromClause :
+ NamedExports[+From]
+
+ NamedExports[From] :
+ [+From] ModuleExportName as ModuleExportName
+
+flags: [module]
+features: [arbitrary-module-namespace-names]
+---*/
+import * as Scouts from "./export-expname-from-string-string.js";
+export { "☿" as "Ami" } from "./export-expname_FIXTURE.js";
+
+assert.sameValue(Scouts["☿"], undefined);
+assert.sameValue(Scouts.Ami, globalThis.Mercury);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/export-expname-from-string.js b/js/src/tests/test262/language/module-code/export-expname-from-string.js
new file mode 100644
index 0000000000..59c5c203a1
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/export-expname-from-string.js
@@ -0,0 +1,25 @@
+// |reftest| module
+// Copyright (C) 2020 Bradley Farias. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ ExportFromClause : NamedExports
+ esid: prod-ExportFromClause
+info: |
+ ExportFromClause :
+ NamedExports[+From]
+
+ NamedExports[From] :
+ [+From] ModuleExportName
+
+ ModuleExportName : StringLiteral
+
+flags: [module]
+features: [arbitrary-module-namespace-names]
+---*/
+import * as Scouts from "./export-expname-from-string.js";
+export { "☿" } from "./export-expname_FIXTURE.js";
+
+assert.sameValue(typeof Scouts["☿"], "function");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/export-expname-from-unpaired-surrogate.js b/js/src/tests/test262/language/module-code/export-expname-from-unpaired-surrogate.js
new file mode 100644
index 0000000000..fea2bc6b40
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/export-expname-from-unpaired-surrogate.js
@@ -0,0 +1,22 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2020 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ ExportSpecifier : ModuleExportName
+ esid: prod-ExportSpecifier
+info: |
+ ModuleExportName : StringLiteral
+
+ It is a Syntax Error if IsStringWellFormedUnicode of the StringValue of
+ StringLiteral is *false*.
+flags: [module]
+features: [arbitrary-module-namespace-names]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+export { "\uD83D" } from "./export-expname_FIXTURE.js";
diff --git a/js/src/tests/test262/language/module-code/export-expname-import-string-binding.js b/js/src/tests/test262/language/module-code/export-expname-import-string-binding.js
new file mode 100644
index 0000000000..d91875af2c
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/export-expname-import-string-binding.js
@@ -0,0 +1,20 @@
+// |reftest| module
+// Copyright (C) 2020 Bradley Farias. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ ImportSpecifier :
+ ModuleExportName `as` IdentifierName
+ esid: prod-ImportSpecifier
+info: |
+ ImportSpecifier :
+ ModuleExportName `as` IdentifierName
+
+flags: [module]
+features: [arbitrary-module-namespace-names]
+---*/
+import { "☿" as Ami } from "./export-expname_FIXTURE.js";
+
+assert.sameValue(Ami, globalThis.Mercury);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/export-expname-import-unpaired-surrogate.js b/js/src/tests/test262/language/module-code/export-expname-import-unpaired-surrogate.js
new file mode 100644
index 0000000000..2cd945d8e9
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/export-expname-import-unpaired-surrogate.js
@@ -0,0 +1,22 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2020 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ ExportSpecifier : ModuleExportName
+ esid: prod-ExportSpecifier
+info: |
+ ModuleExportName : StringLiteral
+
+ It is a Syntax Error if IsStringWellFormedUnicode of the StringValue of
+ StringLiteral is *false*.
+flags: [module]
+features: [arbitrary-module-namespace-names]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+import { "\uD83D" as foo } from "./export-expname_FIXTURE.js";
diff --git a/js/src/tests/test262/language/module-code/export-expname-string-binding.js b/js/src/tests/test262/language/module-code/export-expname-string-binding.js
new file mode 100644
index 0000000000..e7b012dbef
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/export-expname-string-binding.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2020 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ ExportDeclaration : `export` NamedExports `;`
+ esid: sec-exports-static-semantics-early-errors
+info: |
+ ExportDeclaration : `export` NamedExports `;`
+
+ It is a Syntax Error if ReferencedBindings of |NamedExports| contains any
+ |ModuleExportName|.
+flags: [module]
+features: [arbitrary-module-namespace-names]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+export { "foo" as "bar" }
+
+function foo() {}
diff --git a/js/src/tests/test262/language/module-code/export-expname-unpaired-surrogate.js b/js/src/tests/test262/language/module-code/export-expname-unpaired-surrogate.js
new file mode 100644
index 0000000000..e865a14044
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/export-expname-unpaired-surrogate.js
@@ -0,0 +1,25 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2020 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ ExportSpecifier : ModuleExportName
+ esid: prod-ExportSpecifier
+info: |
+ ModuleExportName : StringLiteral
+
+ It is a Syntax Error if IsStringWellFormedUnicode of the StringValue of
+ StringLiteral is *false*.
+flags: [module]
+features: [arbitrary-module-namespace-names]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+export { Foo as "\uD83D" }
+
+function Foo() {}
+
diff --git a/js/src/tests/test262/language/module-code/export-expname_FIXTURE.js b/js/src/tests/test262/language/module-code/export-expname_FIXTURE.js
new file mode 100644
index 0000000000..1ee999da3c
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/export-expname_FIXTURE.js
@@ -0,0 +1,7 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2020 Bradley Farias. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export { Mercury, Mercury as "☿" };
+function Mercury() {}
+globalThis.Mercury = Mercury;
diff --git a/js/src/tests/test262/language/module-code/export-star-as-dflt.js b/js/src/tests/test262/language/module-code/export-star-as-dflt.js
new file mode 100644
index 0000000000..af5f43abd7
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/export-star-as-dflt.js
@@ -0,0 +1,31 @@
+// |reftest| module
+// Copyright (C) 2019 Adrian Heine. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: A default export cannot be provided by an export * or export * from "mod" declaration
+esid: sec-static-semantics-exportentriesformodule
+info: |
+ 15.2..3.6 Static Semantics: ExportEntriesForModule
+
+ [...]
+
+ ExportFromClause : * as IdentifierName
+
+ 1. Let exportName be the StringValue of IdentifierName.
+ 2. Let entry be the ExportEntry Record { [[ModuleRequest]]: module, [[ImportName]]: "*", [[LocalName]]: null, [[ExportName]]: exportName }.
+ 3. Return a new List containing entry.
+
+flags: [module]
+features: [export-star-as-namespace-from-module]
+---*/
+
+export * as default from './export-star-as-dflt_FIXTURE.js';
+import Self from './export-star-as-dflt.js';
+import { default as named } from './export-star-as-dflt.js';
+import * as ns from './export-star-as-dflt.js';
+
+assert.sameValue(Self.x, 1, 'Module was re-exported under the name `default`');
+assert.sameValue(named.x, 1, 'named binding was re-exported under the name `default`');
+assert.sameValue(ns.default.x, 1, 'namespace was re-exported under the name `default`');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/export-star-as-dflt_FIXTURE.js b/js/src/tests/test262/language/module-code/export-star-as-dflt_FIXTURE.js
new file mode 100644
index 0000000000..bc6c27d641
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/export-star-as-dflt_FIXTURE.js
@@ -0,0 +1,5 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2019 Adrian Heine. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export const x = 1;
diff --git a/js/src/tests/test262/language/module-code/import-assertion-1_FIXTURE.js b/js/src/tests/test262/language/module-code/import-assertion-1_FIXTURE.js
new file mode 100644
index 0000000000..ebff110f91
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/import-assertion-1_FIXTURE.js
@@ -0,0 +1,4 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+export default 262.1;
diff --git a/js/src/tests/test262/language/module-code/import-assertion-2_FIXTURE.js b/js/src/tests/test262/language/module-code/import-assertion-2_FIXTURE.js
new file mode 100644
index 0000000000..792c71fd1f
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/import-assertion-2_FIXTURE.js
@@ -0,0 +1,4 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+globalThis.test262 = 262.2;
diff --git a/js/src/tests/test262/language/module-code/import-assertion-3_FIXTURE.js b/js/src/tests/test262/language/module-code/import-assertion-3_FIXTURE.js
new file mode 100644
index 0000000000..300e6564e9
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/import-assertion-3_FIXTURE.js
@@ -0,0 +1,4 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+export default 262.3;
diff --git a/js/src/tests/test262/language/module-code/import-assertion-empty.js b/js/src/tests/test262/language/module-code/import-assertion-empty.js
new file mode 100644
index 0000000000..c4de9d9614
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/import-assertion-empty.js
@@ -0,0 +1,33 @@
+// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) module -- requires shell-options
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: AssertClause in ImportDeclaration may be empty
+esid: sec-modules
+info: |
+ ImportDeclaration:
+ import ModuleSpecifier[no LineTerminator here] AssertClause;
+
+ AssertClause:
+ assert {}
+ assert {AssertEntries ,opt}
+
+ AssertEntries:
+ AssertionKey : StringLiteral
+ AssertionKey : StringLiteral , AssertEntries
+
+ AssertionKey:
+ IdentifierName
+ StringLiteral
+features: [import-assertions, globalThis]
+flags: [module]
+---*/
+
+import x from './import-assertion-1_FIXTURE.js' assert {};
+import './import-assertion-2_FIXTURE.js' assert {};
+export * from './import-assertion-3_FIXTURE.js' assert {};
+
+assert.sameValue(x, 262.1);
+assert.sameValue(globalThis.test262, 262.2);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/import-assertion-key-identifiername.js b/js/src/tests/test262/language/module-code/import-assertion-key-identifiername.js
new file mode 100644
index 0000000000..ae8b5a0392
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/import-assertion-key-identifiername.js
@@ -0,0 +1,34 @@
+// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) module -- requires shell-options
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ AssertClause in ImportDeclaration may use any valid IdentifierName as a key
+esid: sec-modules
+info: |
+ ImportDeclaration:
+ import ModuleSpecifier[no LineTerminator here] AssertClause;
+
+ AssertClause:
+ assert {}
+ assert {AssertEntries ,opt}
+
+ AssertEntries:
+ AssertionKey : StringLiteral
+ AssertionKey : StringLiteral , AssertEntries
+
+ AssertionKey:
+ IdentifierName
+ StringLiteral
+features: [import-assertions]
+flags: [module]
+---*/
+
+import x from './import-assertion-1_FIXTURE.js' assert {if:''};
+import './import-assertion-2_FIXTURE.js' assert {if:''};
+export * from './import-assertion-3_FIXTURE.js' assert {if:''};
+
+assert.sameValue(x, 262.1);
+assert.sameValue(globalThis.test262, 262.2);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/import-assertion-key-string-double.js b/js/src/tests/test262/language/module-code/import-assertion-key-string-double.js
new file mode 100644
index 0000000000..153fbac85b
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/import-assertion-key-string-double.js
@@ -0,0 +1,34 @@
+// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) module -- requires shell-options
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ AssertClause in ImportDeclaration may use a string literal as a key (delimited with U+0022)
+esid: sec-modules
+info: |
+ ImportDeclaration:
+ import ModuleSpecifier[no LineTerminator here] AssertClause;
+
+ AssertClause:
+ assert {}
+ assert {AssertEntries ,opt}
+
+ AssertEntries:
+ AssertionKey : StringLiteral
+ AssertionKey : StringLiteral , AssertEntries
+
+ AssertionKey:
+ IdentifierName
+ StringLiteral
+features: [import-assertions, globalThis]
+flags: [module]
+---*/
+
+import x from './import-assertion-1_FIXTURE.js' assert {"test262\u0078":''};
+import './import-assertion-2_FIXTURE.js' assert {"test262\u0078":''};
+export * from './import-assertion-3_FIXTURE.js' assert {"test262\u0078":''};
+
+assert.sameValue(x, 262.1);
+assert.sameValue(globalThis.test262, 262.2);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/import-assertion-key-string-single.js b/js/src/tests/test262/language/module-code/import-assertion-key-string-single.js
new file mode 100644
index 0000000000..42198c15af
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/import-assertion-key-string-single.js
@@ -0,0 +1,34 @@
+// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) module -- requires shell-options
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ AssertClause in ImportDeclaration may use a string literal as a key (delimited with U+0027)
+esid: sec-modules
+info: |
+ ImportDeclaration:
+ import ModuleSpecifier[no LineTerminator here] AssertClause;
+
+ AssertClause:
+ assert {}
+ assert {AssertEntries ,opt}
+
+ AssertEntries:
+ AssertionKey : StringLiteral
+ AssertionKey : StringLiteral , AssertEntries
+
+ AssertionKey:
+ IdentifierName
+ StringLiteral
+features: [import-assertions, globalThis]
+flags: [module]
+---*/
+
+import x from './import-assertion-1_FIXTURE.js' assert {'test262\u0078':''};
+import './import-assertion-2_FIXTURE.js' assert {'test262\u0078':''};
+export * from './import-assertion-3_FIXTURE.js' assert {'test262\u0078':''};
+
+assert.sameValue(x, 262.1);
+assert.sameValue(globalThis.test262, 262.2);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/import-assertion-many.js b/js/src/tests/test262/language/module-code/import-assertion-many.js
new file mode 100644
index 0000000000..3d9fd4d3b2
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/import-assertion-many.js
@@ -0,0 +1,34 @@
+// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) module -- requires shell-options
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ AssertClause in ImportDeclaration may contain multiple AssertEntries
+esid: sec-modules
+info: |
+ ImportDeclaration:
+ import ModuleSpecifier[no LineTerminator here] AssertClause;
+
+ AssertClause:
+ assert {}
+ assert {AssertEntries ,opt}
+
+ AssertEntries:
+ AssertionKey : StringLiteral
+ AssertionKey : StringLiteral , AssertEntries
+
+ AssertionKey:
+ IdentifierName
+ StringLiteral
+features: [import-assertions, globalThis]
+flags: [module]
+---*/
+
+import x from './import-assertion-1_FIXTURE.js' assert {test262_1:'',test262_2:'',test262_3:'',test262_4:''};
+import './import-assertion-2_FIXTURE.js' assert {test262_1:'',test262_2:'',test262_3:'',test262_4:''};
+export * from './import-assertion-3_FIXTURE.js' assert {test262_1:'',test262_2:'',test262_3:'',test262_4:''};
+
+assert.sameValue(x, 262.1);
+assert.sameValue(globalThis.test262, 262.2);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/import-assertion-newlines.js b/js/src/tests/test262/language/module-code/import-assertion-newlines.js
new file mode 100644
index 0000000000..20960e474d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/import-assertion-newlines.js
@@ -0,0 +1,52 @@
+// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) module -- requires shell-options
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ AssertClause in ImportDeclaration may include line terminators
+esid: sec-modules
+info: |
+ ImportDeclaration:
+ import ModuleSpecifier[no LineTerminator here] AssertClause;
+
+ AssertClause:
+ assert {}
+ assert {AssertEntries ,opt}
+
+ AssertEntries:
+ AssertionKey : StringLiteral
+ AssertionKey : StringLiteral , AssertEntries
+
+ AssertionKey:
+ IdentifierName
+ StringLiteral
+
+ This test uses all four LineFeed characters in order to completely verify the
+ grammar.
+features: [import-assertions, globalThis]
+flags: [module]
+---*/
+
+import x from './import-assertion-1_FIXTURE.js' assert
+ 

{
+ 

test262
+ 

:
+ 

''
+ 

};
+import './import-assertion-2_FIXTURE.js' assert
+ 

{
+ 

test262
+ 

:
+ 

''
+ 

};
+export * from './import-assertion-3_FIXTURE.js' assert
+ 

{
+ 

test262
+ 

:
+ 

''
+ 

};
+
+assert.sameValue(x, 262.1);
+assert.sameValue(globalThis.test262, 262.2);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/import-assertion-trlng-comma.js b/js/src/tests/test262/language/module-code/import-assertion-trlng-comma.js
new file mode 100644
index 0000000000..0fe77a373a
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/import-assertion-trlng-comma.js
@@ -0,0 +1,34 @@
+// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) module -- requires shell-options
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ AssertClause in ImportDeclaration may contain a trailing comma
+esid: sec-modules
+info: |
+ ImportDeclaration:
+ import ModuleSpecifier[no LineTerminator here] AssertClause;
+
+ AssertClause:
+ assert {}
+ assert {AssertEntries ,opt}
+
+ AssertEntries:
+ AssertionKey : StringLiteral
+ AssertionKey : StringLiteral , AssertEntries
+
+ AssertionKey:
+ IdentifierName
+ StringLiteral
+features: [import-assertions, globalThis]
+flags: [module]
+---*/
+
+import x from './import-assertion-1_FIXTURE.js' assert {test262:'',};
+import './import-assertion-2_FIXTURE.js' assert {test262:'',};
+export * from './import-assertion-3_FIXTURE.js' assert {test262:'',};
+
+assert.sameValue(x, 262.1);
+assert.sameValue(globalThis.test262, 262.2);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/import-assertion-value-string-double.js b/js/src/tests/test262/language/module-code/import-assertion-value-string-double.js
new file mode 100644
index 0000000000..98ec1d74b5
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/import-assertion-value-string-double.js
@@ -0,0 +1,34 @@
+// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) module -- requires shell-options
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ AssertClause in ImportDeclaration may use a string literal as a value (delimited with U+0022)
+esid: sec-modules
+info: |
+ ImportDeclaration:
+ import ModuleSpecifier[no LineTerminator here] AssertClause;
+
+ AssertClause:
+ assert {}
+ assert {AssertEntries ,opt}
+
+ AssertEntries:
+ AssertionKey : StringLiteral
+ AssertionKey : StringLiteral , AssertEntries
+
+ AssertionKey:
+ IdentifierName
+ StringLiteral
+features: [import-assertions, globalThis]
+flags: [module]
+---*/
+
+import x from './import-assertion-1_FIXTURE.js' assert {test262:"\u0078"};
+import './import-assertion-2_FIXTURE.js' assert {test262:"\u0078"};
+export * from './import-assertion-3_FIXTURE.js' assert {test262:"\u0078"};
+
+assert.sameValue(x, 262.1);
+assert.sameValue(globalThis.test262, 262.2);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/import-assertion-value-string-single.js b/js/src/tests/test262/language/module-code/import-assertion-value-string-single.js
new file mode 100644
index 0000000000..c98e51bf1d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/import-assertion-value-string-single.js
@@ -0,0 +1,34 @@
+// |reftest| shell-option(--enable-import-assertions) skip-if(!xulRuntime.shell) module -- requires shell-options
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ AssertClause in ImportDeclaration may use a string literal as a value (delimited with U+0027)
+esid: sec-modules
+info: |
+ ImportDeclaration:
+ import ModuleSpecifier[no LineTerminator here] AssertClause;
+
+ AssertClause:
+ assert {}
+ assert {AssertEntries ,opt}
+
+ AssertEntries:
+ AssertionKey : StringLiteral
+ AssertionKey : StringLiteral , AssertEntries
+
+ AssertionKey:
+ IdentifierName
+ StringLiteral
+features: [import-assertions, globalThis]
+flags: [module]
+---*/
+
+import x from './import-assertion-1_FIXTURE.js' assert {test262:'\u0078'};
+import './import-assertion-2_FIXTURE.js' assert {test262:'\u0078'};
+export * from './import-assertion-3_FIXTURE.js' assert {test262:'\u0078'};
+
+assert.sameValue(x, 262.1);
+assert.sameValue(globalThis.test262, 262.2);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-iee-bndng-cls.js b/js/src/tests/test262/language/module-code/instn-iee-bndng-cls.js
new file mode 100644
index 0000000000..521b9c697c
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-iee-bndng-cls.js
@@ -0,0 +1,56 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Imported binding reflects state of indirectly-exported `class` binding
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 12. For each ImportEntry Record in in module.[[ImportEntries]], do
+ a. Let importedModule be ? HostResolveImportedModule(module,
+ in.[[ModuleRequest]]).
+ b. If in.[[ImportName]] is "*", then
+ [...]
+ c. Else,
+ i. Let resolution be ?
+ importedModule.ResolveExport(in.[[ImportName]], « », « »).
+ ii. If resolution is null or resolution is "ambiguous", throw a
+ SyntaxError exception.
+ iii. Call envRec.CreateImportBinding(in.[[LocalName]],
+ resolution.[[Module]], resolution.[[BindingName]]).
+ [...]
+ 16. Let lexDeclarations be the LexicallyScopedDeclarations of code.
+ 17. For each element d in lexDeclarations do
+ a. For each element dn of the BoundNames of d do
+ i, If IsConstantDeclaration of d is true, then
+ [...]
+ ii. Else,
+ 1. Perform ! envRec.CreateMutableBinding(dn, false).
+ iii. If d is a GeneratorDeclaration production or a
+ FunctionDeclaration production, then
+ [...]
+
+ 8.1.1.5.5 CreateImportBinding
+
+ [...]
+ 5. Create an immutable indirect binding in envRec for N that references M
+ and N2 as its target binding and record that the binding is initialized.
+ 6. Return NormalCompletion(empty).
+flags: [module]
+---*/
+
+assert.throws(ReferenceError, function() {
+ typeof B;
+}, 'binding is created but not initialized');
+
+import { B, results } from './instn-iee-bndng-cls_FIXTURE.js';
+export class A {}
+
+assert.sameValue(results.length, 4);
+assert.sameValue(results[0], 'ReferenceError');
+assert.sameValue(results[1], 'undefined');
+assert.sameValue(results[2], 'ReferenceError');
+assert.sameValue(results[3], 'undefined');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-iee-bndng-cls_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-iee-bndng-cls_FIXTURE.js
new file mode 100644
index 0000000000..becf9a23cf
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-iee-bndng-cls_FIXTURE.js
@@ -0,0 +1,22 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export { A as B } from './instn-iee-bndng-cls.js';
+
+// Taken together, the following two assertions demonstrate that there is no
+// entry in the environment record for ImportName:
+export const results = [];
+try {
+ A;
+} catch (error) {
+ results.push(error.name, typeof A);
+}
+
+// Taken together, the following two assertions demonstrate that there is no
+// entry in the environment record for ExportName:
+try {
+ B;
+} catch (error) {
+ results.push(error.name, typeof B);
+}
diff --git a/js/src/tests/test262/language/module-code/instn-iee-bndng-const.js b/js/src/tests/test262/language/module-code/instn-iee-bndng-const.js
new file mode 100644
index 0000000000..0f87b5b4b0
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-iee-bndng-const.js
@@ -0,0 +1,56 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Imported binding reflects state of indirectly-exported `const` binding
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 12. For each ImportEntry Record in in module.[[ImportEntries]], do
+ a. Let importedModule be ? HostResolveImportedModule(module,
+ in.[[ModuleRequest]]).
+ b. If in.[[ImportName]] is "*", then
+ [...]
+ c. Else,
+ i. Let resolution be ?
+ importedModule.ResolveExport(in.[[ImportName]], « », « »).
+ ii. If resolution is null or resolution is "ambiguous", throw a
+ SyntaxError exception.
+ iii. Call envRec.CreateImportBinding(in.[[LocalName]],
+ resolution.[[Module]], resolution.[[BindingName]]).
+ [...]
+ 16. Let lexDeclarations be the LexicallyScopedDeclarations of code.
+ 17. For each element d in lexDeclarations do
+ a. For each element dn of the BoundNames of d do
+ i, If IsConstantDeclaration of d is true, then
+ 1. Perform ! envRec.CreateImmutableBinding(dn, true).
+ ii. Else,
+ 1. Perform ! envRec.CreateMutableBinding(dn, false).
+ iii. If d is a GeneratorDeclaration production or a
+ FunctionDeclaration production, then
+ [...]
+
+ 8.1.1.5.5 CreateImportBinding
+
+ [...]
+ 5. Create an immutable indirect binding in envRec for N that references M
+ and N2 as its target binding and record that the binding is initialized.
+ 6. Return NormalCompletion(empty).
+flags: [module]
+---*/
+
+assert.throws(ReferenceError, function() {
+ typeof B;
+}, 'binding is created but not initialized');
+
+import { B, results } from './instn-iee-bndng-const_FIXTURE.js';
+export const A = null;
+
+assert.sameValue(results.length, 4);
+assert.sameValue(results[0], 'ReferenceError');
+assert.sameValue(results[1], 'undefined');
+assert.sameValue(results[2], 'ReferenceError');
+assert.sameValue(results[3], 'undefined');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-iee-bndng-const_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-iee-bndng-const_FIXTURE.js
new file mode 100644
index 0000000000..1abb547693
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-iee-bndng-const_FIXTURE.js
@@ -0,0 +1,22 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export { A as B } from './instn-iee-bndng-const.js';
+
+// Taken together, the following two assertions demonstrate that there is no
+// entry in the environment record for ImportName:
+export const results = [];
+try {
+ A;
+} catch (error) {
+ results.push(error.name, typeof A);
+}
+
+// Taken together, the following two assertions demonstrate that there is no
+// entry in the environment record for ExportName:
+try {
+ B;
+} catch (error) {
+ results.push(error.name, typeof B);
+}
diff --git a/js/src/tests/test262/language/module-code/instn-iee-bndng-fun.js b/js/src/tests/test262/language/module-code/instn-iee-bndng-fun.js
new file mode 100644
index 0000000000..c121ecee04
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-iee-bndng-fun.js
@@ -0,0 +1,64 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Imported binding reflects state of indirectly-exported function binding
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 12. For each ImportEntry Record in in module.[[ImportEntries]], do
+ a. Let importedModule be ? HostResolveImportedModule(module,
+ in.[[ModuleRequest]]).
+ b. If in.[[ImportName]] is "*", then
+ [...]
+ c. Else,
+ i. Let resolution be ?
+ importedModule.ResolveExport(in.[[ImportName]], « », « »).
+ ii. If resolution is null or resolution is "ambiguous", throw a
+ SyntaxError exception.
+ iii. Call envRec.CreateImportBinding(in.[[LocalName]],
+ resolution.[[Module]], resolution.[[BindingName]]).
+ [...]
+ 16. Let lexDeclarations be the LexicallyScopedDeclarations of code.
+ 17. For each element d in lexDeclarations do
+ a. For each element dn of the BoundNames of d do
+ i, If IsConstantDeclaration of d is true, then
+ [...]
+ ii. Else,
+ 1. Perform ! envRec.CreateMutableBinding(dn, false).
+ iii. If d is a GeneratorDeclaration production or a
+ FunctionDeclaration production, then
+ [...]
+
+ 8.1.1.5.5 CreateImportBinding
+
+ [...]
+ 5. Create an immutable indirect binding in envRec for N that references M
+ and N2 as its target binding and record that the binding is initialized.
+ 6. Return NormalCompletion(empty).
+flags: [module]
+---*/
+
+assert.sameValue(
+ B(),
+ 77,
+ 'binding is initialized to function value prior to module evaluation'
+);
+
+assert.throws(TypeError, function() {
+ B = null;
+}, 'binding rejects assignment');
+
+assert.sameValue(B(), 77, 'binding value is immutable');
+
+import { B, results } from './instn-iee-bndng-fun_FIXTURE.js';
+export function A() { return 77; }
+
+assert.sameValue(results.length, 4);
+assert.sameValue(results[0], 'ReferenceError');
+assert.sameValue(results[1], 'undefined');
+assert.sameValue(results[2], 'ReferenceError');
+assert.sameValue(results[3], 'undefined');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-iee-bndng-fun_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-iee-bndng-fun_FIXTURE.js
new file mode 100644
index 0000000000..aac26ff03e
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-iee-bndng-fun_FIXTURE.js
@@ -0,0 +1,22 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export { A as B } from './instn-iee-bndng-fun.js';
+
+// Taken together, the following two assertions demonstrate that there is no
+// entry in the environment record for ImportName:
+export const results = [];
+try {
+ A;
+} catch (error) {
+ results.push(error.name, typeof A);
+}
+
+// Taken together, the following two assertions demonstrate that there is no
+// entry in the environment record for ExportName:
+try {
+ B;
+} catch (error) {
+ results.push(error.name, typeof B);
+}
diff --git a/js/src/tests/test262/language/module-code/instn-iee-bndng-gen.js b/js/src/tests/test262/language/module-code/instn-iee-bndng-gen.js
new file mode 100644
index 0000000000..51ea4f6001
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-iee-bndng-gen.js
@@ -0,0 +1,66 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Imported binding reflects state of indirectly-exported generator function
+ binding
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 12. For each ImportEntry Record in in module.[[ImportEntries]], do
+ a. Let importedModule be ? HostResolveImportedModule(module,
+ in.[[ModuleRequest]]).
+ b. If in.[[ImportName]] is "*", then
+ [...]
+ c. Else,
+ i. Let resolution be ?
+ importedModule.ResolveExport(in.[[ImportName]], « », « »).
+ ii. If resolution is null or resolution is "ambiguous", throw a
+ SyntaxError exception.
+ iii. Call envRec.CreateImportBinding(in.[[LocalName]],
+ resolution.[[Module]], resolution.[[BindingName]]).
+ [...]
+ 16. Let lexDeclarations be the LexicallyScopedDeclarations of code.
+ 17. For each element d in lexDeclarations do
+ a. For each element dn of the BoundNames of d do
+ i, If IsConstantDeclaration of d is true, then
+ [...]
+ ii. Else,
+ 1. Perform ! envRec.CreateMutableBinding(dn, false).
+ iii. If d is a GeneratorDeclaration production or a
+ FunctionDeclaration production, then
+ [...]
+
+ 8.1.1.5.5 CreateImportBinding
+
+ [...]
+ 5. Create an immutable indirect binding in envRec for N that references M
+ and N2 as its target binding and record that the binding is initialized.
+ 6. Return NormalCompletion(empty).
+flags: [module]
+features: [generators]
+---*/
+
+assert.sameValue(
+ B().next().value,
+ 455,
+ 'binding is initialized to function value prior to module evaluation'
+);
+
+assert.throws(TypeError, function() {
+ B = null;
+});
+
+assert.sameValue(B().next().value, 455, 'binding value is immutable');
+
+import { B, results } from './instn-iee-bndng-gen_FIXTURE.js';
+export function* A () { return 455; }
+
+assert.sameValue(results.length, 4);
+assert.sameValue(results[0], 'ReferenceError');
+assert.sameValue(results[1], 'undefined');
+assert.sameValue(results[2], 'ReferenceError');
+assert.sameValue(results[3], 'undefined');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-iee-bndng-gen_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-iee-bndng-gen_FIXTURE.js
new file mode 100644
index 0000000000..342c78c95f
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-iee-bndng-gen_FIXTURE.js
@@ -0,0 +1,22 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export { A as B } from './instn-iee-bndng-gen.js';
+
+// Taken together, the following two assertions demonstrate that there is no
+// entry in the environment record for ImportName:
+export const results = [];
+try {
+ A;
+} catch (error) {
+ results.push(error.name, typeof A);
+}
+
+// Taken together, the following two assertions demonstrate that there is no
+// entry in the environment record for ExportName:
+try {
+ B;
+} catch (error) {
+ results.push(error.name, typeof B);
+}
diff --git a/js/src/tests/test262/language/module-code/instn-iee-bndng-let.js b/js/src/tests/test262/language/module-code/instn-iee-bndng-let.js
new file mode 100644
index 0000000000..e1b6fcc1d1
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-iee-bndng-let.js
@@ -0,0 +1,56 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Imported binding reflects state of indirectly-exported `let` binding
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 12. For each ImportEntry Record in in module.[[ImportEntries]], do
+ a. Let importedModule be ? HostResolveImportedModule(module,
+ in.[[ModuleRequest]]).
+ b. If in.[[ImportName]] is "*", then
+ [...]
+ c. Else,
+ i. Let resolution be ?
+ importedModule.ResolveExport(in.[[ImportName]], « », « »).
+ ii. If resolution is null or resolution is "ambiguous", throw a
+ SyntaxError exception.
+ iii. Call envRec.CreateImportBinding(in.[[LocalName]],
+ resolution.[[Module]], resolution.[[BindingName]]).
+ [...]
+ 16. Let lexDeclarations be the LexicallyScopedDeclarations of code.
+ 17. For each element d in lexDeclarations do
+ a. For each element dn of the BoundNames of d do
+ i, If IsConstantDeclaration of d is true, then
+ [...]
+ ii. Else,
+ 1. Perform ! envRec.CreateMutableBinding(dn, false).
+ iii. If d is a GeneratorDeclaration production or a
+ FunctionDeclaration production, then
+ [...]
+
+ 8.1.1.5.5 CreateImportBinding
+
+ [...]
+ 5. Create an immutable indirect binding in envRec for N that references M
+ and N2 as its target binding and record that the binding is initialized.
+ 6. Return NormalCompletion(empty).
+flags: [module]
+---*/
+
+assert.throws(ReferenceError, function() {
+ typeof B;
+}, 'binding is created but not initialized');
+
+import { B, results } from './instn-iee-bndng-let_FIXTURE.js';
+export let A;
+
+assert.sameValue(results.length, 4);
+assert.sameValue(results[0], 'ReferenceError');
+assert.sameValue(results[1], 'undefined');
+assert.sameValue(results[2], 'ReferenceError');
+assert.sameValue(results[3], 'undefined');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-iee-bndng-let_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-iee-bndng-let_FIXTURE.js
new file mode 100644
index 0000000000..6405e2b7b0
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-iee-bndng-let_FIXTURE.js
@@ -0,0 +1,22 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export { A as B } from './instn-iee-bndng-let.js';
+
+// Taken together, the following two assertions demonstrate that there is no
+// entry in the environment record for ImportName:
+export const results = [];
+try {
+ A;
+} catch (error) {
+ results.push(error.name, typeof A);
+}
+
+// Taken together, the following two assertions demonstrate that there is no
+// entry in the environment record for ExportName:
+try {
+ B;
+} catch (error) {
+ results.push(error.name, typeof B);
+}
diff --git a/js/src/tests/test262/language/module-code/instn-iee-bndng-var.js b/js/src/tests/test262/language/module-code/instn-iee-bndng-var.js
new file mode 100644
index 0000000000..de956a44e4
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-iee-bndng-var.js
@@ -0,0 +1,65 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Imported binding reflects state of indirectly-exported `var` binding
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 12. For each ImportEntry Record in in module.[[ImportEntries]], do
+ a. Let importedModule be ? HostResolveImportedModule(module,
+ in.[[ModuleRequest]]).
+ b. If in.[[ImportName]] is "*", then
+ [...]
+ c. Else,
+ i. Let resolution be ?
+ importedModule.ResolveExport(in.[[ImportName]], « », « »).
+ ii. If resolution is null or resolution is "ambiguous", throw a
+ SyntaxError exception.
+ iii. Call envRec.CreateImportBinding(in.[[LocalName]],
+ resolution.[[Module]], resolution.[[BindingName]]).
+ [...]
+ 16. Let lexDeclarations be the LexicallyScopedDeclarations of code.
+ 17. For each element d in lexDeclarations do
+ a. For each element dn of the BoundNames of d do
+ i, If IsConstantDeclaration of d is true, then
+ [...]
+ ii. Else,
+ 1. Perform ! envRec.CreateMutableBinding(dn, false).
+ iii. If d is a GeneratorDeclaration production or a
+ FunctionDeclaration production, then
+ [...]
+
+ 8.1.1.5.5 CreateImportBinding
+
+ [...]
+ 5. Create an immutable indirect binding in envRec for N that references M
+ and N2 as its target binding and record that the binding is initialized.
+ 6. Return NormalCompletion(empty).
+flags: [module]
+---*/
+
+assert.sameValue(
+ B,
+ undefined,
+ 'binding is initialized to `undefined` prior to module evaulation'
+);
+
+assert.throws(TypeError, function() {
+ B = null;
+}, 'binding rejects assignment');
+
+assert.sameValue(B, undefined, 'binding value is immutable');
+
+import { B, results } from './instn-iee-bndng-var_FIXTURE.js';
+export var A = 99;
+
+assert.sameValue(results.length, 4);
+assert.sameValue(results[0], 'ReferenceError');
+assert.sameValue(results[1], 'undefined');
+assert.sameValue(results[2], 'ReferenceError');
+assert.sameValue(results[3], 'undefined');
+
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-iee-bndng-var_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-iee-bndng-var_FIXTURE.js
new file mode 100644
index 0000000000..395bcdc282
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-iee-bndng-var_FIXTURE.js
@@ -0,0 +1,22 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export { A as B } from './instn-iee-bndng-var.js';
+
+// Taken together, the following two assertions demonstrate that there is no
+// entry in the environment record for ImportName:
+export const results = [];
+try {
+ A;
+} catch (error) {
+ results.push(error.name, typeof A);
+}
+
+// Taken together, the following two assertions demonstrate that there is no
+// entry in the environment record for ExportName:
+try {
+ B;
+} catch (error) {
+ results.push(error.name, typeof B);
+}
diff --git a/js/src/tests/test262/language/module-code/instn-iee-err-ambiguous-1_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-iee-err-ambiguous-1_FIXTURE.js
new file mode 100644
index 0000000000..6a4a7279cf
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-iee-err-ambiguous-1_FIXTURE.js
@@ -0,0 +1,5 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export var x;
diff --git a/js/src/tests/test262/language/module-code/instn-iee-err-ambiguous-2_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-iee-err-ambiguous-2_FIXTURE.js
new file mode 100644
index 0000000000..6a4a7279cf
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-iee-err-ambiguous-2_FIXTURE.js
@@ -0,0 +1,5 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export var x;
diff --git a/js/src/tests/test262/language/module-code/instn-iee-err-ambiguous-as.js b/js/src/tests/test262/language/module-code/instn-iee-err-ambiguous-as.js
new file mode 100644
index 0000000000..60c728aeb2
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-iee-err-ambiguous-as.js
@@ -0,0 +1,40 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: IndirectExportEntries validation - ambiguous imported bindings
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do
+ a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »).
+ b. If resolution is null or resolution is "ambiguous", throw a
+ SyntaxError exception.
+ [...]
+
+ 15.2.1.16.3 ResolveExport
+
+ [...]
+ 9. Let starResolution be null.
+ 10. For each ExportEntry Record e in module.[[StarExportEntries]], do
+ a. Let importedModule be ? HostResolveImportedModule(module,
+ e.[[ModuleRequest]]).
+ b. Let resolution be ? importedModule.ResolveExport(exportName,
+ resolveSet, exportStarSet).
+ c. If resolution is "ambiguous", return "ambiguous".
+ d. If resolution is not null, then
+ i. If starResolution is null, let starResolution be resolution.
+ ii. Else,
+ 1. Assert: there is more than one * import that includes the
+ requested name.
+ 2. If resolution.[[Module]] and starResolution.[[Module]] are
+ not the same Module Record or
+ SameValue(resolution.[[BindingName]],
+ starResolution.[[BindingName]]) is false, return "ambiguous".
+negative:
+ phase: runtime
+ type: SyntaxError
+flags: [module]
+---*/
+
+export { x as y } from './instn-iee-err-ambiguous_FIXTURE.js';
diff --git a/js/src/tests/test262/language/module-code/instn-iee-err-ambiguous.js b/js/src/tests/test262/language/module-code/instn-iee-err-ambiguous.js
new file mode 100644
index 0000000000..bb98893823
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-iee-err-ambiguous.js
@@ -0,0 +1,40 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: IndirectExportEntries validation - ambiguous imported bindings
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do
+ a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »).
+ b. If resolution is null or resolution is "ambiguous", throw a
+ SyntaxError exception.
+ [...]
+
+ 15.2.1.16.3 ResolveExport
+
+ [...]
+ 9. Let starResolution be null.
+ 10. For each ExportEntry Record e in module.[[StarExportEntries]], do
+ a. Let importedModule be ? HostResolveImportedModule(module,
+ e.[[ModuleRequest]]).
+ b. Let resolution be ? importedModule.ResolveExport(exportName,
+ resolveSet, exportStarSet).
+ c. If resolution is "ambiguous", return "ambiguous".
+ d. If resolution is not null, then
+ i. If starResolution is null, let starResolution be resolution.
+ ii. Else,
+ 1. Assert: there is more than one * import that includes the
+ requested name.
+ 2. If resolution.[[Module]] and starResolution.[[Module]] are
+ not the same Module Record or
+ SameValue(resolution.[[BindingName]],
+ starResolution.[[BindingName]]) is false, return "ambiguous".
+negative:
+ phase: runtime
+ type: SyntaxError
+flags: [module]
+---*/
+
+export { x } from './instn-iee-err-ambiguous_FIXTURE.js';
diff --git a/js/src/tests/test262/language/module-code/instn-iee-err-ambiguous_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-iee-err-ambiguous_FIXTURE.js
new file mode 100644
index 0000000000..4b3b26c4af
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-iee-err-ambiguous_FIXTURE.js
@@ -0,0 +1,6 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export * from './instn-iee-err-ambiguous-1_FIXTURE.js';
+export * from './instn-iee-err-ambiguous-2_FIXTURE.js';
diff --git a/js/src/tests/test262/language/module-code/instn-iee-err-circular-as.js b/js/src/tests/test262/language/module-code/instn-iee-err-circular-as.js
new file mode 100644
index 0000000000..a7a3c9bd9e
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-iee-err-circular-as.js
@@ -0,0 +1,29 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: IndirectExportEntries validation - circular imported bindings
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do
+ a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »).
+ b. If resolution is null or resolution is "ambiguous", throw a
+ SyntaxError exception.
+ [...]
+
+ 15.2.1.16.3 ResolveExport
+
+ [...]
+ 2. For each Record {[[Module]], [[ExportName]]} r in resolveSet, do:
+ a. If module and r.[[Module]] are the same Module Record and
+ SameValue(exportName, r.[[ExportName]]) is true, then
+ i. Assert: this is a circular import request.
+ ii. Return null.
+negative:
+ phase: runtime
+ type: SyntaxError
+flags: [module]
+---*/
+
+export { x as y } from './instn-iee-err-circular_FIXTURE.js';
diff --git a/js/src/tests/test262/language/module-code/instn-iee-err-circular.js b/js/src/tests/test262/language/module-code/instn-iee-err-circular.js
new file mode 100644
index 0000000000..70ae1901b4
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-iee-err-circular.js
@@ -0,0 +1,29 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: IndirectExportEntries validation - circular imported bindings
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do
+ a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »).
+ b. If resolution is null or resolution is "ambiguous", throw a
+ SyntaxError exception.
+ [...]
+
+ 15.2.1.16.3 ResolveExport
+
+ [...]
+ 2. For each Record {[[Module]], [[ExportName]]} r in resolveSet, do:
+ a. If module and r.[[Module]] are the same Module Record and
+ SameValue(exportName, r.[[ExportName]]) is true, then
+ i. Assert: this is a circular import request.
+ ii. Return null.
+negative:
+ phase: runtime
+ type: SyntaxError
+flags: [module]
+---*/
+
+export { x } from './instn-iee-err-circular_FIXTURE.js';
diff --git a/js/src/tests/test262/language/module-code/instn-iee-err-circular_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-iee-err-circular_FIXTURE.js
new file mode 100644
index 0000000000..6261ae866a
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-iee-err-circular_FIXTURE.js
@@ -0,0 +1,5 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export { x } from './instn-iee-err-circular.js';
diff --git a/js/src/tests/test262/language/module-code/instn-iee-err-dflt-thru-star-as.js b/js/src/tests/test262/language/module-code/instn-iee-err-dflt-thru-star-as.js
new file mode 100644
index 0000000000..25efb1cd5c
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-iee-err-dflt-thru-star-as.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: IndirectExportEntries validation - default not found (excluding *)
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do
+ a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »).
+ b. If resolution is null or resolution is "ambiguous", throw a
+ SyntaxError exception.
+ [...]
+
+ 15.2.1.16.3 ResolveExport
+
+ [...]
+ 6. If SameValue(exportName, "default") is true, then
+ a. Assert: A default export was not explicitly defined by this module.
+ b. Throw a SyntaxError exception.
+ c. NOTE A default export cannot be provided by an export *.
+negative:
+ phase: runtime
+ type: SyntaxError
+flags: [module]
+---*/
+
+export { default as x } from './instn-iee-err-dflt-thru-star-int_FIXTURE.js';
diff --git a/js/src/tests/test262/language/module-code/instn-iee-err-dflt-thru-star-dflt_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-iee-err-dflt-thru-star-dflt_FIXTURE.js
new file mode 100644
index 0000000000..02bf016b74
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-iee-err-dflt-thru-star-dflt_FIXTURE.js
@@ -0,0 +1,6 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+var x;
+export { x as default };
diff --git a/js/src/tests/test262/language/module-code/instn-iee-err-dflt-thru-star-int_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-iee-err-dflt-thru-star-int_FIXTURE.js
new file mode 100644
index 0000000000..f8778c54ea
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-iee-err-dflt-thru-star-int_FIXTURE.js
@@ -0,0 +1,5 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export * from './instn-iee-err-dflt-thru-star-dflt_FIXTURE.js';
diff --git a/js/src/tests/test262/language/module-code/instn-iee-err-dflt-thru-star.js b/js/src/tests/test262/language/module-code/instn-iee-err-dflt-thru-star.js
new file mode 100644
index 0000000000..c2d713b646
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-iee-err-dflt-thru-star.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: IndirectExportEntries validation - default not found (excluding *)
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do
+ a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »).
+ b. If resolution is null or resolution is "ambiguous", throw a
+ SyntaxError exception.
+ [...]
+
+ 15.2.1.16.3 ResolveExport
+
+ [...]
+ 6. If SameValue(exportName, "default") is true, then
+ a. Assert: A default export was not explicitly defined by this module.
+ b. Throw a SyntaxError exception.
+ c. NOTE A default export cannot be provided by an export *.
+negative:
+ phase: runtime
+ type: SyntaxError
+flags: [module]
+---*/
+
+export { default } from './instn-iee-err-dflt-thru-star-int_FIXTURE.js';
diff --git a/js/src/tests/test262/language/module-code/instn-iee-err-not-found-as.js b/js/src/tests/test262/language/module-code/instn-iee-err-not-found-as.js
new file mode 100644
index 0000000000..04ee9d14f0
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-iee-err-not-found-as.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: IndirectExportEntries validation - undefined imported bindings
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do
+ a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »).
+ b. If resolution is null or resolution is "ambiguous", throw a
+ SyntaxError exception.
+ [...]
+
+ 15.2.1.16.3 ResolveExport
+
+ [...]
+ 9. Let starResolution be null.
+ 10. For each ExportEntry Record e in module.[[StarExportEntries]], do
+ [...]
+ 11. Return starResolution.
+negative:
+ phase: runtime
+ type: SyntaxError
+flags: [module]
+---*/
+
+export { x as y } from './instn-iee-err-not-found-empty_FIXTURE.js';
diff --git a/js/src/tests/test262/language/module-code/instn-iee-err-not-found-empty_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-iee-err-not-found-empty_FIXTURE.js
new file mode 100644
index 0000000000..6f2382ca5a
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-iee-err-not-found-empty_FIXTURE.js
@@ -0,0 +1,5 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+;
diff --git a/js/src/tests/test262/language/module-code/instn-iee-err-not-found.js b/js/src/tests/test262/language/module-code/instn-iee-err-not-found.js
new file mode 100644
index 0000000000..324e1a9a1c
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-iee-err-not-found.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: IndirectExportEntries validation - undefined imported bindings
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do
+ a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »).
+ b. If resolution is null or resolution is "ambiguous", throw a
+ SyntaxError exception.
+ [...]
+
+ 15.2.1.16.3 ResolveExport
+
+ [...]
+ 9. Let starResolution be null.
+ 10. For each ExportEntry Record e in module.[[StarExportEntries]], do
+ [...]
+ 11. Return starResolution.
+negative:
+ phase: runtime
+ type: SyntaxError
+flags: [module]
+---*/
+
+export { x } from './instn-iee-err-not-found-empty_FIXTURE.js';
diff --git a/js/src/tests/test262/language/module-code/instn-iee-iee-cycle-2_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-iee-iee-cycle-2_FIXTURE.js
new file mode 100644
index 0000000000..c550620327
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-iee-iee-cycle-2_FIXTURE.js
@@ -0,0 +1,17 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export { b as a } from './instn-iee-iee-cycle.js';
+export { d as c } from './instn-iee-iee-cycle.js';
+export { f as e } from './instn-iee-iee-cycle.js';
+export { h as g } from './instn-iee-iee-cycle.js';
+export { j as i } from './instn-iee-iee-cycle.js';
+export { l as k } from './instn-iee-iee-cycle.js';
+export { n as m } from './instn-iee-iee-cycle.js';
+export { p as o } from './instn-iee-iee-cycle.js';
+export { r as q } from './instn-iee-iee-cycle.js';
+export { t as s } from './instn-iee-iee-cycle.js';
+export { v as u } from './instn-iee-iee-cycle.js';
+export { x as w } from './instn-iee-iee-cycle.js';
+export { z as y } from './instn-iee-iee-cycle.js';
diff --git a/js/src/tests/test262/language/module-code/instn-iee-iee-cycle.js b/js/src/tests/test262/language/module-code/instn-iee-iee-cycle.js
new file mode 100644
index 0000000000..0adf22bbff
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-iee-iee-cycle.js
@@ -0,0 +1,52 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ There are no restrictions on the number of cycles during module traversal
+ during indirect export resolution, given unique export names.
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do
+ a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »).
+ b. If resolution is null or resolution is "ambiguous", throw a
+ SyntaxError exception.
+
+ 15.2.1.16.3 ResolveExport( exportName, resolveSet, exportStarSet )
+
+ 2. For each Record {[[Module]], [[ExportName]]} r in resolveSet, do:
+ a. If module and r.[[Module]] are the same Module Record and
+ SameValue(exportName, r.[[ExportName]]) is true, then
+ i. Assert: this is a circular import request.
+ ii. Return null.
+ 3. Append the Record {[[Module]]: module, [[ExportName]]: exportName} to resolveSet.
+ [...]
+ 5. For each ExportEntry Record e in module.[[IndirectExportEntries]], do
+ a. If SameValue(exportName, e.[[ExportName]]) is true, then
+ i. Assert: module imports a specific binding for this export.
+ ii. Let importedModule be ? HostResolveImportedModule(module,
+ e.[[ModuleRequest]]).
+ iii. Let indirectResolution be ?
+ importedModule.ResolveExport(e.[[ImportName]], resolveSet,
+ exportStarSet).
+ iv. If indirectResolution is not null, return indirectResolution.
+flags: [module]
+---*/
+
+export { a } from './instn-iee-iee-cycle-2_FIXTURE.js';
+export { c as b } from './instn-iee-iee-cycle-2_FIXTURE.js';
+export { e as d } from './instn-iee-iee-cycle-2_FIXTURE.js';
+export { g as f } from './instn-iee-iee-cycle-2_FIXTURE.js';
+export { i as h } from './instn-iee-iee-cycle-2_FIXTURE.js';
+export { k as j } from './instn-iee-iee-cycle-2_FIXTURE.js';
+export { m as l } from './instn-iee-iee-cycle-2_FIXTURE.js';
+export { o as n } from './instn-iee-iee-cycle-2_FIXTURE.js';
+export { q as p } from './instn-iee-iee-cycle-2_FIXTURE.js';
+export { s as r } from './instn-iee-iee-cycle-2_FIXTURE.js';
+export { u as t } from './instn-iee-iee-cycle-2_FIXTURE.js';
+export { w as v } from './instn-iee-iee-cycle-2_FIXTURE.js';
+export { y as x } from './instn-iee-iee-cycle-2_FIXTURE.js';
+export var z;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-iee-star-cycle-2_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-iee-star-cycle-2_FIXTURE.js
new file mode 100644
index 0000000000..a253acf5a8
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-iee-star-cycle-2_FIXTURE.js
@@ -0,0 +1,5 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export * from './instn-iee-star-cycle-indirect-x_FIXTURE.js';
diff --git a/js/src/tests/test262/language/module-code/instn-iee-star-cycle-indirect-x_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-iee-star-cycle-indirect-x_FIXTURE.js
new file mode 100644
index 0000000000..af7e63d101
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-iee-star-cycle-indirect-x_FIXTURE.js
@@ -0,0 +1,9 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+// This module is visited two times:
+// First when resolving the "x" binding and then another time to resolve the
+// "y" binding.
+export { y as x } from './instn-iee-star-cycle-2_FIXTURE.js';
+export var y = 45;
diff --git a/js/src/tests/test262/language/module-code/instn-iee-star-cycle.js b/js/src/tests/test262/language/module-code/instn-iee-star-cycle.js
new file mode 100644
index 0000000000..e13e42f94c
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-iee-star-cycle.js
@@ -0,0 +1,46 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Modules can be visited more than once when resolving bindings through
+ "star" exports as long as the exportName is different each time.
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do
+ a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »).
+ [...]
+
+ 15.2.1.16.3 ResolveExport( exportName, resolveSet )
+
+ [...]
+ 3. Append the Record {[[Module]]: module, [[ExportName]]: exportName} to resolveSet.
+ 4. For each ExportEntry Record e in module.[[LocalExportEntries]], do
+ a. If SameValue(exportName, e.[[ExportName]]) is true, then
+ i. Assert: module provides the direct binding for this export.
+ ii. Return Record{[[Module]]: module, [[BindingName]]: e.[[LocalName]]}.
+ 5. For each ExportEntry Record e in module.[[IndirectExportEntries]], do
+ a. If SameValue(exportName, e.[[ExportName]]) is true, then
+ i. Assert: module imports a specific binding for this export.
+ ii. Let importedModule be ? HostResolveImportedModule(module, e.[[ModuleRequest]]).
+ iii. Return ? importedModule.ResolveExport(e.[[ImportName]], resolveSet).
+ [...]
+ 8. For each ExportEntry Record e in module.[[StarExportEntries]], do
+ a. Let importedModule be ? HostResolveImportedModule(module, e.[[ModuleRequest]]).
+ b. Let resolution be ? importedModule.ResolveExport(exportName, resolveSet).
+ [...]
+ d. If resolution is not null, then
+ i. If starResolution is null, let starResolution be resolution.
+ [...]
+ 9. Return starResolution.
+flags: [module]
+---*/
+
+export { x } from './instn-iee-star-cycle-2_FIXTURE.js';
+
+import * as self from './instn-iee-star-cycle.js';
+
+assert.sameValue(self.x, 45);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-iee-trlng-comma.js b/js/src/tests/test262/language/module-code/instn-iee-trlng-comma.js
new file mode 100644
index 0000000000..175e5ddbc0
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-iee-trlng-comma.js
@@ -0,0 +1,24 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ ExportsList in ExportDeclaration may include a trailing comma
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 9. For each ExportEntry Record e in module.[[IndirectExportEntries]], do
+ a. Let resolution be ? module.ResolveExport(e.[[ExportName]], « », « »).
+ [...]
+flags: [module]
+---*/
+
+export { a , } from './instn-iee-trlng-comma_FIXTURE.js';
+export { a as b , } from './instn-iee-trlng-comma_FIXTURE.js';
+
+import { a, b } from './instn-iee-trlng-comma.js';
+
+assert.sameValue(a, 333, 'comma following named export');
+assert.sameValue(b, 333, 'comma following re-named export');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-iee-trlng-comma_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-iee-trlng-comma_FIXTURE.js
new file mode 100644
index 0000000000..fa2e8e8a36
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-iee-trlng-comma_FIXTURE.js
@@ -0,0 +1,5 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export var a = 333;
diff --git a/js/src/tests/test262/language/module-code/instn-local-bndng-cls.js b/js/src/tests/test262/language/module-code/instn-local-bndng-cls.js
new file mode 100644
index 0000000000..22b7b25725
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-local-bndng-cls.js
@@ -0,0 +1,47 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Mutable bindings are created in the lexical environment record prior to
+ execution for class declarations
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 17. For each element d in lexDeclarations do
+ a. For each element dn of the BoundNames of d do
+ i. If IsConstantDeclaration of d is true, then
+ [...]
+ ii. Else,
+ 1. Perform ! envRec.CreateMutableBinding(dn, false).
+ [...]
+includes: [fnGlobalObject.js]
+flags: [module]
+---*/
+
+var global = fnGlobalObject();
+
+assert.throws(ReferenceError, function() {
+ typeof test262;
+}, 'Binding is created but not initialized.');
+assert.sameValue(
+ Object.getOwnPropertyDescriptor(global, 'test262'), undefined
+);
+
+class test262 {}
+
+assert.sameValue(typeof test262, 'function');
+assert.sameValue(
+ Object.getOwnPropertyDescriptor(global, 'test262'), undefined
+);
+
+test262 = null;
+
+assert.sameValue(test262, null, 'binding is mutable');
+assert.sameValue(
+ Object.getOwnPropertyDescriptor(global, 'test262'),
+ undefined,
+ 'global binding is not effected by modification'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-local-bndng-const.js b/js/src/tests/test262/language/module-code/instn-local-bndng-const.js
new file mode 100644
index 0000000000..1ca1c897df
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-local-bndng-const.js
@@ -0,0 +1,47 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Mutable bindings are created in the lexical environment record prior to
+ execution for `const` declarations
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 17. For each element d in lexDeclarations do
+ a. For each element dn of the BoundNames of d do
+ i. If IsConstantDeclaration of d is true, then
+ 1. Perform ! envRec.CreateImmutableBinding(dn, true).
+ [...]
+includes: [fnGlobalObject.js]
+flags: [module]
+---*/
+
+var global = fnGlobalObject();
+
+assert.throws(ReferenceError, function() {
+ typeof test262;
+}, 'Binding is created but not initialized.');
+assert.sameValue(
+ Object.getOwnPropertyDescriptor(global, 'test262'), undefined
+);
+
+const test262 = 23;
+
+assert.sameValue(test262, 23);
+assert.sameValue(
+ Object.getOwnPropertyDescriptor(global, 'test262'), undefined
+);
+
+assert.throws(TypeError, function() {
+ test262 = null;
+});
+
+assert.sameValue(test262, 23, 'binding is not mutable');
+assert.sameValue(
+ Object.getOwnPropertyDescriptor(global, 'test262'),
+ undefined,
+ 'global binding is not effected by attempts to modify'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-local-bndng-export-cls.js b/js/src/tests/test262/language/module-code/instn-local-bndng-export-cls.js
new file mode 100644
index 0000000000..833594af2e
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-local-bndng-export-cls.js
@@ -0,0 +1,33 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Binding is created and initialized to `undefined` for exported `class`
+ declarations
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 17. For each element d in lexDeclarations do
+ a. For each element dn of the BoundNames of d do
+ i. If IsConstantDeclaration of d is true, then
+ [...]
+ ii. Else,
+ 1. Perform ! envRec.CreateMutableBinding(dn, false).
+ [...]
+includes: [fnGlobalObject.js]
+flags: [module]
+---*/
+
+var global = fnGlobalObject();
+
+assert.throws(ReferenceError, function() {
+ typeof test262;
+}, 'Binding is created but not initialized.');
+assert.sameValue(
+ Object.getOwnPropertyDescriptor(global, 'test262'), undefined
+);
+
+export class test262 {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-local-bndng-export-const.js b/js/src/tests/test262/language/module-code/instn-local-bndng-export-const.js
new file mode 100644
index 0000000000..28ed846fd5
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-local-bndng-export-const.js
@@ -0,0 +1,32 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Binding is created but not initialized for exported `const` statements
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 17. For each element d in lexDeclarations do
+ a. For each element dn of the BoundNames of d do
+ i. If IsConstantDeclaration of d is true, then
+ [...]
+ ii. Else,
+ 1. Perform ! envRec.CreateMutableBinding(dn, false).
+ [...]
+includes: [fnGlobalObject.js]
+flags: [module]
+---*/
+
+var global = fnGlobalObject();
+
+assert.throws(ReferenceError, function() {
+ typeof test262;
+}, 'Binding is created but not initialized.');
+assert.sameValue(
+ Object.getOwnPropertyDescriptor(global, 'test262'), undefined
+);
+
+export const test262 = 23;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-local-bndng-export-fun.js b/js/src/tests/test262/language/module-code/instn-local-bndng-export-fun.js
new file mode 100644
index 0000000000..1411cb991b
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-local-bndng-export-fun.js
@@ -0,0 +1,35 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Binding is created and initialized to `undefined` for exported function
+ declarations
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 17. For each element d in lexDeclarations do
+ a. For each element dn of the BoundNames of d do
+ i. If IsConstantDeclaration of d is true, then
+ [...]
+ ii. Else,
+ 1. Perform ! envRec.CreateMutableBinding(dn, false).
+ [...]
+includes: [fnGlobalObject.js]
+flags: [module]
+---*/
+
+var global = fnGlobalObject();
+
+assert.sameValue(test262(), 23, 'initialized value');
+assert.sameValue(
+ Object.getOwnPropertyDescriptor(global, 'test262'), undefined
+);
+
+test262 = null;
+
+assert.sameValue(test262, null, 'binding is mutable');
+
+export function test262() { return 23; }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-local-bndng-export-gen.js b/js/src/tests/test262/language/module-code/instn-local-bndng-export-gen.js
new file mode 100644
index 0000000000..3640cd38e3
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-local-bndng-export-gen.js
@@ -0,0 +1,35 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Binding is created and initialized to `undefined` for exported generator
+ function declarations
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 17. For each element d in lexDeclarations do
+ a. For each element dn of the BoundNames of d do
+ i. If IsConstantDeclaration of d is true, then
+ [...]
+ ii. Else,
+ 1. Perform ! envRec.CreateMutableBinding(dn, false).
+ [...]
+includes: [fnGlobalObject.js]
+flags: [module]
+---*/
+
+var global = fnGlobalObject();
+
+assert.sameValue(test262().next().value, 23, 'initialized value');
+assert.sameValue(
+ Object.getOwnPropertyDescriptor(global, 'test262'), undefined
+);
+
+test262 = null;
+
+assert.sameValue(test262, null, 'binding is mutable');
+
+export function* test262() { return 23; }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-local-bndng-export-let.js b/js/src/tests/test262/language/module-code/instn-local-bndng-export-let.js
new file mode 100644
index 0000000000..b7f4736765
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-local-bndng-export-let.js
@@ -0,0 +1,32 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Binding is created but not initialized for exported `let` statements
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 17. For each element d in lexDeclarations do
+ a. For each element dn of the BoundNames of d do
+ i. If IsConstantDeclaration of d is true, then
+ [...]
+ ii. Else,
+ 1. Perform ! envRec.CreateMutableBinding(dn, false).
+ [...]
+includes: [fnGlobalObject.js]
+flags: [module]
+---*/
+
+var global = fnGlobalObject();
+
+assert.throws(ReferenceError, function() {
+ typeof test262;
+}, 'Binding is created but not initialized.');
+assert.sameValue(
+ Object.getOwnPropertyDescriptor(global, 'test262'), undefined
+);
+
+export let test262 = 23;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-local-bndng-export-var.js b/js/src/tests/test262/language/module-code/instn-local-bndng-export-var.js
new file mode 100644
index 0000000000..5fde361d14
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-local-bndng-export-var.js
@@ -0,0 +1,35 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Binding is created and initialized to `undefined` for exported `var`
+ declarations
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 17. For each element d in lexDeclarations do
+ a. For each element dn of the BoundNames of d do
+ i. If IsConstantDeclaration of d is true, then
+ [...]
+ ii. Else,
+ 1. Perform ! envRec.CreateMutableBinding(dn, false).
+ [...]
+includes: [fnGlobalObject.js]
+flags: [module]
+---*/
+
+var global = fnGlobalObject();
+
+assert.sameValue(test262, undefined, 'initialized value');
+assert.sameValue(
+ Object.getOwnPropertyDescriptor(global, 'test262'), undefined
+);
+
+test262 = null;
+
+assert.sameValue(test262, null, 'binding is mutable');
+
+export var test262 = 23;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-local-bndng-for-dup.js b/js/src/tests/test262/language/module-code/instn-local-bndng-for-dup.js
new file mode 100644
index 0000000000..fc07a17142
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-local-bndng-for-dup.js
@@ -0,0 +1,26 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Only one attempt is made to create a binding for any number of variable
+ declarations within `for` statements
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 13. Let varDeclarations be the VarScopedDeclarations of code.
+ 14. Let declaredVarNames be a new empty List.
+ 15. For each element d in varDeclarations do
+ a. For each element dn of the BoundNames of d do
+ i. If dn is not an element of declaredVarNames, then
+ 1. Perform ! envRec.CreateMutableBinding(dn, false).
+ [...]
+ 3. Append dn to declaredVarNames.
+ [...]
+flags: [module]
+---*/
+
+for (var test262; false; ) {}
+for (var test262; false; ) {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-local-bndng-for.js b/js/src/tests/test262/language/module-code/instn-local-bndng-for.js
new file mode 100644
index 0000000000..179294b83b
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-local-bndng-for.js
@@ -0,0 +1,39 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Mutable bindings are initialized in the lexical environment record prior to
+ execution for variable declarations within `for` statements
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 13. Let varDeclarations be the VarScopedDeclarations of code.
+ 14. Let declaredVarNames be a new empty List.
+ 15. For each element d in varDeclarations do
+ a. For each element dn of the BoundNames of d do
+ i. If dn is not an element of declaredVarNames, then
+ 1. Perform ! envRec.CreateMutableBinding(dn, false).
+ 2. Call envRec.InitializeBinding(dn, undefined).
+ [...]
+includes: [fnGlobalObject.js]
+flags: [module]
+---*/
+
+var global = fnGlobalObject();
+
+assert.sameValue(test262, undefined, 'value is initialized to `undefined`');
+assert.sameValue(
+ Object.getOwnPropertyDescriptor(global, 'test262'), undefined
+);
+
+for (var test262 = null; false; ) {}
+
+assert.sameValue(test262, null, 'binding is mutable');
+assert.sameValue(
+ Object.getOwnPropertyDescriptor(global, 'test262'),
+ undefined,
+ 'global binding is not effected by evaluation of declaration'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-local-bndng-fun.js b/js/src/tests/test262/language/module-code/instn-local-bndng-fun.js
new file mode 100644
index 0000000000..990fa9d1ce
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-local-bndng-fun.js
@@ -0,0 +1,52 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Mutable bindings are initialized in the lexical environment record prior to
+ execution for function declarations
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 17. For each element d in lexDeclarations do
+ a. For each element dn of the BoundNames of d do
+ i. If IsConstantDeclaration of d is true, then
+ [...]
+ ii. Else,
+ 1. Perform ! envRec.CreateMutableBinding(dn, false).
+ iii. If d is a GeneratorDeclaration production or a
+ FunctionDeclaration production, then
+ 1. Let fo be the result of performing InstantiateFunctionObject
+ for d with argument env.
+ 2. Call envRec.InitializeBinding(dn, fo).
+ [...]
+includes: [fnGlobalObject.js]
+flags: [module]
+---*/
+
+var global = fnGlobalObject();
+
+assert.sameValue(typeof test262, 'function', 'function value is hoisted');
+assert.sameValue(test262(), 'test262', 'hoisted function value is correct');
+assert.sameValue(
+ Object.getOwnPropertyDescriptor(global, 'test262'), undefined
+);
+
+test262 = null;
+assert.sameValue(test262, null, 'binding is mutable');
+assert.sameValue(
+ Object.getOwnPropertyDescriptor(global, 'test262'), undefined
+);
+
+function test262() { return 'test262'; }
+
+assert.sameValue(
+ test262, null, 'binding is not effected by evaluation of declaration'
+);
+assert.sameValue(
+ Object.getOwnPropertyDescriptor(global, 'test262'),
+ undefined,
+ 'global binding is not effected by evaluation of declaration'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-local-bndng-gen.js b/js/src/tests/test262/language/module-code/instn-local-bndng-gen.js
new file mode 100644
index 0000000000..68129776c9
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-local-bndng-gen.js
@@ -0,0 +1,53 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Mutable bindings are initialized in the lexical environment record prior to
+ execution for generator function declarations
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 15. For each element d in varDeclarations do
+ a. For each element dn of the BoundNames of d do
+ i. If dn is not an element of declaredVarNames, then
+ 1. Perform ! envRec.CreateMutableBinding(dn, false).
+ 2. Call envRec.InitializeBinding(dn, undefined).
+ 3. Append dn to declaredVarNames.
+ [...]
+includes: [fnGlobalObject.js]
+flags: [module]
+---*/
+
+var global = fnGlobalObject();
+
+assert.sameValue(
+ typeof test262, 'function', 'generator function value is hoisted'
+);
+assert.sameValue(
+ test262().next().value,
+ 'test262',
+ 'hoisted generator function value is correct'
+);
+assert.sameValue(
+ Object.getOwnPropertyDescriptor(global, 'test262'), undefined
+);
+
+test262 = null;
+assert.sameValue(test262, null, 'binding is mutable');
+assert.sameValue(
+ Object.getOwnPropertyDescriptor(global, 'test262'), undefined
+);
+
+function* test262() { return 'test262'; }
+
+assert.sameValue(
+ test262, null, 'binding is not effected by evaluation of declaration'
+);
+assert.sameValue(
+ Object.getOwnPropertyDescriptor(global, 'test262'),
+ undefined,
+ 'global binding is not effected by evaluation of declaration'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-local-bndng-let.js b/js/src/tests/test262/language/module-code/instn-local-bndng-let.js
new file mode 100644
index 0000000000..8973281cde
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-local-bndng-let.js
@@ -0,0 +1,47 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Mutable bindings are created in the lexical environment record prior to
+ execution for `let` declarations
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 17. For each element d in lexDeclarations do
+ a. For each element dn of the BoundNames of d do
+ i. If IsConstantDeclaration of d is true, then
+ [...]
+ ii. Else,
+ 1. Perform ! envRec.CreateMutableBinding(dn, false).
+ [...]
+includes: [fnGlobalObject.js]
+flags: [module]
+---*/
+
+var global = fnGlobalObject();
+
+assert.throws(ReferenceError, function() {
+ typeof test262;
+}, 'Binding is created but not initialized.');
+assert.sameValue(
+ Object.getOwnPropertyDescriptor(global, 'test262'), undefined
+);
+
+let test262;
+
+assert.sameValue(test262, undefined);
+assert.sameValue(
+ Object.getOwnPropertyDescriptor(global, 'test262'), undefined
+);
+
+test262 = null;
+
+assert.sameValue(test262, null, 'binding is mutable');
+assert.sameValue(
+ Object.getOwnPropertyDescriptor(global, 'test262'),
+ undefined,
+ 'global binding is not effected by modification'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-local-bndng-var-dup.js b/js/src/tests/test262/language/module-code/instn-local-bndng-var-dup.js
new file mode 100644
index 0000000000..6cd4df895b
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-local-bndng-var-dup.js
@@ -0,0 +1,26 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Only one attempt is made to create a binding for any number of variable
+ declarations
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 13. Let varDeclarations be the VarScopedDeclarations of code.
+ 14. Let declaredVarNames be a new empty List.
+ 15. For each element d in varDeclarations do
+ a. For each element dn of the BoundNames of d do
+ i. If dn is not an element of declaredVarNames, then
+ 1. Perform ! envRec.CreateMutableBinding(dn, false).
+ [...]
+ 3. Append dn to declaredVarNames.
+ [...]
+flags: [module]
+---*/
+
+var test262;
+var test262;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-local-bndng-var.js b/js/src/tests/test262/language/module-code/instn-local-bndng-var.js
new file mode 100644
index 0000000000..174134d0a8
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-local-bndng-var.js
@@ -0,0 +1,40 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Mutable bindings are initialized in the lexical environment record prior to
+ execution for variable declarations
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 13. Let varDeclarations be the VarScopedDeclarations of code.
+ 14. Let declaredVarNames be a new empty List.
+ 15. For each element d in varDeclarations do
+ a. For each element dn of the BoundNames of d do
+ i. If dn is not an element of declaredVarNames, then
+ 1. Perform ! envRec.CreateMutableBinding(dn, false).
+ 2. Call envRec.InitializeBinding(dn, undefined).
+ 3. Append dn to declaredVarNames.
+ [...]
+includes: [fnGlobalObject.js]
+flags: [module]
+---*/
+
+var global = fnGlobalObject();
+
+assert.sameValue(test262, undefined, 'value is initialized to `undefined`');
+assert.sameValue(
+ Object.getOwnPropertyDescriptor(global, 'test262'), undefined
+);
+
+var test262 = null;
+
+assert.sameValue(test262, null, 'binding is mutable');
+assert.sameValue(
+ Object.getOwnPropertyDescriptor(global, 'test262'),
+ undefined,
+ 'global binding is not effected by evaluation of declaration'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-named-bndng-cls.js b/js/src/tests/test262/language/module-code/instn-named-bndng-cls.js
new file mode 100644
index 0000000000..0297046707
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-named-bndng-cls.js
@@ -0,0 +1,49 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Imported binding reflects state of exported `class` binding
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 12. For each ImportEntry Record in in module.[[ImportEntries]], do
+ a. Let importedModule be ? HostResolveImportedModule(module,
+ in.[[ModuleRequest]]).
+ b. If in.[[ImportName]] is "*", then
+ [...]
+ c. Else,
+ i. Let resolution be ?
+ importedModule.ResolveExport(in.[[ImportName]], « », « »).
+ ii. If resolution is null or resolution is "ambiguous", throw a
+ SyntaxError exception.
+ iii. Call envRec.CreateImportBinding(in.[[LocalName]],
+ resolution.[[Module]], resolution.[[BindingName]]).
+ [...]
+ 16. Let lexDeclarations be the LexicallyScopedDeclarations of code.
+ 17. For each element d in lexDeclarations do
+ a. For each element dn of the BoundNames of d do
+ i, If IsConstantDeclaration of d is true, then
+ [...]
+ ii. Else,
+ 1. Perform ! envRec.CreateMutableBinding(dn, false).
+ iii. If d is a GeneratorDeclaration production or a
+ FunctionDeclaration production, then
+ [...]
+
+ 8.1.1.5.5 CreateImportBinding
+
+ [...]
+ 5. Create an immutable indirect binding in envRec for N that references M
+ and N2 as its target binding and record that the binding is initialized.
+ 6. Return NormalCompletion(empty).
+flags: [module]
+---*/
+
+assert.throws(ReferenceError, function() {
+ typeof D;
+}, 'binding is created but not initialized');
+
+import { C as D } from './instn-named-bndng-cls.js';
+export class C {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-named-bndng-const.js b/js/src/tests/test262/language/module-code/instn-named-bndng-const.js
new file mode 100644
index 0000000000..b231ffe362
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-named-bndng-const.js
@@ -0,0 +1,49 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Imported binding reflects state of exported `const` binding
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 12. For each ImportEntry Record in in module.[[ImportEntries]], do
+ a. Let importedModule be ? HostResolveImportedModule(module,
+ in.[[ModuleRequest]]).
+ b. If in.[[ImportName]] is "*", then
+ [...]
+ c. Else,
+ i. Let resolution be ?
+ importedModule.ResolveExport(in.[[ImportName]], « », « »).
+ ii. If resolution is null or resolution is "ambiguous", throw a
+ SyntaxError exception.
+ iii. Call envRec.CreateImportBinding(in.[[LocalName]],
+ resolution.[[Module]], resolution.[[BindingName]]).
+ [...]
+ 16. Let lexDeclarations be the LexicallyScopedDeclarations of code.
+ 17. For each element d in lexDeclarations do
+ a. For each element dn of the BoundNames of d do
+ i, If IsConstantDeclaration of d is true, then
+ 1. Perform ! envRec.CreateImmutableBinding(dn, true).
+ ii. Else,
+ 1. Perform ! envRec.CreateMutableBinding(dn, false).
+ iii. If d is a GeneratorDeclaration production or a
+ FunctionDeclaration production, then
+ [...]
+
+ 8.1.1.5.5 CreateImportBinding
+
+ [...]
+ 5. Create an immutable indirect binding in envRec for N that references M
+ and N2 as its target binding and record that the binding is initialized.
+ 6. Return NormalCompletion(empty).
+flags: [module]
+---*/
+
+assert.throws(ReferenceError, function() {
+ typeof y;
+}, 'binding is created but not initialized');
+
+import { x as y } from './instn-named-bndng-const.js';
+export const x = 23;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-named-bndng-dflt-cls.js b/js/src/tests/test262/language/module-code/instn-named-bndng-dflt-cls.js
new file mode 100644
index 0000000000..92711a9254
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-named-bndng-dflt-cls.js
@@ -0,0 +1,42 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Imported binding reflects state of exported default binding ("anonymous"
+ class declaration)
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 17. For each element d in lexDeclarations do
+ a. For each element dn of the BoundNames of d do
+ i. If IsConstantDeclaration of d is true, then
+ [...]
+ ii. Else,
+ 1. Perform ! envRec.CreateMutableBinding(dn, false).
+ iii. If d is a GeneratorDeclaration production or a
+ FunctionDeclaration production, then
+ 1. Let fo be the result of performing InstantiateFunctionObject
+ for d with argument env.
+ 2. Call envRec.InitializeBinding(dn, fo).
+ [...]
+
+ 14.5 Class Definitions
+
+ Syntax
+
+ ClassDeclaration[Yield, Default]:
+
+ class BindingIdentifier[?Yield] ClassTail[?Yield]
+ [+Default] class ClassTail[?Yield]
+flags: [module]
+---*/
+
+assert.throws(ReferenceError, function() {
+ typeof C;
+}, 'Binding is created but not initialized.');
+
+export default class {};
+import C from './instn-named-bndng-dflt-cls.js';
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-named-bndng-dflt-expr.js b/js/src/tests/test262/language/module-code/instn-named-bndng-dflt-expr.js
new file mode 100644
index 0000000000..f6d3bd2ac8
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-named-bndng-dflt-expr.js
@@ -0,0 +1,40 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Imported binding reflects state of exported default binding (expressions)
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 12. For each ImportEntry Record in in module.[[ImportEntries]], do
+ a. Let importedModule be ? HostResolveImportedModule(module,
+ in.[[ModuleRequest]]).
+ b. If in.[[ImportName]] is "*", then
+ [...]
+ c. Else,
+ i. Let resolution be ?
+ importedModule.ResolveExport(in.[[ImportName]], « », « »).
+ ii. If resolution is null or resolution is "ambiguous", throw a
+ SyntaxError exception.
+ iii. Call envRec.CreateImportBinding(in.[[LocalName]],
+ resolution.[[Module]], resolution.[[BindingName]]).
+ [...]
+
+ 8.1.1.5.5 CreateImportBinding
+
+ [...]
+ 5. Create an immutable indirect binding in envRec for N that references M
+ and N2 as its target binding and record that the binding is initialized.
+ 6. Return NormalCompletion(empty).
+flags: [module]
+---*/
+
+assert.throws(ReferenceError, function() {
+ typeof dflt;
+}, 'binding is created but not initialized');
+
+import dflt from './instn-named-bndng-dflt-expr.js';
+export default (function() {});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-named-bndng-dflt-fun-anon.js b/js/src/tests/test262/language/module-code/instn-named-bndng-dflt-fun-anon.js
new file mode 100644
index 0000000000..73c005db74
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-named-bndng-dflt-fun-anon.js
@@ -0,0 +1,53 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Imported binding reflects state of exported default binding ("anonymous"
+ function declaration)
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 17. For each element d in lexDeclarations do
+ a. For each element dn of the BoundNames of d do
+ i. If IsConstantDeclaration of d is true, then
+ [...]
+ ii. Else,
+ 1. Perform ! envRec.CreateMutableBinding(dn, false).
+ iii. If d is a GeneratorDeclaration production or a
+ FunctionDeclaration production, then
+ 1. Let fo be the result of performing InstantiateFunctionObject
+ for d with argument env.
+ 2. Call envRec.InitializeBinding(dn, fo).
+ [...]
+
+ 14.1.20 Runtime Semantics: InstantiateFunctionObject
+
+ FunctionDeclaration : function ( FormalParameters ) { FunctionBody }
+
+ 1. If the function code for FunctionDeclaration is strict mode code, let
+ strict be true. Otherwise let strict be false.
+ 2. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody, scope,
+ strict).
+ 3. Perform MakeConstructor(F).
+ 4. Perform SetFunctionName(F, "default").
+ 5. Return F.
+
+ 14.1 Function Definitions
+
+ Syntax
+
+ FunctionDeclaration[Yield, Default] :
+
+ function BindingIdentifier[?Yield] ( FormalParameters ) { FunctionBody }
+ [+Default] function ( FormalParameters ) { FunctionBody }
+flags: [module]
+---*/
+
+assert.sameValue(f(), 23, 'function value is hoisted');
+assert.sameValue(f.name, 'default', 'correct name is assigned');
+
+import f from './instn-named-bndng-dflt-fun-anon.js';
+export default function() { return 23; };
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-named-bndng-dflt-fun-named.js b/js/src/tests/test262/language/module-code/instn-named-bndng-dflt-fun-named.js
new file mode 100644
index 0000000000..fc80830da6
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-named-bndng-dflt-fun-named.js
@@ -0,0 +1,53 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Imported binding reflects state of exported default binding ("named"
+ function declaration)
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 17. For each element d in lexDeclarations do
+ a. For each element dn of the BoundNames of d do
+ i. If IsConstantDeclaration of d is true, then
+ [...]
+ ii. Else,
+ 1. Perform ! envRec.CreateMutableBinding(dn, false).
+ iii. If d is a GeneratorDeclaration production or a
+ FunctionDeclaration production, then
+ 1. Let fo be the result of performing InstantiateFunctionObject
+ for d with argument env.
+ 2. Call envRec.InitializeBinding(dn, fo).
+ [...]
+
+ 14.1.20 Runtime Semantics: InstantiateFunctionObject
+
+ FunctionDeclaration : function ( FormalParameters ) { FunctionBody }
+
+ 1. If the function code for FunctionDeclaration is strict mode code, let
+ strict be true. Otherwise let strict be false.
+ 2. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody, scope,
+ strict).
+ 3. Perform MakeConstructor(F).
+ 4. Perform SetFunctionName(F, "default").
+ 5. Return F.
+
+ 14.1 Function Definitions
+
+ Syntax
+
+ FunctionDeclaration[Yield, Default] :
+
+ function BindingIdentifier[?Yield] ( FormalParameters ) { FunctionBody }
+ [+Default] function ( FormalParameters ) { FunctionBody }
+flags: [module]
+---*/
+
+assert.sameValue(f(), 23, 'function value is hoisted');
+assert.sameValue(f.name, 'fName', 'correct name is assigned');
+
+import f from './instn-named-bndng-dflt-fun-named.js';
+export default function fName() { return 23; };
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-named-bndng-dflt-gen-anon.js b/js/src/tests/test262/language/module-code/instn-named-bndng-dflt-gen-anon.js
new file mode 100644
index 0000000000..d2c48dfdfa
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-named-bndng-dflt-gen-anon.js
@@ -0,0 +1,56 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Imported binding reflects state of exported default binding ("anonymous"
+ generator function declaration)
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 17. For each element d in lexDeclarations do
+ a. For each element dn of the BoundNames of d do
+ i. If IsConstantDeclaration of d is true, then
+ [...]
+ ii. Else,
+ 1. Perform ! envRec.CreateMutableBinding(dn, false).
+ iii. If d is a GeneratorDeclaration production or a
+ FunctionDeclaration production, then
+ 1. Let fo be the result of performing InstantiateFunctionObject
+ for d with argument env.
+ 2. Call envRec.InitializeBinding(dn, fo).
+ [...]
+
+ 14.4.12 Runtime Semantics: InstantiateFunctionObject
+
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ 1. If the function code for GeneratorDeclaration is strict mode code, let
+ strict be true. Otherwise let strict be false.
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ 3. Let prototype be ObjectCreate(%GeneratorPrototype%).
+ 4. Perform DefinePropertyOrThrow(F, "prototype",
+ PropertyDescriptor{[[Value]]: prototype, [[Writable]]: true,
+ [[Enumerable]]: false, [[Configurable]]: false}).
+ 5. Perform SetFunctionName(F, "default").
+ 6. Return F.
+
+ 14.4 Generator Function Definitions
+
+ Syntax
+
+ GeneratorDeclaration[Yield, Default] :
+ function * BindingIdentifier[?Yield] ( FormalParameters[Yield] ) { GeneratorBody }
+ [+Default] function * ( FormalParameters[Yield] ) { GeneratorBody }
+flags: [module]
+features: [generators]
+---*/
+
+assert.sameValue(g().next().value, 23, 'generator function value is hoisted');
+assert.sameValue(g.name, 'default', 'correct name is assigned');
+
+import g from './instn-named-bndng-dflt-gen-anon.js';
+export default function* () { return 23; };
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-named-bndng-dflt-gen-named.js b/js/src/tests/test262/language/module-code/instn-named-bndng-dflt-gen-named.js
new file mode 100644
index 0000000000..7d26b46d4a
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-named-bndng-dflt-gen-named.js
@@ -0,0 +1,56 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Imported binding reflects state of exported default binding ("named"
+ generator function declaration)
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 17. For each element d in lexDeclarations do
+ a. For each element dn of the BoundNames of d do
+ i. If IsConstantDeclaration of d is true, then
+ [...]
+ ii. Else,
+ 1. Perform ! envRec.CreateMutableBinding(dn, false).
+ iii. If d is a GeneratorDeclaration production or a
+ FunctionDeclaration production, then
+ 1. Let fo be the result of performing InstantiateFunctionObject
+ for d with argument env.
+ 2. Call envRec.InitializeBinding(dn, fo).
+ [...]
+
+ 14.4.12 Runtime Semantics: InstantiateFunctionObject
+
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+
+ 1. If the function code for GeneratorDeclaration is strict mode code, let
+ strict be true. Otherwise let strict be false.
+ 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters,
+ GeneratorBody, scope, strict).
+ 3. Let prototype be ObjectCreate(%GeneratorPrototype%).
+ 4. Perform DefinePropertyOrThrow(F, "prototype",
+ PropertyDescriptor{[[Value]]: prototype, [[Writable]]: true,
+ [[Enumerable]]: false, [[Configurable]]: false}).
+ 5. Perform SetFunctionName(F, "default").
+ 6. Return F.
+
+ 14.4 Generator Function Definitions
+
+ Syntax
+
+ GeneratorDeclaration[Yield, Default] :
+ function * BindingIdentifier[?Yield] ( FormalParameters[Yield] ) { GeneratorBody }
+ [+Default] function * ( FormalParameters[Yield] ) { GeneratorBody }
+flags: [module]
+features: [generators]
+---*/
+
+assert.sameValue(g().next().value, 23, 'generator function value is hoisted');
+assert.sameValue(g.name, 'gName', 'correct name is assigned');
+
+import g from './instn-named-bndng-dflt-gen-named.js';
+export default function* gName() { return 23; };
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-named-bndng-dflt-named.js b/js/src/tests/test262/language/module-code/instn-named-bndng-dflt-named.js
new file mode 100644
index 0000000000..f5bbf5030b
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-named-bndng-dflt-named.js
@@ -0,0 +1,30 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ An ImportClause may contain both an ImportedDefaultBinding and NamedImports
+esid: sec-imports
+info: |
+ Syntax
+
+ ImportClause:
+ ImportedDefaultBinding
+ NameSpaceImport
+ NamedImports
+ ImportedDefaultBinding , NameSpaceImport
+ ImportedDefaultBinding , NamedImports
+flags: [module]
+---*/
+
+assert.throws(ReferenceError, function() {
+ typeof x;
+});
+
+assert.sameValue(y, undefined);
+
+export default 3;
+export var attr;
+import x, { attr as y } from './instn-named-bndng-dflt-named.js';
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-named-bndng-dflt-star.js b/js/src/tests/test262/language/module-code/instn-named-bndng-dflt-star.js
new file mode 100644
index 0000000000..d6014fc5b8
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-named-bndng-dflt-star.js
@@ -0,0 +1,31 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ An ImportClause may contain both an ImportedDefaultBinding and a
+ NameSpaceImport
+esid: sec-imports
+info: |
+ Syntax
+
+ ImportClause:
+ ImportedDefaultBinding
+ NameSpaceImport
+ NamedImports
+ ImportedDefaultBinding , NameSpaceImport
+ ImportedDefaultBinding , NamedImports
+flags: [module]
+---*/
+
+assert.throws(ReferenceError, function() {
+ typeof x;
+});
+
+assert('attr' in ns);
+
+export default 3;
+export var attr;
+import x, * as ns from './instn-named-bndng-dflt-star.js';
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-named-bndng-fun.js b/js/src/tests/test262/language/module-code/instn-named-bndng-fun.js
new file mode 100644
index 0000000000..0a92faa43b
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-named-bndng-fun.js
@@ -0,0 +1,60 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Imported binding reflects state of exported function binding
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 12. For each ImportEntry Record in in module.[[ImportEntries]], do
+ a. Let importedModule be ? HostResolveImportedModule(module,
+ in.[[ModuleRequest]]).
+ b. If in.[[ImportName]] is "*", then
+ [...]
+ c. Else,
+ i. Let resolution be ?
+ importedModule.ResolveExport(in.[[ImportName]], « », « »).
+ ii. If resolution is null or resolution is "ambiguous", throw a
+ SyntaxError exception.
+ iii. Call envRec.CreateImportBinding(in.[[LocalName]],
+ resolution.[[Module]], resolution.[[BindingName]]).
+ [...]
+ 16. Let lexDeclarations be the LexicallyScopedDeclarations of code.
+ 17. For each element d in lexDeclarations do
+ a. For each element dn of the BoundNames of d do
+ i, If IsConstantDeclaration of d is true, then
+ 1. Perform ! envRec.CreateImmutableBinding(dn, true).
+ ii. Else,
+ 1. Perform ! envRec.CreateMutableBinding(dn, false).
+ iii. If d is a GeneratorDeclaration production or a
+ FunctionDeclaration production, then
+ 1. Let fo be the result of performing InstantiateFunctionObject
+ for d with argument env.
+ 2. Call envRec.InitializeBinding(dn, fo).
+ [...]
+
+ 8.1.1.5.5 CreateImportBinding
+
+ [...]
+ 5. Create an immutable indirect binding in envRec for N that references M
+ and N2 as its target binding and record that the binding is initialized.
+ 6. Return NormalCompletion(empty).
+flags: [module]
+---*/
+
+assert.sameValue(
+ f2(),
+ 23,
+ 'binding is initialized to function value prior to module evaluation'
+);
+
+assert.throws(TypeError, function() {
+ f2 = null;
+}, 'binding rejects assignment');
+
+assert.sameValue(f2(), 23, 'binding value is immutable');
+
+import { f as f2 } from './instn-named-bndng-fun.js';
+export function f() { return 23; }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-named-bndng-gen.js b/js/src/tests/test262/language/module-code/instn-named-bndng-gen.js
new file mode 100644
index 0000000000..e7c10c3849
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-named-bndng-gen.js
@@ -0,0 +1,62 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Imported binding reflects state of exported generator function binding
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 12. For each ImportEntry Record in in module.[[ImportEntries]], do
+ a. Let importedModule be ? HostResolveImportedModule(module,
+ in.[[ModuleRequest]]).
+ b. If in.[[ImportName]] is "*", then
+ [...]
+ c. Else,
+ i. Let resolution be ?
+ importedModule.ResolveExport(in.[[ImportName]], « », « »).
+ ii. If resolution is null or resolution is "ambiguous", throw a
+ SyntaxError exception.
+ iii. Call envRec.CreateImportBinding(in.[[LocalName]],
+ resolution.[[Module]], resolution.[[BindingName]]).
+ [...]
+ 16. Let lexDeclarations be the LexicallyScopedDeclarations of code.
+ 17. For each element d in lexDeclarations do
+ a. For each element dn of the BoundNames of d do
+ i, If IsConstantDeclaration of d is true, then
+ 1. Perform ! envRec.CreateImmutableBinding(dn, true).
+ ii. Else,
+ 1. Perform ! envRec.CreateMutableBinding(dn, false).
+ iii. If d is a GeneratorDeclaration production or a
+ FunctionDeclaration production, then
+ 1. Let fo be the result of performing InstantiateFunctionObject
+ for d with argument env.
+ 2. Call envRec.InitializeBinding(dn, fo).
+ [...]
+
+ 8.1.1.5.5 CreateImportBinding
+
+ [...]
+ 5. Create an immutable indirect binding in envRec for N that references M
+ and N2 as its target binding and record that the binding is initialized.
+ 6. Return NormalCompletion(empty).
+flags: [module]
+features: [generators]
+---*/
+
+assert.sameValue(
+ g2().next().value,
+ 23,
+ 'binding is initialized to function value prior to module evaluation'
+);
+
+assert.throws(TypeError, function() {
+ g2 = null;
+}, 'binding rejects assignment');
+
+assert.sameValue(g2().next().value, 23, 'binding value is immutable');
+
+import { g as g2 } from './instn-named-bndng-gen.js';
+export function* g() { return 23; }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-named-bndng-let.js b/js/src/tests/test262/language/module-code/instn-named-bndng-let.js
new file mode 100644
index 0000000000..9d743a50e8
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-named-bndng-let.js
@@ -0,0 +1,49 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Imported binding reflects state of exported `const` binding
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 12. For each ImportEntry Record in in module.[[ImportEntries]], do
+ a. Let importedModule be ? HostResolveImportedModule(module,
+ in.[[ModuleRequest]]).
+ b. If in.[[ImportName]] is "*", then
+ [...]
+ c. Else,
+ i. Let resolution be ?
+ importedModule.ResolveExport(in.[[ImportName]], « », « »).
+ ii. If resolution is null or resolution is "ambiguous", throw a
+ SyntaxError exception.
+ iii. Call envRec.CreateImportBinding(in.[[LocalName]],
+ resolution.[[Module]], resolution.[[BindingName]]).
+ [...]
+ 16. Let lexDeclarations be the LexicallyScopedDeclarations of code.
+ 17. For each element d in lexDeclarations do
+ a. For each element dn of the BoundNames of d do
+ i, If IsConstantDeclaration of d is true, then
+ 1. Perform ! envRec.CreateImmutableBinding(dn, true).
+ ii. Else,
+ 1. Perform ! envRec.CreateMutableBinding(dn, false).
+ iii. If d is a GeneratorDeclaration production or a
+ FunctionDeclaration production, then
+ [...]
+
+ 8.1.1.5.5 CreateImportBinding
+
+ [...]
+ 5. Create an immutable indirect binding in envRec for N that references M
+ and N2 as its target binding and record that the binding is initialized.
+ 6. Return NormalCompletion(empty).
+flags: [module]
+---*/
+
+assert.throws(ReferenceError, function() {
+ typeof y;
+}, 'binding is created but not initialized');
+
+import { x as y } from './instn-named-bndng-let.js';
+export let x = 23;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-named-bndng-trlng-comma.js b/js/src/tests/test262/language/module-code/instn-named-bndng-trlng-comma.js
new file mode 100644
index 0000000000..8c23ee8161
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-named-bndng-trlng-comma.js
@@ -0,0 +1,57 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Imported binding reflects state of exported `var` binding when ImportsList
+ has a trailing comma
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 12. For each ImportEntry Record in in module.[[ImportEntries]], do
+ a. Let importedModule be ? HostResolveImportedModule(module,
+ in.[[ModuleRequest]]).
+ b. If in.[[ImportName]] is "*", then
+ [...]
+ c. Else,
+ i. Let resolution be ?
+ importedModule.ResolveExport(in.[[ImportName]], « », « »).
+ ii. If resolution is null or resolution is "ambiguous", throw a
+ SyntaxError exception.
+ iii. Call envRec.CreateImportBinding(in.[[LocalName]],
+ resolution.[[Module]], resolution.[[BindingName]]).
+ [...]
+ 14. Let declaredVarNames be a new empty List.
+ 15. For each element d in varDeclarations do
+ a. For each element dn of the BoundNames of d do
+ i. If dn is not an element of declaredVarNames, then
+ 1. Perform ! envRec.CreateMutableBinding(dn, false).
+ 2. Call envRec.InitializeBinding(dn, undefined).
+ 3. Append dn to declaredVarNames.
+ [...]
+
+ 8.1.1.5.5 CreateImportBinding
+
+ [...]
+ 5. Create an immutable indirect binding in envRec for N that references M
+ and N2 as its target binding and record that the binding is initialized.
+ 6. Return NormalCompletion(empty).
+flags: [module]
+---*/
+
+assert.sameValue(
+ y,
+ undefined,
+ 'binding is initialized to `undefined` prior to module evaulation'
+);
+
+assert.throws(TypeError, function() {
+ y = null;
+}, 'binding rejects assignment');
+
+assert.sameValue(y, undefined, 'binding value is immutable');
+
+import { x as y , } from './instn-named-bndng-trlng-comma.js';
+export var x = 23;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-named-bndng-var.js b/js/src/tests/test262/language/module-code/instn-named-bndng-var.js
new file mode 100644
index 0000000000..0926ee998c
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-named-bndng-var.js
@@ -0,0 +1,55 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Imported binding reflects state of exported `var` binding
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 12. For each ImportEntry Record in in module.[[ImportEntries]], do
+ a. Let importedModule be ? HostResolveImportedModule(module,
+ in.[[ModuleRequest]]).
+ b. If in.[[ImportName]] is "*", then
+ [...]
+ c. Else,
+ i. Let resolution be ?
+ importedModule.ResolveExport(in.[[ImportName]], « », « »).
+ ii. If resolution is null or resolution is "ambiguous", throw a
+ SyntaxError exception.
+ iii. Call envRec.CreateImportBinding(in.[[LocalName]],
+ resolution.[[Module]], resolution.[[BindingName]]).
+ [...]
+ 14. Let declaredVarNames be a new empty List.
+ 15. For each element d in varDeclarations do
+ a. For each element dn of the BoundNames of d do
+ i. If dn is not an element of declaredVarNames, then
+ 1. Perform ! envRec.CreateMutableBinding(dn, false).
+ 2. Call envRec.InitializeBinding(dn, undefined).
+ 3. Append dn to declaredVarNames.
+ [...]
+
+ 8.1.1.5.5 CreateImportBinding
+
+ [...]
+ 5. Create an immutable indirect binding in envRec for N that references M
+ and N2 as its target binding and record that the binding is initialized.
+ 6. Return NormalCompletion(empty).
+flags: [module]
+---*/
+
+assert.sameValue(
+ y,
+ undefined,
+ 'binding is initialized to `undefined` prior to module evaulation'
+);
+
+assert.throws(TypeError, function() {
+ y = null;
+}, 'binding rejects assignment');
+
+assert.sameValue(y, undefined, 'binding value is immutable');
+
+import { x as y } from './instn-named-bndng-var.js';
+export var x = 23;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-named-err-ambiguous-1_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-named-err-ambiguous-1_FIXTURE.js
new file mode 100644
index 0000000000..6a4a7279cf
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-named-err-ambiguous-1_FIXTURE.js
@@ -0,0 +1,5 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export var x;
diff --git a/js/src/tests/test262/language/module-code/instn-named-err-ambiguous-2_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-named-err-ambiguous-2_FIXTURE.js
new file mode 100644
index 0000000000..6a4a7279cf
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-named-err-ambiguous-2_FIXTURE.js
@@ -0,0 +1,5 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export var x;
diff --git a/js/src/tests/test262/language/module-code/instn-named-err-ambiguous-as.js b/js/src/tests/test262/language/module-code/instn-named-err-ambiguous-as.js
new file mode 100644
index 0000000000..d1b602fd78
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-named-err-ambiguous-as.js
@@ -0,0 +1,45 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Named import binding - resolution failure (ambiguous name)
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 12. For each ImportEntry Record in in module.[[ImportEntries]], do
+ a. Let importedModule be ? HostResolveImportedModule(module,
+ in.[[ModuleRequest]]).
+ b. If in.[[ImportName]] is "*", then
+ [...]
+ c. Else,
+ i. Let resolution be ?
+ importedModule.ResolveExport(in.[[ImportName]], « », « »).
+ ii. If resolution is null or resolution is "ambiguous", throw a
+ SyntaxError exception.
+
+ 15.2.1.16.3 ResolveExport
+
+ [...]
+ 9. Let starResolution be null.
+ 10. For each ExportEntry Record e in module.[[StarExportEntries]], do
+ a. Let importedModule be ? HostResolveImportedModule(module,
+ e.[[ModuleRequest]]).
+ b. Let resolution be ? importedModule.ResolveExport(exportName,
+ resolveSet, exportStarSet).
+ c. If resolution is "ambiguous", return "ambiguous".
+ d. If resolution is not null, then
+ i. If starResolution is null, let starResolution be resolution.
+ ii. Else,
+ 1. Assert: there is more than one * import that includes the
+ requested name.
+ 2. If resolution.[[Module]] and starResolution.[[Module]] are
+ not the same Module Record or
+ SameValue(resolution.[[BindingName]],
+ starResolution.[[BindingName]]) is false, return "ambiguous".
+negative:
+ phase: runtime
+ type: SyntaxError
+flags: [module]
+---*/
+
+import { x as y } from './instn-named-err-ambiguous_FIXTURE.js';
diff --git a/js/src/tests/test262/language/module-code/instn-named-err-ambiguous.js b/js/src/tests/test262/language/module-code/instn-named-err-ambiguous.js
new file mode 100644
index 0000000000..14f73a1982
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-named-err-ambiguous.js
@@ -0,0 +1,45 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Named import binding - resolution failure (ambiguous name)
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 12. For each ImportEntry Record in in module.[[ImportEntries]], do
+ a. Let importedModule be ? HostResolveImportedModule(module,
+ in.[[ModuleRequest]]).
+ b. If in.[[ImportName]] is "*", then
+ [...]
+ c. Else,
+ i. Let resolution be ?
+ importedModule.ResolveExport(in.[[ImportName]], « », « »).
+ ii. If resolution is null or resolution is "ambiguous", throw a
+ SyntaxError exception.
+
+ 15.2.1.16.3 ResolveExport
+
+ [...]
+ 9. Let starResolution be null.
+ 10. For each ExportEntry Record e in module.[[StarExportEntries]], do
+ a. Let importedModule be ? HostResolveImportedModule(module,
+ e.[[ModuleRequest]]).
+ b. Let resolution be ? importedModule.ResolveExport(exportName,
+ resolveSet, exportStarSet).
+ c. If resolution is "ambiguous", return "ambiguous".
+ d. If resolution is not null, then
+ i. If starResolution is null, let starResolution be resolution.
+ ii. Else,
+ 1. Assert: there is more than one * import that includes the
+ requested name.
+ 2. If resolution.[[Module]] and starResolution.[[Module]] are
+ not the same Module Record or
+ SameValue(resolution.[[BindingName]],
+ starResolution.[[BindingName]]) is false, return "ambiguous".
+negative:
+ phase: runtime
+ type: SyntaxError
+flags: [module]
+---*/
+
+import { x } from './instn-named-err-ambiguous_FIXTURE.js';
diff --git a/js/src/tests/test262/language/module-code/instn-named-err-ambiguous_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-named-err-ambiguous_FIXTURE.js
new file mode 100644
index 0000000000..0223c67520
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-named-err-ambiguous_FIXTURE.js
@@ -0,0 +1,6 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export * from './instn-named-err-ambiguous-1_FIXTURE.js';
+export * from './instn-named-err-ambiguous-2_FIXTURE.js';
diff --git a/js/src/tests/test262/language/module-code/instn-named-err-dflt-thru-star-as.js b/js/src/tests/test262/language/module-code/instn-named-err-dflt-thru-star-as.js
new file mode 100644
index 0000000000..2d9bc4bb36
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-named-err-dflt-thru-star-as.js
@@ -0,0 +1,33 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Named import binding - default not found (excluding *)
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 12. For each ImportEntry Record in in module.[[ImportEntries]], do
+ a. Let importedModule be ? HostResolveImportedModule(module,
+ in.[[ModuleRequest]]).
+ b. If in.[[ImportName]] is "*", then
+ [...]
+ c. Else,
+ i. Let resolution be ?
+ importedModule.ResolveExport(in.[[ImportName]], « », « »).
+ ii. If resolution is null or resolution is "ambiguous", throw a
+ SyntaxError exception.
+
+ 15.2.1.16.3 ResolveExport
+
+ [...]
+ 6. If SameValue(exportName, "default") is true, then
+ a. Assert: A default export was not explicitly defined by this module.
+ b. Throw a SyntaxError exception.
+ c. NOTE A default export cannot be provided by an export *.
+negative:
+ phase: runtime
+ type: SyntaxError
+flags: [module]
+---*/
+
+import { default as x } from './instn-named-err-dflt-thru-star-int_FIXTURE.js';
diff --git a/js/src/tests/test262/language/module-code/instn-named-err-dflt-thru-star-dflt.js b/js/src/tests/test262/language/module-code/instn-named-err-dflt-thru-star-dflt.js
new file mode 100644
index 0000000000..bd2c899aab
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-named-err-dflt-thru-star-dflt.js
@@ -0,0 +1,33 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Named import binding - default not found (excluding *)
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 12. For each ImportEntry Record in in module.[[ImportEntries]], do
+ a. Let importedModule be ? HostResolveImportedModule(module,
+ in.[[ModuleRequest]]).
+ b. If in.[[ImportName]] is "*", then
+ [...]
+ c. Else,
+ i. Let resolution be ?
+ importedModule.ResolveExport(in.[[ImportName]], « », « »).
+ ii. If resolution is null or resolution is "ambiguous", throw a
+ SyntaxError exception.
+
+ 15.2.1.16.3 ResolveExport
+
+ [...]
+ 6. If SameValue(exportName, "default") is true, then
+ a. Assert: A default export was not explicitly defined by this module.
+ b. Throw a SyntaxError exception.
+ c. NOTE A default export cannot be provided by an export *.
+negative:
+ phase: runtime
+ type: SyntaxError
+flags: [module]
+---*/
+
+import x from './instn-named-err-dflt-thru-star-int_FIXTURE.js';
diff --git a/js/src/tests/test262/language/module-code/instn-named-err-dflt-thru-star-dflt_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-named-err-dflt-thru-star-dflt_FIXTURE.js
new file mode 100644
index 0000000000..02bf016b74
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-named-err-dflt-thru-star-dflt_FIXTURE.js
@@ -0,0 +1,6 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+var x;
+export { x as default };
diff --git a/js/src/tests/test262/language/module-code/instn-named-err-dflt-thru-star-int_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-named-err-dflt-thru-star-int_FIXTURE.js
new file mode 100644
index 0000000000..14d925662b
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-named-err-dflt-thru-star-int_FIXTURE.js
@@ -0,0 +1,5 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export * from './instn-named-err-dflt-thru-star-dflt_FIXTURE.js';
diff --git a/js/src/tests/test262/language/module-code/instn-named-err-not-found-as.js b/js/src/tests/test262/language/module-code/instn-named-err-not-found-as.js
new file mode 100644
index 0000000000..200ee82f77
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-named-err-not-found-as.js
@@ -0,0 +1,33 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Named import binding - resolution failure (not found)
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 12. For each ImportEntry Record in in module.[[ImportEntries]], do
+ a. Let importedModule be ? HostResolveImportedModule(module,
+ in.[[ModuleRequest]]).
+ b. If in.[[ImportName]] is "*", then
+ [...]
+ c. Else,
+ i. Let resolution be ?
+ importedModule.ResolveExport(in.[[ImportName]], « », « »).
+ ii. If resolution is null or resolution is "ambiguous", throw a
+ SyntaxError exception.
+
+ 15.2.1.16.3 ResolveExport
+
+ [...]
+ 9. Let starResolution be null.
+ 10. For each ExportEntry Record e in module.[[StarExportEntries]], do
+ [...]
+ 11. Return starResolution.
+negative:
+ phase: runtime
+ type: SyntaxError
+flags: [module]
+---*/
+
+import { x as y } from './instn-named-err-not-found-empty_FIXTURE.js';
diff --git a/js/src/tests/test262/language/module-code/instn-named-err-not-found-dflt.js b/js/src/tests/test262/language/module-code/instn-named-err-not-found-dflt.js
new file mode 100644
index 0000000000..3015b4d5cc
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-named-err-not-found-dflt.js
@@ -0,0 +1,33 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Named import binding - resolution failure (not found)
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 12. For each ImportEntry Record in in module.[[ImportEntries]], do
+ a. Let importedModule be ? HostResolveImportedModule(module,
+ in.[[ModuleRequest]]).
+ b. If in.[[ImportName]] is "*", then
+ [...]
+ c. Else,
+ i. Let resolution be ?
+ importedModule.ResolveExport(in.[[ImportName]], « », « »).
+ ii. If resolution is null or resolution is "ambiguous", throw a
+ SyntaxError exception.
+
+ 15.2.1.16.3 ResolveExport
+
+ [...]
+ 9. Let starResolution be null.
+ 10. For each ExportEntry Record e in module.[[StarExportEntries]], do
+ [...]
+ 11. Return starResolution.
+negative:
+ phase: runtime
+ type: SyntaxError
+flags: [module]
+---*/
+
+import x from './instn-named-err-not-found-empty_FIXTURE.js';
diff --git a/js/src/tests/test262/language/module-code/instn-named-err-not-found-empty_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-named-err-not-found-empty_FIXTURE.js
new file mode 100644
index 0000000000..6f2382ca5a
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-named-err-not-found-empty_FIXTURE.js
@@ -0,0 +1,5 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+;
diff --git a/js/src/tests/test262/language/module-code/instn-named-err-not-found.js b/js/src/tests/test262/language/module-code/instn-named-err-not-found.js
new file mode 100644
index 0000000000..7e37443b24
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-named-err-not-found.js
@@ -0,0 +1,33 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Named import binding - resolution failure (not found)
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 12. For each ImportEntry Record in in module.[[ImportEntries]], do
+ a. Let importedModule be ? HostResolveImportedModule(module,
+ in.[[ModuleRequest]]).
+ b. If in.[[ImportName]] is "*", then
+ [...]
+ c. Else,
+ i. Let resolution be ?
+ importedModule.ResolveExport(in.[[ImportName]], « », « »).
+ ii. If resolution is null or resolution is "ambiguous", throw a
+ SyntaxError exception.
+
+ 15.2.1.16.3 ResolveExport
+
+ [...]
+ 9. Let starResolution be null.
+ 10. For each ExportEntry Record e in module.[[StarExportEntries]], do
+ [...]
+ 11. Return starResolution.
+negative:
+ phase: runtime
+ type: SyntaxError
+flags: [module]
+---*/
+
+import { x } from './instn-named-err-not-found-empty_FIXTURE.js';
diff --git a/js/src/tests/test262/language/module-code/instn-named-id-name.js b/js/src/tests/test262/language/module-code/instn-named-id-name.js
new file mode 100644
index 0000000000..2272b68f39
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-named-id-name.js
@@ -0,0 +1,56 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ The first identifier in an ImportSpecifier containing `as` may be any valid
+ IdentifierName
+esid: sec-imports
+info: |
+ ImportSpecifier:
+ ImportedBinding
+ IdentifierName as ImportedBinding
+flags: [module]
+---*/
+
+var _if = 1;
+var _import = 2;
+var _export = 3;
+var _await = 4;
+var _arguments = 5;
+var _eval = 6;
+var _default = 7;
+var _as = 8;
+
+export {
+ _if as if,
+ _import as import,
+ _export as export,
+ _await as await,
+ _arguments as arguments,
+ _eval as eval,
+ _default as default,
+ _as as as
+ };
+
+import {
+ if as if_,
+ import as import_,
+ export as export_,
+ await as await_,
+ arguments as arguments_,
+ eval as eval_,
+ default as default_,
+ as as as
+ } from './instn-named-id-name.js';
+
+assert.sameValue(if_, 1);
+assert.sameValue(import_, 2);
+assert.sameValue(export_, 3);
+assert.sameValue(await_, 4);
+assert.sameValue(arguments_, 5);
+assert.sameValue(eval_, 6);
+assert.sameValue(default_, 7);
+assert.sameValue(as, 8);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-named-iee-cycle-2_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-named-iee-cycle-2_FIXTURE.js
new file mode 100644
index 0000000000..58f2b86059
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-named-iee-cycle-2_FIXTURE.js
@@ -0,0 +1,17 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export { b as a } from './instn-named-iee-cycle.js';
+export { d as c } from './instn-named-iee-cycle.js';
+export { f as e } from './instn-named-iee-cycle.js';
+export { h as g } from './instn-named-iee-cycle.js';
+export { j as i } from './instn-named-iee-cycle.js';
+export { l as k } from './instn-named-iee-cycle.js';
+export { n as m } from './instn-named-iee-cycle.js';
+export { p as o } from './instn-named-iee-cycle.js';
+export { r as q } from './instn-named-iee-cycle.js';
+export { t as s } from './instn-named-iee-cycle.js';
+export { v as u } from './instn-named-iee-cycle.js';
+export { x as w } from './instn-named-iee-cycle.js';
+export { z as y } from './instn-named-iee-cycle.js';
diff --git a/js/src/tests/test262/language/module-code/instn-named-iee-cycle.js b/js/src/tests/test262/language/module-code/instn-named-iee-cycle.js
new file mode 100644
index 0000000000..6abb15a633
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-named-iee-cycle.js
@@ -0,0 +1,63 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ There are no restrictions on the number of cycles during module traversal
+ during indirect export resolution, given unique export names.
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 12. For each ImportEntry Record in in module.[[ImportEntries]], do
+ a. Let importedModule be ? HostResolveImportedModule(module,
+ in.[[ModuleRequest]]).
+ b. If in.[[ImportName]] is "*", then
+ [...]
+ c. Else,
+ i. Let resolution be ?
+ importedModule.ResolveExport(in.[[ImportName]], « », « »).
+ ii. If resolution is null or resolution is "ambiguous", throw a
+ SyntaxError exception.
+ iii. Call envRec.CreateImportBinding(in.[[LocalName]],
+ resolution.[[Module]], resolution.[[BindingName]]).
+ [...]
+
+ 15.2.1.16.3 ResolveExport( exportName, resolveSet, exportStarSet )
+
+ 2. For each Record {[[Module]], [[ExportName]]} r in resolveSet, do:
+ a. If module and r.[[Module]] are the same Module Record and
+ SameValue(exportName, r.[[ExportName]]) is true, then
+ i. Assert: this is a circular import request.
+ ii. Return null.
+ 3. Append the Record {[[Module]]: module, [[ExportName]]: exportName} to resolveSet.
+ [...]
+ 5. For each ExportEntry Record e in module.[[IndirectExportEntries]], do
+ a. If SameValue(exportName, e.[[ExportName]]) is true, then
+ i. Assert: module imports a specific binding for this export.
+ ii. Let importedModule be ? HostResolveImportedModule(module,
+ e.[[ModuleRequest]]).
+ iii. Let indirectResolution be ?
+ importedModule.ResolveExport(e.[[ImportName]], resolveSet,
+ exportStarSet).
+ iv. If indirectResolution is not null, return indirectResolution.
+flags: [module]
+---*/
+
+import { a } from './instn-named-iee-cycle-2_FIXTURE.js';
+export { c as b } from './instn-named-iee-cycle-2_FIXTURE.js';
+export { e as d } from './instn-named-iee-cycle-2_FIXTURE.js';
+export { g as f } from './instn-named-iee-cycle-2_FIXTURE.js';
+export { i as h } from './instn-named-iee-cycle-2_FIXTURE.js';
+export { k as j } from './instn-named-iee-cycle-2_FIXTURE.js';
+export { m as l } from './instn-named-iee-cycle-2_FIXTURE.js';
+export { o as n } from './instn-named-iee-cycle-2_FIXTURE.js';
+export { q as p } from './instn-named-iee-cycle-2_FIXTURE.js';
+export { s as r } from './instn-named-iee-cycle-2_FIXTURE.js';
+export { u as t } from './instn-named-iee-cycle-2_FIXTURE.js';
+export { w as v } from './instn-named-iee-cycle-2_FIXTURE.js';
+export { y as x } from './instn-named-iee-cycle-2_FIXTURE.js';
+export var z = 23;
+
+assert.sameValue(a, 23);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-named-star-cycle-2_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-named-star-cycle-2_FIXTURE.js
new file mode 100644
index 0000000000..3fffff568f
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-named-star-cycle-2_FIXTURE.js
@@ -0,0 +1,5 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export * from './instn-named-star-cycle-indirect-x_FIXTURE.js';
diff --git a/js/src/tests/test262/language/module-code/instn-named-star-cycle-indirect-x_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-named-star-cycle-indirect-x_FIXTURE.js
new file mode 100644
index 0000000000..de3a124451
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-named-star-cycle-indirect-x_FIXTURE.js
@@ -0,0 +1,9 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+// This module is visited two times:
+// First when resolving the "x" binding and then another time to resolve the
+// "y" binding.
+export { y as x } from './instn-named-star-cycle-2_FIXTURE.js';
+export var y = 45;
diff --git a/js/src/tests/test262/language/module-code/instn-named-star-cycle.js b/js/src/tests/test262/language/module-code/instn-named-star-cycle.js
new file mode 100644
index 0000000000..a06d281a4f
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-named-star-cycle.js
@@ -0,0 +1,53 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Modules can be visited more than once when resolving bindings through
+ "star" exports as long as the exportName is different each time.
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 12. For each ImportEntry Record in in module.[[ImportEntries]], do
+ a. Let importedModule be ? HostResolveImportedModule(module,
+ in.[[ModuleRequest]]).
+ b. If in.[[ImportName]] is "*", then
+ [...]
+ c. Else,
+ i. Let resolution be ?
+ importedModule.ResolveExport(in.[[ImportName]], « », « »).
+ [...]
+ iii. Call envRec.CreateImportBinding(in.[[LocalName]],
+ resolution.[[Module]], resolution.[[BindingName]]).
+ [...]
+
+ 15.2.1.16.3 ResolveExport( exportName, resolveSet )
+
+ [...]
+ 3. Append the Record {[[Module]]: module, [[ExportName]]: exportName} to resolveSet.
+ 4. For each ExportEntry Record e in module.[[LocalExportEntries]], do
+ a. If SameValue(exportName, e.[[ExportName]]) is true, then
+ i. Assert: module provides the direct binding for this export.
+ ii. Return Record{[[Module]]: module, [[BindingName]]: e.[[LocalName]]}.
+ 5. For each ExportEntry Record e in module.[[IndirectExportEntries]], do
+ a. If SameValue(exportName, e.[[ExportName]]) is true, then
+ i. Assert: module imports a specific binding for this export.
+ ii. Let importedModule be ? HostResolveImportedModule(module, e.[[ModuleRequest]]).
+ iii. Return ? importedModule.ResolveExport(e.[[ImportName]], resolveSet).
+ [...]
+ 8. For each ExportEntry Record e in module.[[StarExportEntries]], do
+ a. Let importedModule be ? HostResolveImportedModule(module, e.[[ModuleRequest]]).
+ b. Let resolution be ? importedModule.ResolveExport(exportName, resolveSet).
+ [...]
+ d. If resolution is not null, then
+ i. If starResolution is null, let starResolution be resolution.
+ [...]
+ 9. Return starResolution.
+flags: [module]
+---*/
+
+import { x } from './instn-named-star-cycle-2_FIXTURE.js';
+
+assert.sameValue(x, 45);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-once.js b/js/src/tests/test262/language/module-code/instn-once.js
new file mode 100644
index 0000000000..525d426dec
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-once.js
@@ -0,0 +1,41 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Module is linked exactly once
+esid: sec-moduledeclarationlinking
+info: |
+ Link ( ) Concrete Method
+ [...]
+ 4. Let result be InnerModuleLinking(module, stack, 0).
+ [...]
+
+ InnerModuleLinking( module, stack, index )
+ [...]
+ 2. If module.[[Status]] is "linking", "linked", or "evaluated", then
+ a. Return index.
+ 3. Assert: module.[[Status]] is "unlinked".
+ 4. Set module.[[Status]] to "linking".
+ [...]
+ 9. For each String required that is an element of module.[[RequestedModules]], do
+ a. Let requiredModule be ? HostResolveImportedModule(module, required).
+ b. Set index to ? InnerModuleLinking(requiredModule, stack, index).
+ [...]
+flags: [module]
+features: [export-star-as-namespace-from-module]
+---*/
+
+import {} from './instn-once.js';
+import './instn-once.js';
+import * as ns1 from './instn-once.js';
+import dflt1 from './instn-once.js';
+export {} from './instn-once.js';
+import dflt2, {} from './instn-once.js';
+export * from './instn-once.js';
+export * as ns2 from './instn-once.js';
+import dflt3, * as ns from './instn-once.js';
+export default null;
+
+let x;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-resolve-empty-export.js b/js/src/tests/test262/language/module-code/instn-resolve-empty-export.js
new file mode 100644
index 0000000000..1dee8e70f3
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-resolve-empty-export.js
@@ -0,0 +1,41 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ A NamedExport without an ExportsList contributes to the list of requested
+ modules
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 8. For each String required that is an element of
+ module.[[RequestedModules]] do,
+ a. NOTE: Before instantiating a module, all of the modules it requested
+ must be available. An implementation may perform this test at any
+ time prior to this point.
+ b. Let requiredModule be ? HostResolveImportedModule(module, required).
+ c. Perform ? requiredModule.ModuleDeclarationInstantiation().
+
+ 15.2.2.5 Static Semantics: ModuleRequests
+
+ ImportDeclaration : import ImportClause FromClause;
+
+ 1. Return ModuleRequests of FromClause.
+
+ 15.2.3 Exports
+
+ Syntax
+
+ NamedExport:
+ { }
+ { ExportsList }
+ { ExportsList , }
+negative:
+ phase: resolution
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+export {} from './instn-resolve-empty-export_FIXTURE.js';
diff --git a/js/src/tests/test262/language/module-code/instn-resolve-empty-export_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-resolve-empty-export_FIXTURE.js
new file mode 100644
index 0000000000..21567b1e5d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-resolve-empty-export_FIXTURE.js
@@ -0,0 +1,5 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+0++;
diff --git a/js/src/tests/test262/language/module-code/instn-resolve-empty-import.js b/js/src/tests/test262/language/module-code/instn-resolve-empty-import.js
new file mode 100644
index 0000000000..6e8ca9cb98
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-resolve-empty-import.js
@@ -0,0 +1,47 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ An ImportClause without an ImportsList contributes to the list of requested
+ modules
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 8. For each String required that is an element of
+ module.[[RequestedModules]] do,
+ a. NOTE: Before instantiating a module, all of the modules it requested
+ must be available. An implementation may perform this test at any
+ time prior to this point.
+ b. Let requiredModule be ? HostResolveImportedModule(module, required).
+ c. Perform ? requiredModule.ModuleDeclarationInstantiation().
+
+ 15.2.2.5 Static Semantics: ModuleRequests
+
+ ImportDeclaration : import ImportClause FromClause;
+
+ 1. Return ModuleRequests of FromClause.
+
+ 15.2.3 Exports
+
+ Syntax
+ ImportClause :
+ ImportedDefaultBinding
+ NameSpaceImport
+ NamedImports
+ ImportedDefaultBinding , NameSpaceImport
+ ImportedDefaultBinding , NamedImports
+
+ NamedImports :
+ { }
+ { ImportsList }
+ { ImportsList , }
+negative:
+ phase: resolution
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+import {} from './instn-resolve-empty-import_FIXTURE.js';
diff --git a/js/src/tests/test262/language/module-code/instn-resolve-empty-import_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-resolve-empty-import_FIXTURE.js
new file mode 100644
index 0000000000..21567b1e5d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-resolve-empty-import_FIXTURE.js
@@ -0,0 +1,5 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+0++;
diff --git a/js/src/tests/test262/language/module-code/instn-resolve-err-syntax-1.js b/js/src/tests/test262/language/module-code/instn-resolve-err-syntax-1.js
new file mode 100644
index 0000000000..c0cf7bf944
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-resolve-err-syntax-1.js
@@ -0,0 +1,22 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Requested modules that produce an early SyntaxError
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 8. For each String required that is an element of
+ module.[[RequestedModules]] do,
+ [...]
+ b. Let requiredModule be ? HostResolveImportedModule(module, required).
+ [...]
+negative:
+ phase: resolution
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+import './instn-resolve-err-syntax-1_FIXTURE.js';
diff --git a/js/src/tests/test262/language/module-code/instn-resolve-err-syntax-1_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-resolve-err-syntax-1_FIXTURE.js
new file mode 100644
index 0000000000..b1f90413bb
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-resolve-err-syntax-1_FIXTURE.js
@@ -0,0 +1,5 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+break;
diff --git a/js/src/tests/test262/language/module-code/instn-resolve-err-syntax-2.js b/js/src/tests/test262/language/module-code/instn-resolve-err-syntax-2.js
new file mode 100644
index 0000000000..89e44c2af9
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-resolve-err-syntax-2.js
@@ -0,0 +1,22 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Requested modules that produce an early SyntaxError
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 8. For each String required that is an element of
+ module.[[RequestedModules]] do,
+ [...]
+ b. Let requiredModule be ? HostResolveImportedModule(module, required).
+ [...]
+negative:
+ phase: resolution
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+import './instn-resolve-err-syntax-2_FIXTURE.js';
diff --git a/js/src/tests/test262/language/module-code/instn-resolve-err-syntax-2_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-resolve-err-syntax-2_FIXTURE.js
new file mode 100644
index 0000000000..21567b1e5d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-resolve-err-syntax-2_FIXTURE.js
@@ -0,0 +1,5 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+0++;
diff --git a/js/src/tests/test262/language/module-code/instn-resolve-order-depth-child_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-resolve-order-depth-child_FIXTURE.js
new file mode 100644
index 0000000000..76a330dce7
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-resolve-order-depth-child_FIXTURE.js
@@ -0,0 +1,5 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+import './instn-resolve-order-depth-reference_FIXTURE.js';
diff --git a/js/src/tests/test262/language/module-code/instn-resolve-order-depth-reference_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-resolve-order-depth-reference_FIXTURE.js
new file mode 100644
index 0000000000..21567b1e5d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-resolve-order-depth-reference_FIXTURE.js
@@ -0,0 +1,5 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+0++;
diff --git a/js/src/tests/test262/language/module-code/instn-resolve-order-depth-syntax_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-resolve-order-depth-syntax_FIXTURE.js
new file mode 100644
index 0000000000..b1f90413bb
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-resolve-order-depth-syntax_FIXTURE.js
@@ -0,0 +1,5 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+break;
diff --git a/js/src/tests/test262/language/module-code/instn-resolve-order-depth.js b/js/src/tests/test262/language/module-code/instn-resolve-order-depth.js
new file mode 100644
index 0000000000..3ab9b2bc56
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-resolve-order-depth.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Module dependencies are resolved following a depth-first strategy
+esid: sec-moduledeclarationinstantiation
+negative:
+ phase: resolution
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+import './instn-resolve-order-depth-child_FIXTURE.js';
+import './instn-resolve-order-depth-syntax_FIXTURE.js';
diff --git a/js/src/tests/test262/language/module-code/instn-resolve-order-src-reference_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-resolve-order-src-reference_FIXTURE.js
new file mode 100644
index 0000000000..21567b1e5d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-resolve-order-src-reference_FIXTURE.js
@@ -0,0 +1,5 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+0++;
diff --git a/js/src/tests/test262/language/module-code/instn-resolve-order-src-syntax_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-resolve-order-src-syntax_FIXTURE.js
new file mode 100644
index 0000000000..b1f90413bb
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-resolve-order-src-syntax_FIXTURE.js
@@ -0,0 +1,5 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+break;
diff --git a/js/src/tests/test262/language/module-code/instn-resolve-order-src-valid_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-resolve-order-src-valid_FIXTURE.js
new file mode 100644
index 0000000000..6f2382ca5a
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-resolve-order-src-valid_FIXTURE.js
@@ -0,0 +1,5 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+;
diff --git a/js/src/tests/test262/language/module-code/instn-resolve-order-src.js b/js/src/tests/test262/language/module-code/instn-resolve-order-src.js
new file mode 100644
index 0000000000..19ec8f9180
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-resolve-order-src.js
@@ -0,0 +1,17 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Modules dependencies are resolved in source text order
+esid: sec-moduledeclarationinstantiation
+negative:
+ phase: resolution
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+import './instn-resolve-order-src-valid_FIXTURE.js';
+import './instn-resolve-order-src-reference_FIXTURE.js';
+import './instn-resolve-order-src-syntax_FIXTURE.js';
diff --git a/js/src/tests/test262/language/module-code/instn-same-global-set_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-same-global-set_FIXTURE.js
new file mode 100644
index 0000000000..ca40bac716
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-same-global-set_FIXTURE.js
@@ -0,0 +1,5 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+new Function('return this;')().test262 = 262;
diff --git a/js/src/tests/test262/language/module-code/instn-same-global.js b/js/src/tests/test262/language/module-code/instn-same-global.js
new file mode 100644
index 0000000000..d7782ecdd2
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-same-global.js
@@ -0,0 +1,22 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Modules share the same global `this` value
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 6. Let env be NewModuleEnvironment(realm.[[GlobalEnv]]).
+ 7. Set module.[[Environment]] to env.
+ [...]
+includes: [fnGlobalObject.js]
+flags: [module]
+---*/
+
+import './instn-same-global-set_FIXTURE.js';
+
+var global = fnGlobalObject();
+
+assert.sameValue(global.test262, 262);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-star-ambiguous-1_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-star-ambiguous-1_FIXTURE.js
new file mode 100644
index 0000000000..77078c4673
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-star-ambiguous-1_FIXTURE.js
@@ -0,0 +1,6 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export var first = null;
+export var both = null;
diff --git a/js/src/tests/test262/language/module-code/instn-star-ambiguous-2_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-star-ambiguous-2_FIXTURE.js
new file mode 100644
index 0000000000..965c1ce92c
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-star-ambiguous-2_FIXTURE.js
@@ -0,0 +1,6 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export var second = null;
+export var both = null;
diff --git a/js/src/tests/test262/language/module-code/instn-star-ambiguous.js b/js/src/tests/test262/language/module-code/instn-star-ambiguous.js
new file mode 100644
index 0000000000..92d8ccf850
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-star-ambiguous.js
@@ -0,0 +1,38 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Ambiguous exports are not reflected in module namespace objects, nor do
+ they trigger an error upon resolution
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 12. For each ImportEntry Record in in module.[[ImportEntries]], do
+ a. Let importedModule be ? HostResolveImportedModule(module,
+ in.[[ModuleRequest]]).
+ b. If in.[[ImportName]] is "*", then
+ i. Let namespace be ? GetModuleNamespace(importedModule).
+ [...]
+
+ 15.2.1.18 Runtime Semantics: GetModuleNamespace
+
+ [...]
+ 3. If namespace is undefined, then
+ [...]
+ c. For each name that is an element of exportedNames,
+ i. Let resolution be ? module.ResolveExport(name, « », « »).
+ ii. If resolution is null, throw a SyntaxError exception.
+ iii. If resolution is not "ambiguous", append name to
+ unambiguousNames.
+ d. Let namespace be ModuleNamespaceCreate(module, unambiguousNames).
+flags: [module]
+---*/
+
+import * as ns from './instn-star-ambiguous_FIXTURE.js';
+
+assert('first' in ns, 'Non-ambiguous exports from first module are present');
+assert('second' in ns, 'Non-ambiguous exports from second module are present');
+assert.sameValue('both' in ns, false, 'Ambiguous export is not present');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-star-ambiguous_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-star-ambiguous_FIXTURE.js
new file mode 100644
index 0000000000..05660f4ad1
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-star-ambiguous_FIXTURE.js
@@ -0,0 +1,6 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export * from './instn-star-ambiguous-1_FIXTURE.js';
+export * from './instn-star-ambiguous-2_FIXTURE.js';
diff --git a/js/src/tests/test262/language/module-code/instn-star-as-props-dflt-skip.js b/js/src/tests/test262/language/module-code/instn-star-as-props-dflt-skip.js
new file mode 100644
index 0000000000..9920601ca8
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-star-as-props-dflt-skip.js
@@ -0,0 +1,61 @@
+// |reftest| module
+// Copyright (C) 2018 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Default exports are included in an imported module namespace object when module exported with `* as namespace`
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 4. Let result be InnerModuleInstantiation(module, stack, 0).
+ [...]
+
+ InnerModuleInstantiation( module, stack, index )
+ [...]
+ 10. Perform ? ModuleDeclarationEnvironmentSetup(module).
+ [...]
+
+ ModuleDeclarationEnvironmentSetup( module )
+ [...]
+ c. If in.[[ImportName]] is "*", then
+ [...]
+ d. Else,
+ i. Let resolution be ? importedModule.ResolveExport(in.[[ImportName]], « »).
+ ii. If resolution is null or "ambiguous", throw a SyntaxError exception.
+ iii. If resolution.[[BindingName]] is "*namespace*", then
+ 1. Let namespace be ? GetModuleNamespace(resolution.[[Module]]).
+ [...]
+
+ 15.2.1.18 Runtime Semantics: GetModuleNamespace
+
+ [...]
+ 3. If namespace is undefined, then
+ a. Let exportedNames be ? module.GetExportedNames(« »).
+ [...]
+
+ 15.2.1.16.2 GetExportedNames
+
+ [...]
+ 7. For each ExportEntry Record e in module.[[StarExportEntries]], do
+ [...]
+ c. For each element n of starNames, do
+ i. If SameValue(n, "default") is false, then
+ [...]
+flags: [module]
+features: [export-star-as-namespace-from-module]
+---*/
+
+import {named} from './instn-star-props-dflt-skip-star-as-named_FIXTURE.js';
+import {production} from './instn-star-props-dflt-skip-star-as-prod_FIXTURE.js';
+
+assert('namedOther' in named);
+assert.sameValue(
+ 'default' in named, true, 'default specified via identifier'
+);
+
+assert('productionOther' in production);
+assert.sameValue(
+ 'default' in production, true, 'default specified via dedicated production'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-star-binding.js b/js/src/tests/test262/language/module-code/instn-star-binding.js
new file mode 100644
index 0000000000..16bcc86e9c
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-star-binding.js
@@ -0,0 +1,34 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Immutable binding is created for module namespace object
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 12. For each ImportEntry Record in in module.[[ImportEntries]], do
+ a. Let importedModule be ? HostResolveImportedModule(module,
+ in.[[ModuleRequest]]).
+ b. If in.[[ImportName]] is "*", then
+ i. Let namespace be ? GetModuleNamespace(importedModule).
+ ii. Perform ! envRec.CreateImmutableBinding(in.[[LocalName]], true).
+ iii. Call envRec.InitializeBinding(in.[[LocalName]], namespace).
+ [...]
+flags: [module]
+---*/
+
+assert.sameValue(
+ typeof ns, 'object', 'binding is initialized prior to module evaluation'
+);
+
+var original = ns;
+
+assert.throws(TypeError, function() {
+ ns = null;
+}, 'binding rejects assignment');
+
+assert.sameValue(ns, original, 'binding value is immutable');
+
+import * as ns from './instn-star-binding.js';
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-star-equality-other_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-star-equality-other_FIXTURE.js
new file mode 100644
index 0000000000..b117bebd20
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-star-equality-other_FIXTURE.js
@@ -0,0 +1,6 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+import * as testNs from './instn-star-equality.js';
+export { testNs };
diff --git a/js/src/tests/test262/language/module-code/instn-star-equality.js b/js/src/tests/test262/language/module-code/instn-star-equality.js
new file mode 100644
index 0000000000..55e7182806
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-star-equality.js
@@ -0,0 +1,46 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: A single namespace is created for each module
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 12. For each ImportEntry Record in in module.[[ImportEntries]], do
+ a. Let importedModule be ? HostResolveImportedModule(module,
+ in.[[ModuleRequest]]).
+ b. If in.[[ImportName]] is "*", then
+ i. Let namespace be ? GetModuleNamespace(importedModule).
+ ii. Perform ! envRec.CreateImmutableBinding(in.[[LocalName]], true).
+ iii. Call envRec.InitializeBinding(in.[[LocalName]], namespace).
+ [...]
+
+ 15.2.1.18 Runtime Semantics: GetModuleNamespace
+
+ 1. Assert: module is an instance of a concrete subclass of Module Record.
+ 2. Let namespace be module.[[Namespace]].
+ 3. If namespace is undefined, then
+ [...]
+ 4. Return namespace.
+flags: [module]
+---*/
+
+import * as self1 from './instn-star-equality.js';
+import * as self2 from './instn-star-equality.js';
+import * as other1 from './instn-star-equality-other_FIXTURE.js';
+import * as self3 from './instn-star-equality.js';
+import * as other2 from './instn-star-equality-other_FIXTURE.js';
+import { testNs } from './instn-star-equality-other_FIXTURE.js';
+
+assert.sameValue(
+ self1, self2, 'Local namespace objects from consecutive declarations'
+);
+assert.sameValue(
+ self1, self3, 'Local namespace objects from non-consective declarations'
+);
+assert.sameValue(other1, other2, 'External namespace objects');
+assert.sameValue(self1, testNs, 'Re-exported namespace objects');
+
+assert.notSameValue(self1, other1);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-star-err-not-found-empty_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-star-err-not-found-empty_FIXTURE.js
new file mode 100644
index 0000000000..6f2382ca5a
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-star-err-not-found-empty_FIXTURE.js
@@ -0,0 +1,5 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+;
diff --git a/js/src/tests/test262/language/module-code/instn-star-err-not-found-faulty_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-star-err-not-found-faulty_FIXTURE.js
new file mode 100644
index 0000000000..5fb408a24b
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-star-err-not-found-faulty_FIXTURE.js
@@ -0,0 +1,5 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export { x } from './instn-star-err-not-found-empty_FIXTURE.js';
diff --git a/js/src/tests/test262/language/module-code/instn-star-err-not-found.js b/js/src/tests/test262/language/module-code/instn-star-err-not-found.js
new file mode 100644
index 0000000000..a741324ac6
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-star-err-not-found.js
@@ -0,0 +1,32 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Importing a namespace for a module which contains an unresolvable named
+ export
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 12. For each ImportEntry Record in in module.[[ImportEntries]], do
+ a. Let importedModule be ? HostResolveImportedModule(module,
+ in.[[ModuleRequest]]).
+ b. If in.[[ImportName]] is "*", then
+ i. Let namespace be ? GetModuleNamespace(importedModule).
+ [...]
+
+ 15.2.1.18 Runtime Semantics: GetModuleNamespace
+
+ [...]
+ 3. If namespace is undefined, then
+ [...]
+ c. For each name that is an element of exportedNames,
+ i. Let resolution be ? module.ResolveExport(name, « », « »).
+ ii. If resolution is null, throw a SyntaxError exception.
+negative:
+ phase: runtime
+ type: SyntaxError
+flags: [module]
+---*/
+
+import * as ns from './instn-star-err-not-found-faulty_FIXTURE.js';
diff --git a/js/src/tests/test262/language/module-code/instn-star-id-name.js b/js/src/tests/test262/language/module-code/instn-star-id-name.js
new file mode 100644
index 0000000000..8fea1f46c4
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-star-id-name.js
@@ -0,0 +1,48 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Namespace object reports properties for any valid exported IdentifierName.
+esid: sec-imports
+info: |
+ [...]
+ 5. For each ExportEntry Record e in module.[[LocalExportEntries]], do
+ a. Assert: module provides the direct binding for this export.
+ b. Append e.[[ExportName]] to exportedNames.
+ [...]
+flags: [module]
+---*/
+
+var _if = null;
+var _import = null;
+var _export = null;
+var _await = null;
+var _arguments = null;
+var _eval = null;
+var _default = null;
+var as = null;
+
+export {
+ _if as if,
+ _import as import,
+ _export as export,
+ _await as await,
+ _arguments as arguments,
+ _eval as eval,
+ _default as default,
+ as as as
+ };
+
+import * as ns from './instn-star-id-name.js';
+
+assert('if' in ns, 'property name: if');
+assert('import' in ns, 'property name: import');
+assert('export' in ns, 'property name: export');
+assert('await' in ns, 'property name: await');
+assert('arguments' in ns, 'property name: arguments');
+assert('eval' in ns, 'property name: eval');
+assert('default' in ns, 'property name: default');
+assert('as' in ns, 'property name: as');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-star-iee-cycle-2_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-star-iee-cycle-2_FIXTURE.js
new file mode 100644
index 0000000000..892e02a911
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-star-iee-cycle-2_FIXTURE.js
@@ -0,0 +1,17 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export { b as a } from './instn-star-iee-cycle.js';
+export { d as c } from './instn-star-iee-cycle.js';
+export { f as e } from './instn-star-iee-cycle.js';
+export { h as g } from './instn-star-iee-cycle.js';
+export { j as i } from './instn-star-iee-cycle.js';
+export { l as k } from './instn-star-iee-cycle.js';
+export { n as m } from './instn-star-iee-cycle.js';
+export { p as o } from './instn-star-iee-cycle.js';
+export { r as q } from './instn-star-iee-cycle.js';
+export { t as s } from './instn-star-iee-cycle.js';
+export { v as u } from './instn-star-iee-cycle.js';
+export { x as w } from './instn-star-iee-cycle.js';
+export { z as y } from './instn-star-iee-cycle.js';
diff --git a/js/src/tests/test262/language/module-code/instn-star-iee-cycle.js b/js/src/tests/test262/language/module-code/instn-star-iee-cycle.js
new file mode 100644
index 0000000000..3dbb85d9bd
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-star-iee-cycle.js
@@ -0,0 +1,58 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ There are no restrictions on the number of cycles during module traversal
+ during indirect export resolution, given unique export names.
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 12. For each ImportEntry Record in in module.[[ImportEntries]], do
+ a. Let importedModule be ? HostResolveImportedModule(module,
+ in.[[ModuleRequest]]).
+ b. If in.[[ImportName]] is "*", then
+ i. Let namespace be ? GetModuleNamespace(importedModule).
+ ii. Perform ! envRec.CreateImmutableBinding(in.[[LocalName]], true).
+ iii. Call envRec.InitializeBinding(in.[[LocalName]], namespace).
+ [...]
+
+ 15.2.1.16.3 ResolveExport( exportName, resolveSet, exportStarSet )
+
+ 2. For each Record {[[Module]], [[ExportName]]} r in resolveSet, do:
+ a. If module and r.[[Module]] are the same Module Record and
+ SameValue(exportName, r.[[ExportName]]) is true, then
+ i. Assert: this is a circular import request.
+ ii. Return null.
+ 3. Append the Record {[[Module]]: module, [[ExportName]]: exportName} to resolveSet.
+ [...]
+ 5. For each ExportEntry Record e in module.[[IndirectExportEntries]], do
+ a. If SameValue(exportName, e.[[ExportName]]) is true, then
+ i. Assert: module imports a specific binding for this export.
+ ii. Let importedModule be ? HostResolveImportedModule(module,
+ e.[[ModuleRequest]]).
+ iii. Let indirectResolution be ?
+ importedModule.ResolveExport(e.[[ImportName]], resolveSet,
+ exportStarSet).
+ iv. If indirectResolution is not null, return indirectResolution.
+flags: [module]
+---*/
+
+import * as ns from './instn-star-iee-cycle-2_FIXTURE.js';
+export { c as b } from './instn-star-iee-cycle-2_FIXTURE.js';
+export { e as d } from './instn-star-iee-cycle-2_FIXTURE.js';
+export { g as f } from './instn-star-iee-cycle-2_FIXTURE.js';
+export { i as h } from './instn-star-iee-cycle-2_FIXTURE.js';
+export { k as j } from './instn-star-iee-cycle-2_FIXTURE.js';
+export { m as l } from './instn-star-iee-cycle-2_FIXTURE.js';
+export { o as n } from './instn-star-iee-cycle-2_FIXTURE.js';
+export { q as p } from './instn-star-iee-cycle-2_FIXTURE.js';
+export { s as r } from './instn-star-iee-cycle-2_FIXTURE.js';
+export { u as t } from './instn-star-iee-cycle-2_FIXTURE.js';
+export { w as v } from './instn-star-iee-cycle-2_FIXTURE.js';
+export { y as x } from './instn-star-iee-cycle-2_FIXTURE.js';
+export var z = 23;
+
+assert.sameValue(ns.a, 23);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-star-props-circular-a_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-star-props-circular-a_FIXTURE.js
new file mode 100644
index 0000000000..bbd0a160db
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-star-props-circular-a_FIXTURE.js
@@ -0,0 +1,6 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export * from './instn-star-props-circular-b_FIXTURE.js';
+export var fromA;
diff --git a/js/src/tests/test262/language/module-code/instn-star-props-circular-b_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-star-props-circular-b_FIXTURE.js
new file mode 100644
index 0000000000..1c86f95a9a
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-star-props-circular-b_FIXTURE.js
@@ -0,0 +1,6 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export * from './instn-star-props-circular-a_FIXTURE.js';
+export var fromB;
diff --git a/js/src/tests/test262/language/module-code/instn-star-props-circular.js b/js/src/tests/test262/language/module-code/instn-star-props-circular.js
new file mode 100644
index 0000000000..4a134bed9f
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-star-props-circular.js
@@ -0,0 +1,43 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Circular "star" imports do not trigger infinite recursion during name
+ enumeration.
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 12. For each ImportEntry Record in in module.[[ImportEntries]], do
+ a. Let importedModule be ? HostResolveImportedModule(module,
+ in.[[ModuleRequest]]).
+ b. If in.[[ImportName]] is "*", then
+ i. Let namespace be ? GetModuleNamespace(importedModule).
+ [...]
+
+ 15.2.1.18 Runtime Semantics: GetModuleNamespace
+
+ [...]
+ 3. If namespace is undefined, then
+ a. Let exportedNames be ? module.GetExportedNames(« »).
+ [...]
+
+ 15.2.1.16.2 GetExportedNames
+
+ 1. Let module be this Source Text Module Record.
+ 2. If exportStarSet contains module, then
+ a. Assert: We've reached the starting point of an import * circularity.
+ b. Return a new empty List.
+flags: [module]
+---*/
+
+import * as a from './instn-star-props-circular-a_FIXTURE.js';
+import * as b from './instn-star-props-circular-b_FIXTURE.js';
+
+assert('fromA' in a, 'entry for binding from "a" in namespace of module A');
+assert('fromB' in a, 'entry for binding from "b" in namespace of module A');
+
+assert('fromA' in b, 'entry for binding from "a" in namespace of module B');
+assert('fromB' in b, 'entry for binding from "b" in namespace of module B');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-star-props-dflt-keep-indirect-def_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-star-props-dflt-keep-indirect-def_FIXTURE.js
new file mode 100644
index 0000000000..9a7ebc9670
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-star-props-dflt-keep-indirect-def_FIXTURE.js
@@ -0,0 +1,5 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export default null;
diff --git a/js/src/tests/test262/language/module-code/instn-star-props-dflt-keep-indirect-reexport_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-star-props-dflt-keep-indirect-reexport_FIXTURE.js
new file mode 100644
index 0000000000..a9559b7f66
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-star-props-dflt-keep-indirect-reexport_FIXTURE.js
@@ -0,0 +1,5 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export { default } from './instn-star-props-dflt-keep-indirect-def_FIXTURE.js';
diff --git a/js/src/tests/test262/language/module-code/instn-star-props-dflt-keep-indirect.js b/js/src/tests/test262/language/module-code/instn-star-props-dflt-keep-indirect.js
new file mode 100644
index 0000000000..6f8ca550ca
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-star-props-dflt-keep-indirect.js
@@ -0,0 +1,38 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Indirect default exports are included in the module namespace object
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 12. For each ImportEntry Record in in module.[[ImportEntries]], do
+ a. Let importedModule be ? HostResolveImportedModule(module,
+ in.[[ModuleRequest]]).
+ b. If in.[[ImportName]] is "*", then
+ i. Let namespace be ? GetModuleNamespace(importedModule).
+ [...]
+
+ 15.2.1.18 Runtime Semantics: GetModuleNamespace
+
+ [...]
+ 3. If namespace is undefined, then
+ a. Let exportedNames be ? module.GetExportedNames(« »).
+ [...]
+
+ 15.2.1.16.2 GetExportedNames
+
+ [...]
+ 6. For each ExportEntry Record e in module.[[IndirectExportEntries]], do
+ a. Assert: module imports a specific binding for this export.
+ b. Append e.[[ExportName]] to exportedNames.
+ [...]
+flags: [module]
+---*/
+
+import * as ns from './instn-star-props-dflt-keep-indirect-reexport_FIXTURE.js';
+
+assert.sameValue('default' in ns, true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-star-props-dflt-keep-local-named_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-star-props-dflt-keep-local-named_FIXTURE.js
new file mode 100644
index 0000000000..f55faaa95a
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-star-props-dflt-keep-local-named_FIXTURE.js
@@ -0,0 +1,6 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+var x = null;
+export { x as default };
diff --git a/js/src/tests/test262/language/module-code/instn-star-props-dflt-keep-local-prod_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-star-props-dflt-keep-local-prod_FIXTURE.js
new file mode 100644
index 0000000000..9a7ebc9670
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-star-props-dflt-keep-local-prod_FIXTURE.js
@@ -0,0 +1,5 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export default null;
diff --git a/js/src/tests/test262/language/module-code/instn-star-props-dflt-keep-local.js b/js/src/tests/test262/language/module-code/instn-star-props-dflt-keep-local.js
new file mode 100644
index 0000000000..892608c400
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-star-props-dflt-keep-local.js
@@ -0,0 +1,43 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Local default exports are included in the module namespace object
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 12. For each ImportEntry Record in in module.[[ImportEntries]], do
+ a. Let importedModule be ? HostResolveImportedModule(module,
+ in.[[ModuleRequest]]).
+ b. If in.[[ImportName]] is "*", then
+ i. Let namespace be ? GetModuleNamespace(importedModule).
+ [...]
+
+ 15.2.1.18 Runtime Semantics: GetModuleNamespace
+
+ [...]
+ 3. If namespace is undefined, then
+ a. Let exportedNames be ? module.GetExportedNames(« »).
+ [...]
+
+ 15.2.1.16.2 GetExportedNames
+
+ [...]
+ 5. For each ExportEntry Record e in module.[[LocalExportEntries]], do
+ a. Assert: module provides the direct binding for this export.
+ b. Append e.[[ExportName]] to exportedNames.
+ [...]
+flags: [module]
+---*/
+
+import * as named from './instn-star-props-dflt-keep-local-named_FIXTURE.js';
+import * as production from './instn-star-props-dflt-keep-local-prod_FIXTURE.js';
+
+assert.sameValue('default' in named, true, 'default specified via identifier');
+
+assert.sameValue(
+ 'default' in production, true, 'default specified via dedicated production'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-star-props-dflt-skip-named_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-star-props-dflt-skip-named_FIXTURE.js
new file mode 100644
index 0000000000..e0bb99e691
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-star-props-dflt-skip-named_FIXTURE.js
@@ -0,0 +1,7 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+var x;
+export var namedOther = null;
+export { x as default };
diff --git a/js/src/tests/test262/language/module-code/instn-star-props-dflt-skip-prod_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-star-props-dflt-skip-prod_FIXTURE.js
new file mode 100644
index 0000000000..4dc29295f6
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-star-props-dflt-skip-prod_FIXTURE.js
@@ -0,0 +1,6 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export var productionOther = null;
+export default null;
diff --git a/js/src/tests/test262/language/module-code/instn-star-props-dflt-skip-star-as-named-end_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-star-props-dflt-skip-star-as-named-end_FIXTURE.js
new file mode 100644
index 0000000000..28d0220546
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-star-props-dflt-skip-star-as-named-end_FIXTURE.js
@@ -0,0 +1,7 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2018 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+var x;
+export var namedOther = null;
+export { x as default };
diff --git a/js/src/tests/test262/language/module-code/instn-star-props-dflt-skip-star-as-named_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-star-props-dflt-skip-star-as-named_FIXTURE.js
new file mode 100644
index 0000000000..7f6a494161
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-star-props-dflt-skip-star-as-named_FIXTURE.js
@@ -0,0 +1,5 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2018 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export * as named from './instn-star-props-dflt-skip-star-as-named-end_FIXTURE.js';
diff --git a/js/src/tests/test262/language/module-code/instn-star-props-dflt-skip-star-as-prod-end_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-star-props-dflt-skip-star-as-prod-end_FIXTURE.js
new file mode 100644
index 0000000000..2b837fe225
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-star-props-dflt-skip-star-as-prod-end_FIXTURE.js
@@ -0,0 +1,6 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2018 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export var productionOther = null;
+export default null;
diff --git a/js/src/tests/test262/language/module-code/instn-star-props-dflt-skip-star-as-prod_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-star-props-dflt-skip-star-as-prod_FIXTURE.js
new file mode 100644
index 0000000000..afc12ff886
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-star-props-dflt-skip-star-as-prod_FIXTURE.js
@@ -0,0 +1,5 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2018 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export * as production from './instn-star-props-dflt-skip-star-as-prod-end_FIXTURE.js';
diff --git a/js/src/tests/test262/language/module-code/instn-star-props-dflt-skip-star-named_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-star-props-dflt-skip-star-named_FIXTURE.js
new file mode 100644
index 0000000000..148d4d8650
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-star-props-dflt-skip-star-named_FIXTURE.js
@@ -0,0 +1,5 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export * from './instn-star-props-dflt-skip-named_FIXTURE.js';
diff --git a/js/src/tests/test262/language/module-code/instn-star-props-dflt-skip-star-prod_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-star-props-dflt-skip-star-prod_FIXTURE.js
new file mode 100644
index 0000000000..26c0697032
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-star-props-dflt-skip-star-prod_FIXTURE.js
@@ -0,0 +1,5 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export * from './instn-star-props-dflt-skip-prod_FIXTURE.js';
diff --git a/js/src/tests/test262/language/module-code/instn-star-props-dflt-skip.js b/js/src/tests/test262/language/module-code/instn-star-props-dflt-skip.js
new file mode 100644
index 0000000000..953f03a2db
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-star-props-dflt-skip.js
@@ -0,0 +1,48 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Default exports are not included in the module namespace object
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 12. For each ImportEntry Record in in module.[[ImportEntries]], do
+ a. Let importedModule be ? HostResolveImportedModule(module,
+ in.[[ModuleRequest]]).
+ b. If in.[[ImportName]] is "*", then
+ i. Let namespace be ? GetModuleNamespace(importedModule).
+ [...]
+
+ 15.2.1.18 Runtime Semantics: GetModuleNamespace
+
+ [...]
+ 3. If namespace is undefined, then
+ a. Let exportedNames be ? module.GetExportedNames(« »).
+ [...]
+
+ 15.2.1.16.2 GetExportedNames
+
+ [...]
+ 7. For each ExportEntry Record e in module.[[StarExportEntries]], do
+ [...]
+ c. For each element n of starNames, do
+ i. If SameValue(n, "default") is false, then
+ [...]
+flags: [module]
+---*/
+
+import * as named from './instn-star-props-dflt-skip-star-named_FIXTURE.js';
+import * as production from './instn-star-props-dflt-skip-star-prod_FIXTURE.js';
+
+assert('namedOther' in named);
+assert.sameValue(
+ 'default' in named, false, 'default specified via identifier'
+);
+
+assert('productionOther' in production);
+assert.sameValue(
+ 'default' in production, false, 'default specified via dedicated production'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-star-props-nrml-1_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-star-props-nrml-1_FIXTURE.js
new file mode 100644
index 0000000000..7749021d51
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-star-props-nrml-1_FIXTURE.js
@@ -0,0 +1,27 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+var notExportedVar1;
+let notExportedLet1;
+const notExportedConst1 = null;
+function notExportedFunc1() {}
+function* notExportedGen1() {}
+class notExportedClass1 {}
+
+var localBindingId;
+
+export var localVarDecl;
+export let localLetDecl;
+export const localConstDecl = null;
+export function localFuncDecl() {}
+export function* localGenDecl() {}
+export class localClassDecl {}
+export { localBindingId };
+export { localBindingId as localIdName };
+export { indirectIdName } from './instn-star-props-nrml-indirect_FIXTURE.js';
+export { indirectIdName as indirectIdName2 } from './instn-star-props-nrml-indirect_FIXTURE.js';
+export * as namespaceBinding from './instn-star-props-nrml-indirect_FIXTURE.js';
+
+export * from './instn-star-props-nrml-star_FIXTURE.js';
+
diff --git a/js/src/tests/test262/language/module-code/instn-star-props-nrml-indirect_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-star-props-nrml-indirect_FIXTURE.js
new file mode 100644
index 0000000000..66c32a3891
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-star-props-nrml-indirect_FIXTURE.js
@@ -0,0 +1,6 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export var indirectIdName;
+export var starIndirectIdName;
diff --git a/js/src/tests/test262/language/module-code/instn-star-props-nrml-star_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-star-props-nrml-star_FIXTURE.js
new file mode 100644
index 0000000000..cc03136781
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-star-props-nrml-star_FIXTURE.js
@@ -0,0 +1,24 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+var notExportedVar2;
+let notExportedLet2;
+const notExportedConst2 = null;
+function notExportedFunc2() {}
+function* notExportedGen2() {}
+class notExportedClass2 {}
+
+var starBindingId;
+
+export var starVarDecl;
+export let starLetDecl;
+export const starConstDecl = null;
+export function starFuncDecl() {}
+export function* starGenDecl() {}
+export class starClassDecl {}
+export { starBindingId };
+export { starBindingId as starIdName };
+export { starIndirectIdName } from './instn-star-props-nrml-indirect_FIXTURE.js';
+export { starIndirectIdName as starIndirectIdName2 } from './instn-star-props-nrml-indirect_FIXTURE.js';
+export * as starIndirectNamespaceBinding from './instn-star-props-nrml-indirect_FIXTURE.js';
diff --git a/js/src/tests/test262/language/module-code/instn-star-props-nrml.js b/js/src/tests/test262/language/module-code/instn-star-props-nrml.js
new file mode 100644
index 0000000000..335d2b9983
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-star-props-nrml.js
@@ -0,0 +1,74 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Module namespace object reports properties for all ExportEntries of all
+ dependencies.
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 12. For each ImportEntry Record in in module.[[ImportEntries]], do
+ a. Let importedModule be ? HostResolveImportedModule(module,
+ in.[[ModuleRequest]]).
+ b. If in.[[ImportName]] is "*", then
+ i. Let namespace be ? GetModuleNamespace(importedModule).
+ [...]
+
+
+ 3. If namespace is undefined, then
+ a. Let exportedNames be ? module.GetExportedNames(« »).
+ b. Let unambiguousNames be a new empty List.
+ c. For each name that is an element of exportedNames,
+ i. Let resolution be ? module.ResolveExport(name, « », « »).
+ ii. If resolution is null, throw a SyntaxError exception.
+ iii. If resolution is not "ambiguous", append name to
+ unambiguousNames.
+ d. Let namespace be ModuleNamespaceCreate(module, unambiguousNames).
+flags: [module]
+features: [export-star-as-namespace-from-module]
+---*/
+
+import * as ns from './instn-star-props-nrml-1_FIXTURE.js';
+
+// Export entries defined by a directly-imported module
+assert('localVarDecl' in ns, 'localVarDecl');
+assert('localLetDecl' in ns, 'localLetDecl');
+assert('localConstDecl' in ns, 'localConstDecl');
+assert('localFuncDecl' in ns, 'localFuncDecl');
+assert('localGenDecl' in ns, 'localGenDecl');
+assert('localClassDecl' in ns, 'localClassDecl');
+assert('localBindingId' in ns, 'localBindingId');
+assert('localIdName' in ns, 'localIdName');
+assert('indirectIdName' in ns, 'indirectIdName');
+assert('indirectIdName2' in ns, 'indirectIdName2');
+assert('namespaceBinding' in ns, 'namespaceBinding');
+
+// Export entries defined by a re-exported module
+assert('starVarDecl' in ns, 'starVarDecl');
+assert('starLetDecl' in ns, 'starLetDecl');
+assert('starConstDecl' in ns, 'starConstDecl');
+assert('starFuncDecl' in ns, 'starFuncDecl');
+assert('starGenDecl' in ns, 'starGenDecl');
+assert('starClassDecl' in ns, 'starClassDecl');
+assert('starBindingId' in ns, 'starBindingId');
+assert('starIdName' in ns, 'starIdName');
+assert('starIndirectIdName' in ns, 'starIndirectIdName');
+assert('starIndirectIdName2' in ns, 'starIndirectIdName2');
+assert('starIndirectNamespaceBinding' in ns, 'starIndirectNamespaceBinding');
+
+// Bindings that were not exported from any module
+assert.sameValue('nonExportedVar1' in ns, false, 'nonExportedVar1');
+assert.sameValue('nonExportedVar2' in ns, false, 'nonExportedVar2');
+assert.sameValue('nonExportedLet1' in ns, false, 'nonExportedLet1');
+assert.sameValue('nonExportedLet2' in ns, false, 'nonExportedLet2');
+assert.sameValue('nonExportedConst1' in ns, false, 'nonExportedConst1');
+assert.sameValue('nonExportedConst2' in ns, false, 'nonExportedConst2');
+assert.sameValue('nonExportedFunc1' in ns, false, 'nonExportedFunc1');
+assert.sameValue('nonExportedFunc2' in ns, false, 'nonExportedFunc2');
+assert.sameValue('nonExportedGen1' in ns, false, 'nonExportedGen1');
+assert.sameValue('nonExportedGen2' in ns, false, 'nonExportedGen2');
+assert.sameValue('nonExportedClass1' in ns, false, 'nonExportedClass1');
+assert.sameValue('nonExportedClass2' in ns, false, 'nonExportedClass2');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-star-star-cycle-2_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-star-star-cycle-2_FIXTURE.js
new file mode 100644
index 0000000000..feb9ca5f2a
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-star-star-cycle-2_FIXTURE.js
@@ -0,0 +1,5 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export * from './instn-star-star-cycle-indirect-x_FIXTURE.js';
diff --git a/js/src/tests/test262/language/module-code/instn-star-star-cycle-indirect-x_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-star-star-cycle-indirect-x_FIXTURE.js
new file mode 100644
index 0000000000..05c827e0b9
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-star-star-cycle-indirect-x_FIXTURE.js
@@ -0,0 +1,9 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+// This module is visited two times:
+// First when resolving the "x" binding and then another time to resolve the
+// "y" binding.
+export { y as x } from './instn-star-star-cycle-2_FIXTURE.js';
+export var y = 45;
diff --git a/js/src/tests/test262/language/module-code/instn-star-star-cycle.js b/js/src/tests/test262/language/module-code/instn-star-star-cycle.js
new file mode 100644
index 0000000000..b0b3c23c7c
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-star-star-cycle.js
@@ -0,0 +1,50 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Modules can be visited more than once when resolving bindings through
+ "star" exports as long as the exportName is different each time.
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 12. For each ImportEntry Record in in module.[[ImportEntries]], do
+ a. Let importedModule be ? HostResolveImportedModule(module,
+ in.[[ModuleRequest]]).
+ b. If in.[[ImportName]] is "*", then
+ i. Let namespace be ? GetModuleNamespace(importedModule).
+ ii. Perform ! envRec.CreateImmutableBinding(in.[[LocalName]], true).
+ iii. Call envRec.InitializeBinding(in.[[LocalName]], namespace).
+ [...]
+
+ 15.2.1.16.3 ResolveExport( exportName, resolveSet )
+
+ [...]
+ 3. Append the Record {[[Module]]: module, [[ExportName]]: exportName} to resolveSet.
+ 4. For each ExportEntry Record e in module.[[LocalExportEntries]], do
+ a. If SameValue(exportName, e.[[ExportName]]) is true, then
+ i. Assert: module provides the direct binding for this export.
+ ii. Return Record{[[Module]]: module, [[BindingName]]: e.[[LocalName]]}.
+ 5. For each ExportEntry Record e in module.[[IndirectExportEntries]], do
+ a. If SameValue(exportName, e.[[ExportName]]) is true, then
+ i. Assert: module imports a specific binding for this export.
+ ii. Let importedModule be ? HostResolveImportedModule(module, e.[[ModuleRequest]]).
+ iii. Return ? importedModule.ResolveExport(e.[[ImportName]], resolveSet).
+ [...]
+ 8. For each ExportEntry Record e in module.[[StarExportEntries]], do
+ a. Let importedModule be ? HostResolveImportedModule(module, e.[[ModuleRequest]]).
+ b. Let resolution be ? importedModule.ResolveExport(exportName, resolveSet).
+ [...]
+ d. If resolution is not null, then
+ i. If starResolution is null, let starResolution be resolution.
+ [...]
+ 9. Return starResolution.
+flags: [module]
+---*/
+
+import * as ns from './instn-star-star-cycle-2_FIXTURE.js';
+
+assert.sameValue(ns.x, 45);
+assert.sameValue(ns.y, 45);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/instn-uniq-env-rec-other_FIXTURE.js b/js/src/tests/test262/language/module-code/instn-uniq-env-rec-other_FIXTURE.js
new file mode 100644
index 0000000000..61cea19ca2
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-uniq-env-rec-other_FIXTURE.js
@@ -0,0 +1,17 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+var first = 4;
+let second = 5;
+const third = 6;
+class fourth {}
+function fifth() {}
+function* sixth() {}
+
+var seventh = 7;
+let eighth = 8;
+const ninth = 9;
+class tenth {}
+function eleventh() {}
+function *twelfth() {}
diff --git a/js/src/tests/test262/language/module-code/instn-uniq-env-rec.js b/js/src/tests/test262/language/module-code/instn-uniq-env-rec.js
new file mode 100644
index 0000000000..1c3a8228dd
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/instn-uniq-env-rec.js
@@ -0,0 +1,74 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Modules have distinct environment records
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 6. Let env be NewModuleEnvironment(realm.[[GlobalEnv]]).
+ 7. Set module.[[Environment]] to env.
+ [...]
+
+ 8.1.2.6 NewModuleEnvironment (E)
+
+ 1. Let env be a new Lexical Environment.
+ [...]
+flags: [module]
+features: [generators]
+---*/
+
+import './instn-uniq-env-rec-other_FIXTURE.js'
+var first = 1;
+let second = 2;
+const third = 3;
+class fourth {}
+function fifth() { return 'fifth'; }
+function* sixth() { return 'sixth'; }
+
+assert.sameValue(first, 1);
+assert.sameValue(second, 2);
+assert.sameValue(third, 3);
+assert.sameValue(typeof fourth, 'function', 'class declaration');
+assert.sameValue(typeof fifth, 'function', 'function declaration');
+assert.sameValue(fifth(), 'fifth');
+assert.sameValue(typeof sixth, 'function', 'generator function declaration');
+assert.sameValue(sixth().next().value, 'sixth');
+
+// Two separate mechanisms are required to ensure that no binding has been
+// created for a given identifier. A "bare" reference should produce a
+// ReferenceError for non-existent bindings and uninitialized bindings. A
+// reference through the `typeof` operator should succeed for non-existent
+// bindings and initialized bindings. Only non-existent bindings satisfy both
+// tests.
+typeof seventh;
+assert.throws(ReferenceError, function() {
+ seventh;
+});
+
+typeof eight;
+assert.throws(ReferenceError, function() {
+ eighth;
+});
+
+typeof ninth;
+assert.throws(ReferenceError, function() {
+ ninth;
+});
+
+typeof tenth;
+assert.throws(ReferenceError, function() {
+ tenth;
+});
+
+typeof eleventh;
+assert.throws(ReferenceError, function() {
+ eleventh;
+});
+
+typeof twelfth;
+assert.throws(ReferenceError, function() {
+ twelfth;
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/invalid-private-names-call-expression-bad-reference.js b/js/src/tests/test262/language/module-code/invalid-private-names-call-expression-bad-reference.js
new file mode 100644
index 0000000000..6365656a98
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/invalid-private-names-call-expression-bad-reference.js
@@ -0,0 +1,41 @@
+// |reftest| error:SyntaxError module
+// This file was procedurally generated from the following sources:
+// - src/invalid-private-names/call-expression-bad-reference.case
+// - src/invalid-private-names/default/top-level-modulebody.template
+/*---
+description: bad reference in call expression (Invalid private names should throw a SyntaxError, top level of module body)
+esid: sec-static-semantics-early-errors
+features: [class-fields-private]
+flags: [generated, module]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ScriptBody:StatementList
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
+ as an argument is false unless the source code is eval code that is being
+ processed by a direct eval.
+
+ ModuleBody:ModuleItemList
+ It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
+ as an argument is false.
+
+
+ Static Semantics: AllPrivateNamesValid
+
+ MemberExpression : MemberExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+ CallExpression : CallExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+(() => {})().#x
diff --git a/js/src/tests/test262/language/module-code/invalid-private-names-call-expression-this.js b/js/src/tests/test262/language/module-code/invalid-private-names-call-expression-this.js
new file mode 100644
index 0000000000..b156043f34
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/invalid-private-names-call-expression-this.js
@@ -0,0 +1,41 @@
+// |reftest| error:SyntaxError module
+// This file was procedurally generated from the following sources:
+// - src/invalid-private-names/call-expression-this.case
+// - src/invalid-private-names/default/top-level-modulebody.template
+/*---
+description: this evaluated in call expression (Invalid private names should throw a SyntaxError, top level of module body)
+esid: sec-static-semantics-early-errors
+features: [class-fields-private]
+flags: [generated, module]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ScriptBody:StatementList
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
+ as an argument is false unless the source code is eval code that is being
+ processed by a direct eval.
+
+ ModuleBody:ModuleItemList
+ It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
+ as an argument is false.
+
+
+ Static Semantics: AllPrivateNamesValid
+
+ MemberExpression : MemberExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+ CallExpression : CallExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+(() => this)().#x
diff --git a/js/src/tests/test262/language/module-code/invalid-private-names-member-expression-bad-reference.js b/js/src/tests/test262/language/module-code/invalid-private-names-member-expression-bad-reference.js
new file mode 100644
index 0000000000..4062af349d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/invalid-private-names-member-expression-bad-reference.js
@@ -0,0 +1,41 @@
+// |reftest| error:SyntaxError module
+// This file was procedurally generated from the following sources:
+// - src/invalid-private-names/member-expression-bad-reference.case
+// - src/invalid-private-names/default/top-level-modulebody.template
+/*---
+description: bad reference in member expression (Invalid private names should throw a SyntaxError, top level of module body)
+esid: sec-static-semantics-early-errors
+features: [class-fields-private]
+flags: [generated, module]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ScriptBody:StatementList
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
+ as an argument is false unless the source code is eval code that is being
+ processed by a direct eval.
+
+ ModuleBody:ModuleItemList
+ It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
+ as an argument is false.
+
+
+ Static Semantics: AllPrivateNamesValid
+
+ MemberExpression : MemberExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+ CallExpression : CallExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+something.#x
diff --git a/js/src/tests/test262/language/module-code/invalid-private-names-member-expression-this.js b/js/src/tests/test262/language/module-code/invalid-private-names-member-expression-this.js
new file mode 100644
index 0000000000..ee0484d4aa
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/invalid-private-names-member-expression-this.js
@@ -0,0 +1,41 @@
+// |reftest| error:SyntaxError module
+// This file was procedurally generated from the following sources:
+// - src/invalid-private-names/member-expression-this.case
+// - src/invalid-private-names/default/top-level-modulebody.template
+/*---
+description: this reference in member expression (Invalid private names should throw a SyntaxError, top level of module body)
+esid: sec-static-semantics-early-errors
+features: [class-fields-private]
+flags: [generated, module]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ScriptBody:StatementList
+ It is a Syntax Error if AllPrivateNamesValid of StatementList with an empty List
+ as an argument is false unless the source code is eval code that is being
+ processed by a direct eval.
+
+ ModuleBody:ModuleItemList
+ It is a Syntax Error if AllPrivateNamesValid of ModuleItemList with an empty List
+ as an argument is false.
+
+
+ Static Semantics: AllPrivateNamesValid
+
+ MemberExpression : MemberExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+ CallExpression : CallExpression . PrivateName
+
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+---*/
+
+
+$DONOTEVALUATE();
+
+this.#x
diff --git a/js/src/tests/test262/language/module-code/namespace/Symbol.iterator.js b/js/src/tests/test262/language/module-code/namespace/Symbol.iterator.js
new file mode 100644
index 0000000000..07d4ad7b34
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/namespace/Symbol.iterator.js
@@ -0,0 +1,15 @@
+// |reftest| module
+// Copyright (C) 2016 Kevin Gibbons. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-@@iterator
+description: Module namespace objects lack a Symbol.iterator property.
+flags: [module]
+features: [Symbol.iterator]
+---*/
+
+import * as ns from './Symbol.iterator.js';
+
+assert.sameValue(Object.prototype.hasOwnProperty.call(ns, Symbol.iterator), false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/namespace/Symbol.toStringTag.js b/js/src/tests/test262/language/module-code/namespace/Symbol.toStringTag.js
new file mode 100644
index 0000000000..f0f2648eff
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/namespace/Symbol.toStringTag.js
@@ -0,0 +1,32 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+es6id: 26.3.1
+esid: sec-@@tostringtag
+description: >
+ `Symbol.toStringTag` property descriptor
+info: |
+ The initial value of the @@toStringTag property is the String value
+ "Module".
+
+ This property has the attributes { [[Writable]]: false, [[Enumerable]]:
+ false, [[Configurable]]: false }.
+flags: [module]
+features: [Symbol.toStringTag]
+---*/
+
+import * as ns from './Symbol.toStringTag.js';
+assert.sameValue(ns[Symbol.toStringTag], 'Module');
+
+// propertyHelper.js is not appropriate for this test because it assumes that
+// the object exposes the ordinary object's implementation of [[Get]], [[Set]],
+// [[Delete]], and [[OwnPropertyKeys]], which the module namespace exotic
+// object does not.
+var desc = Object.getOwnPropertyDescriptor(ns, Symbol.toStringTag);
+
+assert.sameValue(desc.enumerable, false, 'reports as non-enumerable');
+assert.sameValue(desc.writable, false, 'reports as non-writable');
+assert.sameValue(desc.configurable, false, 'reports as non-configurable');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/namespace/browser.js b/js/src/tests/test262/language/module-code/namespace/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/namespace/browser.js
diff --git a/js/src/tests/test262/language/module-code/namespace/internals/browser.js b/js/src/tests/test262/language/module-code/namespace/internals/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/namespace/internals/browser.js
diff --git a/js/src/tests/test262/language/module-code/namespace/internals/define-own-property.js b/js/src/tests/test262/language/module-code/namespace/internals/define-own-property.js
new file mode 100644
index 0000000000..bb3f73fe0e
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/namespace/internals/define-own-property.js
@@ -0,0 +1,140 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-module-namespace-exotic-objects-defineownproperty-p-desc
+description: >
+ The [[DefineOwnProperty]] internal method returns `true` if no change is
+ requested, and `false` otherwise.
+flags: [module]
+features: [Symbol.iterator, Reflect, Symbol, Symbol.toStringTag]
+---*/
+
+import * as ns from './define-own-property.js';
+export var local1;
+var local2;
+export { local2 as renamed };
+export { local1 as indirect } from './define-own-property.js';
+var sym = Symbol('test262');
+
+const exported = ['local1', 'renamed', 'indirect'];
+
+
+// Non-existant properties.
+
+for (const key of ['local2', 0, sym, Symbol.iterator]) {
+ assert.sameValue(
+ Reflect.defineProperty(ns, key, {}),
+ false,
+ 'Reflect.defineProperty: ' + key.toString()
+ );
+ assert.throws(TypeError, function() {
+ Object.defineProperty(ns, key, {});
+ }, 'Object.defineProperty: ' + key.toString());
+}
+
+
+// Own properties. No change requested.
+
+for (const key of ([...exported, Symbol.toStringTag])) {
+ assert.sameValue(
+ Reflect.defineProperty(ns, key, {}),
+ true,
+ 'Reflect.defineProperty: ' + key.toString()
+ );
+ assert.sameValue(
+ Object.defineProperty(ns, key, {}),
+ ns,
+ 'Object.defineProperty: ' + key.toString()
+ );
+
+}
+
+assert.sameValue(
+ Reflect.defineProperty(ns, 'indirect',
+ {writable: true, enumerable: true, configurable: false}),
+ true,
+ 'Reflect.defineProperty: indirect'
+);
+assert.sameValue(
+ Object.defineProperty(ns, 'indirect',
+ {writable: true, enumerable: true, configurable: false}),
+ ns,
+ 'Object.defineProperty: indirect'
+);
+
+assert.sameValue(
+ Reflect.defineProperty(ns, Symbol.toStringTag,
+ {value: "Module", writable: false, enumerable: false,
+ configurable: false}),
+ true,
+ 'Reflect.defineProperty: Symbol.toStringTag'
+);
+assert.sameValue(
+ Object.defineProperty(ns, Symbol.toStringTag,
+ {value: "Module", writable: false, enumerable: false,
+ configurable: false}),
+ ns,
+ 'Object.defineProperty: Symbol.toStringTag'
+);
+
+
+// Own properties. Change requested.
+
+for (const key of ([...exported, Symbol.toStringTag])) {
+ assert.sameValue(
+ Reflect.defineProperty(ns, key, {value: 123}),
+ false,
+ 'Reflect.defineProperty: ' + key.toString()
+ );
+ assert.throws(TypeError, function() {
+ Object.defineProperty(ns, key, {value: 123});
+ }, 'Object.defineProperty: ' + key.toString());
+}
+
+assert.sameValue(
+ Reflect.defineProperty(ns, 'indirect',
+ {writable: true, enumerable: true, configurable: true}),
+ false,
+ 'Reflect.defineProperty: indirect'
+);
+assert.throws(TypeError, function() {
+ Object.defineProperty(ns, 'indirect',
+ {writable: true, enumerable: true, configurable: true});
+}, 'Object.defineProperty: indirect');
+
+assert.sameValue(
+ Reflect.defineProperty(ns, Symbol.toStringTag,
+ {value: "module", writable: false, enumerable: false,
+ configurable: false}),
+ false,
+ 'Reflect.defineProperty: Symbol.toStringTag'
+);
+assert.throws(TypeError, function() {
+ Object.defineProperty(ns, Symbol.toStringTag,
+ {value: "module", writable: false, enumerable: false,
+ configurable: false});
+}, 'Object.defineProperty: Symbol.toStringTag');
+
+
+// Indirect change requested through Object.freeze
+
+// Try freezing more times than there are exported properties
+for (let i = 1; i < exported.length + 2; i++) {
+ assert.throws(
+ TypeError,
+ function () {
+ Object.freeze(ns);
+ },
+ "Object.freeze: " + String(i)
+ );
+}
+
+for (const key of exported) {
+ const desc = Object.getOwnPropertyDescriptor(ns, key);
+ assert.sameValue(desc.writable, true, String(key) + " writable");
+}
+
+assert(!Object.isFrozen(ns), "namespace object not frozen");
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/namespace/internals/delete-exported-init.js b/js/src/tests/test262/language/module-code/namespace/internals/delete-exported-init.js
new file mode 100644
index 0000000000..e39fded73a
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/namespace/internals/delete-exported-init.js
@@ -0,0 +1,49 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-module-namespace-exotic-objects-delete-p
+description: >
+ [[Delete]] behavior for a key that describes an initialized exported
+ binding
+info: |
+ [...]
+ 2. Let exports be the value of O's [[Exports]] internal slot.
+ 3. If P is an element of exports, return false.
+flags: [module]
+features: [Reflect]
+---*/
+
+import * as ns from './delete-exported-init.js';
+export var local1 = 333;
+var local2 = 444;
+export { local2 as renamed };
+export { local1 as indirect } from './delete-exported-init.js';
+
+assert.throws(TypeError, function() {
+ delete ns.local1;
+}, 'delete: local1');
+assert.sameValue(
+ Reflect.deleteProperty(ns, 'local1'), false, 'Reflect.deleteProperty: local1'
+);
+assert.sameValue(ns.local1, 333, 'binding unmodified: local1');
+
+assert.throws(TypeError, function() {
+ delete ns.renamed;
+}, 'delete: renamed');
+assert.sameValue(
+ Reflect.deleteProperty(ns, 'renamed'), false, 'Reflect.deleteProperty: renamed'
+);
+assert.sameValue(ns.renamed, 444, 'binding unmodified: renamed');
+
+assert.throws(TypeError, function() {
+ delete ns.indirect;
+}, 'delete: indirect');
+assert.sameValue(
+ Reflect.deleteProperty(ns, 'indirect'),
+ false,
+ 'Reflect.deleteProperty: indirect'
+);
+assert.sameValue(ns.indirect, 333, 'binding unmodified: indirect');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/namespace/internals/delete-exported-uninit.js b/js/src/tests/test262/language/module-code/namespace/internals/delete-exported-uninit.js
new file mode 100644
index 0000000000..c32997b35d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/namespace/internals/delete-exported-uninit.js
@@ -0,0 +1,69 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-module-namespace-exotic-objects-delete-p
+description: >
+ [[Delete]] behavior for a key that describes an uninitialized exported
+ binding
+info: |
+ [...]
+ 2. Let exports be the value of O's [[Exports]] internal slot.
+ 3. If P is an element of exports, return false.
+flags: [module]
+features: [Reflect, let]
+---*/
+
+import * as ns from './delete-exported-uninit.js';
+
+assert.throws(TypeError, function() {
+ delete ns.local1;
+}, 'delete: local1');
+assert.sameValue(
+ Reflect.deleteProperty(ns, 'local1'), false, 'Reflect.deleteProperty: local1'
+);
+assert.throws(ReferenceError, function() {
+ ns.local1;
+}, 'binding unmodified: local1');
+
+assert.throws(TypeError, function() {
+ delete ns.renamed;
+}, 'delete: renamed');
+assert.sameValue(
+ Reflect.deleteProperty(ns, 'renamed'), false, 'Reflect.deleteProperty: renamed'
+);
+assert.throws(ReferenceError, function() {
+ ns.renamed;
+}, 'binding unmodified: renamed');
+
+assert.throws(TypeError, function() {
+ delete ns.indirect;
+}, 'delete: indirect');
+assert.sameValue(
+ Reflect.deleteProperty(ns, 'indirect'),
+ false,
+ 'Reflect.deleteProperty: indirect'
+);
+assert.throws(ReferenceError, function() {
+ ns.indirect;
+}, 'binding unmodified: indirect');
+
+assert.throws(TypeError, function() {
+ delete ns.default;
+}, 'delete: default');
+assert.sameValue(
+ Reflect.deleteProperty(ns, 'default'),
+ false,
+ 'Reflect.deleteProperty: default'
+);
+assert.throws(ReferenceError, function() {
+ ns.default;
+}, 'binding unmodified: default');
+
+export let local1 = 23;
+let local2 = 45;
+export { local2 as renamed };
+export { local1 as indirect } from './delete-exported-uninit.js';
+export default null;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/namespace/internals/delete-non-exported.js b/js/src/tests/test262/language/module-code/namespace/internals/delete-non-exported.js
new file mode 100644
index 0000000000..b7d13bc747
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/namespace/internals/delete-non-exported.js
@@ -0,0 +1,39 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-module-namespace-exotic-objects-delete-p
+description: >
+ [[Delete]] behavior for a key that does not describe an exported binding
+info: |
+ [...]
+ 2. If Type(P) is Symbol, then
+ a. Return ? OrdinaryDelete(O, P).
+ 3. Let exports be O.[[Exports]].
+ 4. If P is an element of exports, return false.
+ 5. Return true.
+flags: [module]
+features: [Reflect, Symbol, Symbol.toStringTag]
+---*/
+
+import * as ns from './delete-non-exported.js';
+var sym = Symbol('test262');
+
+assert(delete ns.undef, 'delete: undef');
+assert(Reflect.deleteProperty(ns, 'undef'), 'Reflect.deleteProperty: undef');
+
+assert(delete ns.default, 'delete: default');
+assert(
+ Reflect.deleteProperty(ns, 'default'), 'Reflect.deleteProperty: default'
+);
+
+assert.throws(TypeError, function() { delete ns[Symbol.toStringTag]; }, 'delete: Symbol.toStringTag');
+assert.sameValue(
+ Reflect.deleteProperty(ns, Symbol.toStringTag), false,
+ 'Reflect.deleteProperty: Symbol.toStringTag'
+);
+
+assert(delete ns[sym], 'delete: symbol');
+assert(Reflect.deleteProperty(ns, sym), 'Reflect.deleteProperty: symbol');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/namespace/internals/enumerate-binding-uninit.js b/js/src/tests/test262/language/module-code/namespace/internals/enumerate-binding-uninit.js
new file mode 100644
index 0000000000..ee8107ebc4
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/namespace/internals/enumerate-binding-uninit.js
@@ -0,0 +1,45 @@
+// |reftest| module
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-enumerate-object-properties
+description: >
+ Test for-in enumeration with uninitialized binding.
+info: |
+ 13.7.5.15 EnumerateObjectProperties (O)
+ ...
+ EnumerateObjectProperties must obtain the own property keys of the
+ target object by calling its [[OwnPropertyKeys]] internal method.
+ Property attributes of the target object must be obtained by
+ calling its [[GetOwnProperty]] internal method.
+
+ 9.4.6.4 [[GetOwnProperty]] (P)
+ ...
+ 4. Let value be ? O.[[Get]](P, O).
+ ...
+
+ 9.4.6.7 [[Get]] (P, Receiver)
+ ...
+ 12. Let targetEnvRec be targetEnv's EnvironmentRecord.
+ 13. Return ? targetEnvRec.GetBindingValue(binding.[[BindingName]], true).
+
+ 8.1.1.1.6 GetBindingValue ( N, S )
+ ...
+ If the binding for N in envRec is an uninitialized binding, throw a ReferenceError exception.
+ ...
+
+flags: [module]
+---*/
+
+import* as self from "./enumerate-binding-uninit.js";
+
+assert.throws(ReferenceError, function() {
+ for (var key in self) {
+ throw new Test262Error();
+ }
+});
+
+export default 0;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/namespace/internals/get-nested-namespace-dflt-skip-named-end_FIXTURE.js b/js/src/tests/test262/language/module-code/namespace/internals/get-nested-namespace-dflt-skip-named-end_FIXTURE.js
new file mode 100644
index 0000000000..28d0220546
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/namespace/internals/get-nested-namespace-dflt-skip-named-end_FIXTURE.js
@@ -0,0 +1,7 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2018 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+var x;
+export var namedOther = null;
+export { x as default };
diff --git a/js/src/tests/test262/language/module-code/namespace/internals/get-nested-namespace-dflt-skip-named_FIXTURE.js b/js/src/tests/test262/language/module-code/namespace/internals/get-nested-namespace-dflt-skip-named_FIXTURE.js
new file mode 100644
index 0000000000..9967b92744
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/namespace/internals/get-nested-namespace-dflt-skip-named_FIXTURE.js
@@ -0,0 +1,5 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2018 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export * as namedns2 from './get-nested-namespace-dflt-skip-named-end_FIXTURE.js';
diff --git a/js/src/tests/test262/language/module-code/namespace/internals/get-nested-namespace-dflt-skip-prod-end_FIXTURE.js b/js/src/tests/test262/language/module-code/namespace/internals/get-nested-namespace-dflt-skip-prod-end_FIXTURE.js
new file mode 100644
index 0000000000..2b837fe225
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/namespace/internals/get-nested-namespace-dflt-skip-prod-end_FIXTURE.js
@@ -0,0 +1,6 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2018 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export var productionOther = null;
+export default null;
diff --git a/js/src/tests/test262/language/module-code/namespace/internals/get-nested-namespace-dflt-skip-prod_FIXTURE.js b/js/src/tests/test262/language/module-code/namespace/internals/get-nested-namespace-dflt-skip-prod_FIXTURE.js
new file mode 100644
index 0000000000..927338724b
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/namespace/internals/get-nested-namespace-dflt-skip-prod_FIXTURE.js
@@ -0,0 +1,5 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2018 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export * as productionns2 from './get-nested-namespace-dflt-skip-prod-end_FIXTURE.js';
diff --git a/js/src/tests/test262/language/module-code/namespace/internals/get-nested-namespace-dflt-skip.js b/js/src/tests/test262/language/module-code/namespace/internals/get-nested-namespace-dflt-skip.js
new file mode 100644
index 0000000000..41bb7933bb
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/namespace/internals/get-nested-namespace-dflt-skip.js
@@ -0,0 +1,46 @@
+// |reftest| module
+// Copyright (C) 2018 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Default exports are included in an imported module namespace object when a namespace object is created.
+esid: sec-module-namespace-exotic-objects-get-p-receiver
+info: |
+ [...]
+ 6. Let binding be ! m.ResolveExport(P, « »).
+ 7. Assert: binding is a ResolvedBinding Record.
+ 8. Let targetModule be binding.[[Module]].
+ 9. Assert: targetModule is not undefined.
+ 10. If binding.[[BindingName]] is "*namespace*", then
+ 11. Return ? GetModuleNamespace(targetModule).
+
+ Runtime Semantics: GetModuleNamespace
+ [...]
+ 3. If namespace is undefined, then
+ a. Let exportedNames be ? module.GetExportedNames(« »).
+ b. Let unambiguousNames be a new empty List.
+ c. For each name that is an element of exportedNames,
+ i. Let resolution be ? module.ResolveExport(name, « », « »).
+ ii. If resolution is null, throw a SyntaxError exception.
+ iii. If resolution is not "ambiguous", append name to
+ unambiguousNames.
+ d. Let namespace be ModuleNamespaceCreate(module, unambiguousNames).
+ [...]
+flags: [module]
+features: [export-star-as-namespace-from-module]
+---*/
+
+import * as namedns1 from './get-nested-namespace-dflt-skip-named_FIXTURE.js';
+import * as productionns1 from './get-nested-namespace-dflt-skip-prod_FIXTURE.js';
+
+assert('namedOther' in namedns1.namedns2);
+assert.sameValue(
+ 'default' in namedns1.namedns2, true, 'default specified via identifier'
+);
+
+assert('productionOther' in productionns1.productionns2);
+assert.sameValue(
+ 'default' in productionns1.productionns2, true, 'default specified via dedicated production'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/namespace/internals/get-nested-namespace-props-nrml-1_FIXTURE.js b/js/src/tests/test262/language/module-code/namespace/internals/get-nested-namespace-props-nrml-1_FIXTURE.js
new file mode 100644
index 0000000000..3eb0886e15
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/namespace/internals/get-nested-namespace-props-nrml-1_FIXTURE.js
@@ -0,0 +1,5 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2018 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export * as exportns from './get-nested-namespace-props-nrml-2_FIXTURE.js';
diff --git a/js/src/tests/test262/language/module-code/namespace/internals/get-nested-namespace-props-nrml-2_FIXTURE.js b/js/src/tests/test262/language/module-code/namespace/internals/get-nested-namespace-props-nrml-2_FIXTURE.js
new file mode 100644
index 0000000000..7ec2cc2b4c
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/namespace/internals/get-nested-namespace-props-nrml-2_FIXTURE.js
@@ -0,0 +1,24 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2018 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+var notExportedVar;
+let notExportedLet;
+const notExportedConst = null;
+function notExportedFunc() {}
+function* notExportedGen() {}
+class notExportedClass {}
+
+var starAsBindingId;
+
+export var starAsVarDecl;
+export let starAsLetDecl;
+export const starAsConstDecl = null;
+export function starAsFuncDecl() {}
+export function* starAsGenDecl() {}
+export class starAsClassDecl {}
+export { starAsBindingId };
+export { starAsBindingId as starIdName };
+export { starAsIndirectIdName } from './get-nested-namespace-props-nrml-3_FIXTURE.js';
+export { starAsIndirectIdName as starAsIndirectIdName2 } from './get-nested-namespace-props-nrml-3_FIXTURE.js';
+export * as namespaceBinding from './get-nested-namespace-props-nrml-3_FIXTURE.js';;
diff --git a/js/src/tests/test262/language/module-code/namespace/internals/get-nested-namespace-props-nrml-3_FIXTURE.js b/js/src/tests/test262/language/module-code/namespace/internals/get-nested-namespace-props-nrml-3_FIXTURE.js
new file mode 100644
index 0000000000..11ccdef663
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/namespace/internals/get-nested-namespace-props-nrml-3_FIXTURE.js
@@ -0,0 +1,6 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export var indirectIdName;
+export var starAsIndirectIdName;
diff --git a/js/src/tests/test262/language/module-code/namespace/internals/get-nested-namespace-props-nrml.js b/js/src/tests/test262/language/module-code/namespace/internals/get-nested-namespace-props-nrml.js
new file mode 100644
index 0000000000..e6e52de774
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/namespace/internals/get-nested-namespace-props-nrml.js
@@ -0,0 +1,55 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Module namespace object reports properties for all ExportEntries of all
+ dependencies.
+esid: sec-moduledeclarationinstantiation
+info: |
+ [...]
+ 12. For each ImportEntry Record in in module.[[ImportEntries]], do
+ a. Let importedModule be ? HostResolveImportedModule(module,
+ in.[[ModuleRequest]]).
+ b. If in.[[ImportName]] is "*", then
+ i. Let namespace be ? GetModuleNamespace(importedModule).
+ [...]
+
+ Runtime Semantics: GetModuleNamespace
+ 3. If namespace is undefined, then
+ a. Let exportedNames be ? module.GetExportedNames(« »).
+ b. Let unambiguousNames be a new empty List.
+ c. For each name that is an element of exportedNames,
+ i. Let resolution be ? module.ResolveExport(name, « », « »).
+ ii. If resolution is null, throw a SyntaxError exception.
+ iii. If resolution is not "ambiguous", append name to
+ unambiguousNames.
+ d. Let namespace be ModuleNamespaceCreate(module, unambiguousNames).
+flags: [module]
+features: [export-star-as-namespace-from-module]
+---*/
+
+import * as ns from './get-nested-namespace-props-nrml-1_FIXTURE.js';
+
+// Export entries defined by a re-exported as exportns module
+assert('starAsVarDecl' in ns.exportns, 'starssVarDecl');
+assert('starAsLetDecl' in ns.exportns, 'starSsLetDecl');
+assert('starAsConstDecl' in ns.exportns, 'starSsConstDecl');
+assert('starAsFuncDecl' in ns.exportns, 'starAsFuncDecl');
+assert('starAsGenDecl' in ns.exportns, 'starAsGenDecl');
+assert('starAsClassDecl' in ns.exportns, 'starAsClassDecl');
+assert('starAsBindingId' in ns.exportns, 'starAsBindingId');
+assert('starIdName' in ns.exportns, 'starIdName');
+assert('starAsIndirectIdName' in ns.exportns, 'starAsIndirectIdName');
+assert('starAsIndirectIdName2' in ns.exportns, 'starAsIndirectIdName2');
+assert('namespaceBinding' in ns.exportns, 'namespaceBinding');
+
+// Bindings that were not exported from any module
+assert.sameValue('nonExportedVar' in ns.exportns, false, 'nonExportedVar');
+assert.sameValue('nonExportedLet' in ns.exportns, false, 'nonExportedLet');
+assert.sameValue('nonExportedConst' in ns.exportns, false, 'nonExportedConst');
+assert.sameValue('nonExportedFunc' in ns.exportns, false, 'nonExportedFunc');
+assert.sameValue('nonExportedGen' in ns.exportns, false, 'nonExportedGen');
+assert.sameValue('nonExportedClass' in ns.exportns, false, 'nonExportedClass');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/namespace/internals/get-own-property-str-found-init.js b/js/src/tests/test262/language/module-code/namespace/internals/get-own-property-str-found-init.js
new file mode 100644
index 0000000000..148a12b6cd
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/namespace/internals/get-own-property-str-found-init.js
@@ -0,0 +1,63 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-module-namespace-exotic-objects-getownproperty-p
+description: >
+ Behavior of the [[GetOwnProperty]] internal method with a string argument
+ describing an initialized binding
+info: |
+ 1. If Type(P) is Symbol, return OrdinaryGetOwnProperty(O, P).
+ 2. Let exports be the value of O's [[Exports]] internal slot.
+ 3. If P is not an element of exports, return undefined.
+ 4. Let value be ? O.[[Get]](P, O).
+ 5. Return PropertyDescriptor{[[Value]]: value, [[Writable]]: true,
+ [[Enumerable]]: true, [[Configurable]]: false }.
+flags: [module]
+---*/
+
+import * as ns from './get-own-property-str-found-init.js';
+export var local1 = 201;
+var local2 = 207;
+export { local2 as renamed };
+export { local1 as indirect } from './get-own-property-str-found-init.js';
+export default 302;
+var desc;
+
+assert.sameValue(
+ Object.prototype.hasOwnProperty.call(ns, 'local1'), true
+);
+desc = Object.getOwnPropertyDescriptor(ns, 'local1');
+assert.sameValue(desc.value, 201);
+assert.sameValue(desc.enumerable, true, 'local1 enumerable');
+assert.sameValue(desc.writable, true, 'local1 writable');
+assert.sameValue(desc.configurable, false, 'local1 configurable');
+
+assert.sameValue(
+ Object.prototype.hasOwnProperty.call(ns, 'renamed'), true
+);
+desc = Object.getOwnPropertyDescriptor(ns, 'renamed');
+assert.sameValue(desc.value, 207);
+assert.sameValue(desc.enumerable, true, 'renamed enumerable');
+assert.sameValue(desc.writable, true, 'renamed writable');
+assert.sameValue(desc.configurable, false, 'renamed configurable');
+
+assert.sameValue(
+ Object.prototype.hasOwnProperty.call(ns, 'indirect'), true
+);
+desc = Object.getOwnPropertyDescriptor(ns, 'indirect');
+assert.sameValue(desc.value, 201);
+assert.sameValue(desc.enumerable, true, 'indirect enumerable');
+assert.sameValue(desc.writable, true, 'indirect writable');
+assert.sameValue(desc.configurable, false, 'indirect configurable');
+
+assert.sameValue(
+ Object.prototype.hasOwnProperty.call(ns, 'default'), true
+);
+desc = Object.getOwnPropertyDescriptor(ns, 'default');
+assert.sameValue(desc.value, 302);
+assert.sameValue(desc.enumerable, true, 'default enumerable');
+assert.sameValue(desc.writable, true, 'default writable');
+assert.sameValue(desc.configurable, false, 'default configurable');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/namespace/internals/get-own-property-str-found-uninit.js b/js/src/tests/test262/language/module-code/namespace/internals/get-own-property-str-found-uninit.js
new file mode 100644
index 0000000000..0060850171
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/namespace/internals/get-own-property-str-found-uninit.js
@@ -0,0 +1,54 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-module-namespace-exotic-objects-getownproperty-p
+description: >
+ Behavior of the [[GetOwnProperty]] internal method with a string argument
+ describing an uninitialized binding
+info: |
+ 1. If Type(P) is Symbol, return OrdinaryGetOwnProperty(O, P).
+ 2. Let exports be the value of O's [[Exports]] internal slot.
+ 3. If P is not an element of exports, return undefined.
+ 4. Let value be ? O.[[Get]](P, O).
+flags: [module]
+features: [let]
+---*/
+
+import * as ns from './get-own-property-str-found-uninit.js';
+
+assert.throws(ReferenceError, function() {
+ Object.prototype.hasOwnProperty.call(ns, 'local1');
+}, 'hasOwnProperty: local1');
+assert.throws(ReferenceError, function() {
+ Object.getOwnPropertyDescriptor(ns, 'local1');
+}, 'getOwnPropertyDescriptor: local1');
+
+assert.throws(ReferenceError, function() {
+ Object.prototype.hasOwnProperty.call(ns, 'renamed');
+}, 'hasOwnProperty: renamed');
+assert.throws(ReferenceError, function() {
+ Object.getOwnPropertyDescriptor(ns, 'renamed');
+}, 'getOwnPropertyDescriptor: renamed');
+
+assert.throws(ReferenceError, function() {
+ Object.prototype.hasOwnProperty.call(ns, 'indirect');
+}, 'hasOwnProperty: indirect');
+assert.throws(ReferenceError, function() {
+ Object.getOwnPropertyDescriptor(ns, 'indirect');
+}, 'getOwnPropertyDescriptor: indirect');
+
+assert.throws(ReferenceError, function() {
+ Object.prototype.hasOwnProperty.call(ns, 'default');
+}, 'hasOwnProperty: default');
+assert.throws(ReferenceError, function() {
+ Object.getOwnPropertyDescriptor(ns, 'default');
+}, 'getOwnPropertyDescriptor: default');
+
+export let local1 = 23;
+let local2 = 45;
+export { local2 as renamed };
+export { local1 as indirect } from './get-own-property-str-found-uninit.js';
+export default null;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/namespace/internals/get-own-property-str-not-found.js b/js/src/tests/test262/language/module-code/namespace/internals/get-own-property-str-not-found.js
new file mode 100644
index 0000000000..0a2c9e4460
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/namespace/internals/get-own-property-str-not-found.js
@@ -0,0 +1,69 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-module-namespace-exotic-objects-getownproperty-p
+description: >
+ Behavior of the [[GetOwnProperty]] internal method with a string argument
+ describing a binding that cannot be found
+info: |
+ 1. If Type(P) is Symbol, return OrdinaryGetOwnProperty(O, P).
+ 2. Let exports be the value of O's [[Exports]] internal slot.
+ 3. If P is not an element of exports, return undefined.
+flags: [module]
+---*/
+
+import * as ns from './get-own-property-str-not-found.js';
+var test262;
+export { test262 as anotherName };
+var desc;
+
+assert.sameValue(
+ Object.prototype.hasOwnProperty.call(ns, 'test262'),
+ false,
+ 'hasOwnProperty: test262'
+);
+desc = Object.getOwnPropertyDescriptor(ns, 'test262');
+assert.sameValue(desc, undefined, 'property descriptor for "test262"');
+
+assert.sameValue(
+ Object.prototype.hasOwnProperty.call(ns, 'desc'),
+ false,
+ 'hasOwnProperty: desc'
+);
+desc = Object.getOwnPropertyDescriptor(ns, 'desc');
+assert.sameValue(desc, undefined, 'property descriptor for "desc"');
+
+assert.sameValue(
+ Object.prototype.hasOwnProperty.call(ns, 'toStringTag'),
+ false,
+ 'hasOwnProperty: toStringTag'
+);
+desc = Object.getOwnPropertyDescriptor(ns, 'toStringTag');
+assert.sameValue(desc, undefined, 'property descriptor for "toStringTag"');
+
+assert.sameValue(
+ Object.prototype.hasOwnProperty.call(ns, 'iterator'),
+ false,
+ 'hasOwnProperty: iterator'
+);
+desc = Object.getOwnPropertyDescriptor(ns, 'iterator');
+assert.sameValue(desc, undefined, 'property descriptor for "iterator"');
+
+assert.sameValue(
+ Object.prototype.hasOwnProperty.call(ns, '__proto__'),
+ false,
+ 'hasOwnProperty: __proto__'
+);
+desc = Object.getOwnPropertyDescriptor(ns, '__proto__');
+assert.sameValue(desc, undefined, 'property descriptor for "__proto__"');
+
+assert.sameValue(
+ Object.prototype.hasOwnProperty.call(ns, 'default'),
+ false,
+ 'hasOwnProperty: default'
+);
+desc = Object.getOwnPropertyDescriptor(ns, 'default');
+assert.sameValue(desc, undefined, 'property descriptor for "default"');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/namespace/internals/get-own-property-sym.js b/js/src/tests/test262/language/module-code/namespace/internals/get-own-property-sym.js
new file mode 100644
index 0000000000..491b235217
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/namespace/internals/get-own-property-sym.js
@@ -0,0 +1,29 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-module-namespace-exotic-objects-getownproperty-p
+description: >
+ Behavior of the [[GetOwnProperty]] internal method with a Symbol argument
+flags: [module]
+features: [Symbol, Symbol.toStringTag]
+---*/
+
+import * as ns from './get-own-property-sym.js';
+var notFound = Symbol('test262');
+var desc;
+
+assert.sameValue(
+ Object.prototype.hasOwnProperty.call(ns, Symbol.toStringTag), true
+);
+desc = Object.getOwnPropertyDescriptor(ns, Symbol.toStringTag);
+assert.sameValue(desc.value, ns[Symbol.toStringTag]);
+assert.sameValue(desc.enumerable, false, 'Symbol.toStringTag enumerable');
+assert.sameValue(desc.writable, false, 'Symbol.toStringTag writable');
+assert.sameValue(desc.configurable, false, 'Symbol.toStringTag configurable');
+
+assert.sameValue(Object.prototype.hasOwnProperty.call(ns, notFound), false);
+desc = Object.getOwnPropertyDescriptor(ns, notFound);
+assert.sameValue(desc, undefined);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/namespace/internals/get-prototype-of.js b/js/src/tests/test262/language/module-code/namespace/internals/get-prototype-of.js
new file mode 100644
index 0000000000..6345aa901d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/namespace/internals/get-prototype-of.js
@@ -0,0 +1,15 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-module-namespace-exotic-objects-getprototypeof
+description: The [[GetPrototypeOf]] internal method returns `null`
+flags: [module]
+---*/
+
+import * as ns from './get-prototype-of.js';
+
+assert.sameValue(ns instanceof Object, false);
+assert.sameValue(Object.getPrototypeOf(ns), null);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/namespace/internals/get-str-found-init.js b/js/src/tests/test262/language/module-code/namespace/internals/get-str-found-init.js
new file mode 100644
index 0000000000..b86b23ef6a
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/namespace/internals/get-str-found-init.js
@@ -0,0 +1,28 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-module-namespace-exotic-objects-get-p-receiver
+description: >
+ Behavior of the [[Get]] internal method with a string argument for exported
+ initialized bindings.
+info: |
+ [...]
+ 12. Let targetEnvRec be targetEnv's EnvironmentRecord.
+ 13. Return ? targetEnvRec.GetBindingValue(binding.[[BindingName]], true).
+flags: [module]
+---*/
+
+import * as ns from './get-str-found-init.js';
+export var local1 = 23;
+var local2 = 45;
+export { local2 as renamed };
+export { local1 as indirect } from './get-str-found-init.js';
+export default 444;
+
+assert.sameValue(ns.local1, 23);
+assert.sameValue(ns.renamed, 45);
+assert.sameValue(ns.indirect, 23);
+assert.sameValue(ns.default, 444);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/namespace/internals/get-str-found-uninit.js b/js/src/tests/test262/language/module-code/namespace/internals/get-str-found-uninit.js
new file mode 100644
index 0000000000..384c09599c
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/namespace/internals/get-str-found-uninit.js
@@ -0,0 +1,38 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-module-namespace-exotic-objects-get-p-receiver
+description: >
+ Behavior of the [[Get]] internal method with a string argument for exported
+ uninitialized bindings.
+info: |
+ [...]
+ 12. Let targetEnvRec be targetEnv's EnvironmentRecord.
+ 13. Return ? targetEnvRec.GetBindingValue(binding.[[BindingName]], true).
+flags: [module]
+features: [let]
+---*/
+
+import * as ns from './get-str-found-uninit.js';
+
+assert.throws(ReferenceError, function() {
+ ns.local1;
+});
+assert.throws(ReferenceError, function() {
+ ns.renamed;
+});
+assert.throws(ReferenceError, function() {
+ ns.indirect;
+});
+assert.throws(ReferenceError, function() {
+ ns.default;
+});
+
+export let local1 = 23;
+let local2 = 45;
+export { local2 as renamed };
+export { local1 as indirect } from './get-str-found-uninit.js';
+export default null;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/namespace/internals/get-str-initialize.js b/js/src/tests/test262/language/module-code/namespace/internals/get-str-initialize.js
new file mode 100644
index 0000000000..3eb6b82084
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/namespace/internals/get-str-initialize.js
@@ -0,0 +1,28 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-module-namespace-exotic-objects-get-p-receiver
+description: >
+ References observe the initialization of lexical bindings
+info: |
+ [...]
+ 12. Let targetEnvRec be targetEnv's EnvironmentRecord.
+ 13. Return ? targetEnvRec.GetBindingValue(binding.[[BindingName]], true).
+flags: [module]
+features: [let]
+---*/
+
+import * as ns from './get-str-initialize.js';
+export let localUninit1 = 111;
+let localUninit2 = 222;
+export { localUninit2 as renamedUninit };
+export { localUninit1 as indirectUninit } from './get-str-initialize.js';
+export default 333;
+
+assert.sameValue(ns.localUninit1, 111);
+assert.sameValue(ns.renamedUninit, 222);
+assert.sameValue(ns.indirectUninit, 111);
+assert.sameValue(ns.default, 333);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/namespace/internals/get-str-not-found.js b/js/src/tests/test262/language/module-code/namespace/internals/get-str-not-found.js
new file mode 100644
index 0000000000..8ced7ffb78
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/namespace/internals/get-str-not-found.js
@@ -0,0 +1,26 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-module-namespace-exotic-objects-get-p-receiver
+description: >
+ Behavior of the [[Get]] internal method with a string argument for
+ non-exported bindings
+info: |
+ [...]
+ 3. Let exports be the value of O's [[Exports]] internal slot.
+ 4. If P is not an element of exports, return undefined.
+flags: [module]
+---*/
+
+import * as ns from './get-str-not-found.js';
+var test262;
+export { test262 as anotherName };
+
+assert.sameValue(ns.test262, undefined, 'key: test262');
+assert.sameValue(ns.toStringTag, undefined, 'key: toStringTag');
+assert.sameValue(ns.iterator, undefined, 'key: iterator');
+assert.sameValue(ns.__proto__, undefined, 'key: __proto__');
+assert.sameValue(ns.default, undefined, 'key: default');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/namespace/internals/get-str-update.js b/js/src/tests/test262/language/module-code/namespace/internals/get-str-update.js
new file mode 100644
index 0000000000..23dba1d489
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/namespace/internals/get-str-update.js
@@ -0,0 +1,27 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-module-namespace-exotic-objects-get-p-receiver
+description: References observe the mutation of initialized bindings
+info: |
+ [...]
+ 12. Let targetEnvRec be targetEnv's EnvironmentRecord.
+ 13. Return ? targetEnvRec.GetBindingValue(binding.[[BindingName]], true).
+flags: [module]
+---*/
+
+import * as ns from './get-str-update.js';
+export var local1 = 111;
+var local2 = 222;
+export { local2 as renamed };
+export { local1 as indirect } from './get-str-update.js';
+
+local1 = 333;
+local2 = 444;
+
+assert.sameValue(ns.local1, 333);
+assert.sameValue(ns.renamed, 444);
+assert.sameValue(ns.indirect, 333);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/namespace/internals/get-sym-found.js b/js/src/tests/test262/language/module-code/namespace/internals/get-sym-found.js
new file mode 100644
index 0000000000..628d053b1a
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/namespace/internals/get-sym-found.js
@@ -0,0 +1,21 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-module-namespace-exotic-objects-get-p-receiver
+description: >
+ Behavior of the [[Get]] internal method with a symbol argument that can be
+ found
+info: |
+ [...]
+ 2. If Type(P) is Symbol, then
+ a. Return ? OrdinaryGet(O, P, Receiver).
+flags: [module]
+features: [Symbol.toStringTag]
+---*/
+
+import * as ns from './get-sym-found.js';
+
+assert.sameValue(typeof ns[Symbol.toStringTag], 'string');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/namespace/internals/get-sym-not-found.js b/js/src/tests/test262/language/module-code/namespace/internals/get-sym-not-found.js
new file mode 100644
index 0000000000..61e9b7a6f1
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/namespace/internals/get-sym-not-found.js
@@ -0,0 +1,21 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-module-namespace-exotic-objects-get-p-receiver
+description: >
+ Behavior of the [[Get]] internal method with a symbol argument that cannot
+ be found
+info: |
+ [...]
+ 2. If Type(P) is Symbol, then
+ a. Return ? OrdinaryGet(O, P, Receiver).
+flags: [module]
+features: [Symbol]
+---*/
+
+import * as ns from './get-sym-not-found.js';
+
+assert.sameValue(ns[Symbol('test262')], undefined, 'Symbol: test262');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/namespace/internals/has-property-str-found-init.js b/js/src/tests/test262/language/module-code/namespace/internals/has-property-str-found-init.js
new file mode 100644
index 0000000000..3dc01c249e
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/namespace/internals/has-property-str-found-init.js
@@ -0,0 +1,36 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-module-namespace-exotic-objects-hasproperty-p
+description: >
+ Behavior of the [[HasProperty]] internal method with a string argument for
+ exported initialized bindings.
+info: |
+ [...]
+ 2. Let exports be the value of O's [[Exports]] internal slot.
+ 3. If P is an element of exports, return true.
+flags: [module]
+features: [Reflect]
+---*/
+
+import * as ns from './has-property-str-found-init.js';
+export var local1;
+var local2;
+export { local2 as renamed };
+export { local1 as indirect } from './has-property-str-found-init.js';
+export default null;
+
+assert('local1' in ns, 'in: local1');
+assert(Reflect.has(ns, 'local1'), 'Reflect.has: local1');
+
+assert('renamed' in ns, 'in: renamed');
+assert(Reflect.has(ns, 'renamed'), 'Reflect.has: renamed');
+
+assert('indirect' in ns, 'in: indirect');
+assert(Reflect.has(ns, 'indirect'), 'Reflect.has: indirect');
+
+assert('default' in ns, 'in: default');
+assert(Reflect.has(ns, 'default'), 'Reflect.has: default');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/namespace/internals/has-property-str-found-uninit.js b/js/src/tests/test262/language/module-code/namespace/internals/has-property-str-found-uninit.js
new file mode 100644
index 0000000000..c939fda03b
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/namespace/internals/has-property-str-found-uninit.js
@@ -0,0 +1,38 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-module-namespace-exotic-objects-hasproperty-p
+description: >
+ Behavior of the [[HasProperty]] internal method with a string argument for
+ exported uninitialized bindings.
+info: |
+ [...]
+ 2. Let exports be the value of O's [[Exports]] internal slot.
+ 3. If P is an element of exports, return true.
+ 4. Return false.
+flags: [module]
+features: [Reflect, let]
+---*/
+
+import * as ns from './has-property-str-found-uninit.js';
+
+assert('local1' in ns, 'in: local1');
+assert(Reflect.has(ns, 'local1'), 'Reflect.has: local1');
+
+assert('renamed' in ns, 'in: renamed');
+assert(Reflect.has(ns, 'renamed'), 'Reflect.has: renamed');
+
+assert('indirect' in ns, 'in: indirect');
+assert(Reflect.has(ns, 'indirect'), 'Reflect.has: indirect');
+
+assert('default' in ns, 'in: default');
+assert(Reflect.has(ns, 'default'), 'Reflect.has: default');
+
+export let local1 = 23;
+let local2 = 45;
+export { local2 as renamed };
+export { local1 as indirect } from './has-property-str-found-uninit.js';
+export default null;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/namespace/internals/has-property-str-not-found.js b/js/src/tests/test262/language/module-code/namespace/internals/has-property-str-not-found.js
new file mode 100644
index 0000000000..88665db1be
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/namespace/internals/has-property-str-not-found.js
@@ -0,0 +1,41 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-module-namespace-exotic-objects-hasproperty-p
+description: >
+ Behavior of the [[HasProperty]] internal method with a string argument for
+ non-exported bindings
+info: |
+ [...]
+ 2. Let exports be the value of O's [[Exports]] internal slot.
+ 3. If P is an element of exports, return true.
+ 4. Return false.
+flags: [module]
+features: [Reflect]
+---*/
+
+import * as ns from './has-property-str-not-found.js';
+var test262;
+export { test262 as anotherName };
+
+assert.sameValue('test262' in ns, false, 'in: test262');
+assert.sameValue(Reflect.has(ns, 'test262'), false, 'Reflect.has: test262');
+
+assert.sameValue('toStringTag' in ns, false, 'in: toStringTag');
+assert.sameValue(
+ Reflect.has(ns, 'toStringTag'), false, 'Reflect.has: toStringTag'
+);
+
+assert.sameValue('iterator' in ns, false, 'in: iterator');
+assert.sameValue(Reflect.has(ns, 'iterator'), false, 'Reflect.has: iterator');
+
+assert.sameValue('__proto__' in ns, false, 'in: __proto__');
+assert.sameValue(
+ Reflect.has(ns, '__proto__'), false, 'Reflect.has: __proto__'
+);
+
+assert.sameValue('default' in ns, false, 'in: default');
+assert.sameValue(Reflect.has(ns, 'default'), false, 'Reflect.has: default');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/namespace/internals/has-property-sym-found.js b/js/src/tests/test262/language/module-code/namespace/internals/has-property-sym-found.js
new file mode 100644
index 0000000000..df79504219
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/namespace/internals/has-property-sym-found.js
@@ -0,0 +1,20 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-module-namespace-exotic-objects-hasproperty-p
+description: >
+ Behavior of the [[HasProperty]] internal method with a symbol argument that
+ can be found
+info: |
+ 1. If Type(P) is Symbol, return OrdinaryHasProperty(O, P).
+flags: [module]
+features: [Symbol.toStringTag, Reflect]
+---*/
+
+import * as ns from './has-property-sym-found.js';
+
+assert(Symbol.toStringTag in ns, 'in: Symbol.toStringTag');
+assert(Reflect.has(ns, Symbol.toStringTag), 'Reflect.has: Symbol.toStringTag');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/namespace/internals/has-property-sym-not-found.js b/js/src/tests/test262/language/module-code/namespace/internals/has-property-sym-not-found.js
new file mode 100644
index 0000000000..f15464b71b
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/namespace/internals/has-property-sym-not-found.js
@@ -0,0 +1,21 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-module-namespace-exotic-objects-hasproperty-p
+description: >
+ Behavior of the [[HasProperty]] internal method with a symbol argument that
+ cannot be found
+info: |
+ 1. If Type(P) is Symbol, return OrdinaryHasProperty(O, P).
+flags: [module]
+features: [Symbol, Reflect]
+---*/
+
+import * as ns from './has-property-sym-not-found.js';
+var sym = Symbol('test262');
+
+assert.sameValue(sym in ns, false, 'in');
+assert.sameValue(Reflect.has(ns, sym), false, 'Reflect.has');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/namespace/internals/is-extensible.js b/js/src/tests/test262/language/module-code/namespace/internals/is-extensible.js
new file mode 100644
index 0000000000..6e1d024d7c
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/namespace/internals/is-extensible.js
@@ -0,0 +1,14 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-module-namespace-exotic-objects-isextensible
+description: The [[IsExtensible]] internal method returns `false`
+flags: [module]
+---*/
+
+import * as ns from './is-extensible.js';
+
+assert.sameValue(Object.isExtensible(ns), false);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/namespace/internals/object-hasOwnProperty-binding-uninit.js b/js/src/tests/test262/language/module-code/namespace/internals/object-hasOwnProperty-binding-uninit.js
new file mode 100644
index 0000000000..8d496b756c
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/namespace/internals/object-hasOwnProperty-binding-uninit.js
@@ -0,0 +1,45 @@
+// |reftest| module
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-object.prototype.hasownproperty
+description: >
+ Test Object.prototype.hasOwnProperty() with uninitialized binding.
+info: |
+ 19.1.3.2 Object.prototype.hasOwnProperty ( V )
+ ...
+ 3. Return ? HasOwnProperty(O, P).
+
+ 7.3.11 HasOwnProperty ( O, P )
+ ...
+ 3. Let desc be ? O.[[GetOwnProperty]](P).
+ ...
+
+ 9.4.6.4 [[GetOwnProperty]] (P)
+ ...
+ 4. Let value be ? O.[[Get]](P, O).
+ ...
+
+ 9.4.6.7 [[Get]] (P, Receiver)
+ ...
+ 12. Let targetEnvRec be targetEnv's EnvironmentRecord.
+ 13. Return ? targetEnvRec.GetBindingValue(binding.[[BindingName]], true).
+
+ 8.1.1.1.6 GetBindingValue ( N, S )
+ ...
+ If the binding for N in envRec is an uninitialized binding, throw a ReferenceError exception.
+ ...
+
+flags: [module]
+---*/
+
+import* as self from "./object-hasOwnProperty-binding-uninit.js";
+
+assert.throws(ReferenceError, function() {
+ Object.prototype.hasOwnProperty.call(self, "default");
+});
+
+export default 0;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/namespace/internals/object-keys-binding-uninit.js b/js/src/tests/test262/language/module-code/namespace/internals/object-keys-binding-uninit.js
new file mode 100644
index 0000000000..67d9a75997
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/namespace/internals/object-keys-binding-uninit.js
@@ -0,0 +1,48 @@
+// |reftest| module
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-object.keys
+description: >
+ Test Object.keys() with uninitialized binding.
+info: |
+ 19.1.2.16 Object.keys ( O )
+ ...
+ 2. Let nameList be ? EnumerableOwnProperties(obj, "key").
+ ...
+
+ 7.3.21 EnumerableOwnProperties ( O, kind )
+ ...
+ 4. For each element key of ownKeys in List order, do
+ a. If Type(key) is String, then
+ i. Let desc be ? O.[[GetOwnProperty]](key).
+ ...
+
+ 9.4.6.4 [[GetOwnProperty]] (P)
+ ...
+ 4. Let value be ? O.[[Get]](P, O).
+ ...
+
+ 9.4.6.7 [[Get]] (P, Receiver)
+ ...
+ 12. Let targetEnvRec be targetEnv's EnvironmentRecord.
+ 13. Return ? targetEnvRec.GetBindingValue(binding.[[BindingName]], true).
+
+ 8.1.1.1.6 GetBindingValue ( N, S )
+ ...
+ If the binding for N in envRec is an uninitialized binding, throw a ReferenceError exception.
+ ...
+
+flags: [module]
+---*/
+
+import* as self from "./object-keys-binding-uninit.js";
+
+assert.throws(ReferenceError, function() {
+ Object.keys(self);
+});
+
+export default 0;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/namespace/internals/object-propertyIsEnumerable-binding-uninit.js b/js/src/tests/test262/language/module-code/namespace/internals/object-propertyIsEnumerable-binding-uninit.js
new file mode 100644
index 0000000000..be5f6ea39e
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/namespace/internals/object-propertyIsEnumerable-binding-uninit.js
@@ -0,0 +1,41 @@
+// |reftest| module
+// Copyright (C) 2017 André Bargull. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-object.prototype.propertyisenumerable
+description: >
+ Test Object.prototype.propertyIsEnumerable() with uninitialized binding.
+info: |
+ 19.1.3.4 Object.prototype.propertyIsEnumerable ( V )
+ ...
+ 3. Let desc be ? O.[[GetOwnProperty]](P).
+ ...
+
+ 9.4.6.4 [[GetOwnProperty]] (P)
+ ...
+ 4. Let value be ? O.[[Get]](P, O).
+ ...
+
+ 9.4.6.7 [[Get]] (P, Receiver)
+ ...
+ 12. Let targetEnvRec be targetEnv's EnvironmentRecord.
+ 13. Return ? targetEnvRec.GetBindingValue(binding.[[BindingName]], true).
+
+ 8.1.1.1.6 GetBindingValue ( N, S )
+ ...
+ If the binding for N in envRec is an uninitialized binding, throw a ReferenceError exception.
+ ...
+
+flags: [module]
+---*/
+
+import* as self from "./object-propertyIsEnumerable-binding-uninit.js";
+
+assert.throws(ReferenceError, function() {
+ Object.prototype.propertyIsEnumerable.call(self, "default");
+});
+
+export default 0;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/namespace/internals/own-property-keys-binding-types.js b/js/src/tests/test262/language/module-code/namespace/internals/own-property-keys-binding-types.js
new file mode 100644
index 0000000000..9f196cfb9d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/namespace/internals/own-property-keys-binding-types.js
@@ -0,0 +1,81 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-module-namespace-exotic-objects-ownpropertykeys
+description: >
+ The [[OwnPropertyKeys]] internal method includes entries for all binding
+ types
+info: |
+ 1. Let exports be a copy of the value of O's [[Exports]] internal slot.
+ 2. Let symbolKeys be ! OrdinaryOwnPropertyKeys(O).
+ 3. Append all the entries of symbolKeys to the end of exports.
+ 4. Return exports.
+
+ Note: identifiers have been selected such that runtimes which do not sort
+ the [[Exports]] list may still pass. A separate test is dedicated to sort
+ order.
+flags: [module]
+features: [Reflect, Symbol.toStringTag, let]
+---*/
+
+import * as ns from './own-property-keys-binding-types.js';
+export var a_local1;
+var local2;
+export { local2 as b_renamed };
+export { a_local1 as e_indirect } from './own-property-keys-binding-types.js';
+export * from './own-property-keys-binding-types_FIXTURE.js';
+
+var stringKeys = Object.getOwnPropertyNames(ns);
+
+assert.sameValue(stringKeys.length, 10);
+assert.sameValue(stringKeys[0], 'a_local1');
+assert.sameValue(stringKeys[1], 'b_renamed');
+assert.sameValue(stringKeys[2], 'c_localUninit1');
+assert.sameValue(stringKeys[3], 'd_renamedUninit');
+assert.sameValue(stringKeys[4], 'default');
+assert.sameValue(stringKeys[5], 'e_indirect');
+assert.sameValue(stringKeys[6], 'f_indirectUninit');
+assert.sameValue(stringKeys[7], 'g_star');
+assert.sameValue(stringKeys[8], 'h_starRenamed');
+assert.sameValue(stringKeys[9], 'i_starIndirect');
+
+var symbolKeys = Object.getOwnPropertySymbols(ns);
+
+assert(
+ symbolKeys.length > 0,
+ 'at least as many Symbol keys as defined by the specification'
+);
+assert(
+ symbolKeys.indexOf(Symbol.toStringTag) > -1,
+ 'Symbol keys array includes Symbol.toStringTag'
+);
+
+var allKeys = Reflect.ownKeys(ns);
+
+assert(
+ allKeys.length >= 11,
+ 'at least as many keys as defined by the module and the specification'
+);
+assert.sameValue(allKeys[0], 'a_local1');
+assert.sameValue(allKeys[1], 'b_renamed');
+assert.sameValue(allKeys[2], 'c_localUninit1');
+assert.sameValue(allKeys[3], 'd_renamedUninit');
+assert.sameValue(allKeys[4], 'default');
+assert.sameValue(allKeys[5], 'e_indirect');
+assert.sameValue(allKeys[6], 'f_indirectUninit');
+assert.sameValue(allKeys[7], 'g_star');
+assert.sameValue(allKeys[8], 'h_starRenamed');
+assert.sameValue(allKeys[9], 'i_starIndirect');
+assert(
+ allKeys.indexOf(Symbol.toStringTag) > 9,
+ 'keys array includes Symbol.toStringTag'
+);
+
+export let c_localUninit1;
+let localUninit2;
+export { localUninit2 as d_renamedUninit };
+export { c_localUninit1 as f_indirectUninit } from './own-property-keys-binding-types.js';
+export default null;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/namespace/internals/own-property-keys-binding-types_FIXTURE.js b/js/src/tests/test262/language/module-code/namespace/internals/own-property-keys-binding-types_FIXTURE.js
new file mode 100644
index 0000000000..5e9cd63759
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/namespace/internals/own-property-keys-binding-types_FIXTURE.js
@@ -0,0 +1,7 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export var g_star;
+export { g_star as h_starRenamed };
+export { a_local1 as i_starIndirect } from './own-property-keys-binding-types.js';
diff --git a/js/src/tests/test262/language/module-code/namespace/internals/own-property-keys-sort.js b/js/src/tests/test262/language/module-code/namespace/internals/own-property-keys-sort.js
new file mode 100644
index 0000000000..b837cfb8b2
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/namespace/internals/own-property-keys-sort.js
@@ -0,0 +1,83 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-module-namespace-exotic-objects-ownpropertykeys
+description: >
+ The [[OwnPropertyKeys]] internal method reflects the sorted order
+info: |
+ 1. Let exports be a copy of the value of O's [[Exports]] internal slot.
+ 2. Let symbolKeys be ! OrdinaryOwnPropertyKeys(O).
+ 3. Append all the entries of symbolKeys to the end of exports.
+ 4. Return exports.
+flags: [module]
+features: [Reflect, Symbol.toStringTag]
+---*/
+
+var x;
+export { x as π }; // u03c0
+export { x as az };
+export { x as __ };
+export { x as za };
+export { x as Z };
+export { x as \u03bc };
+export { x as z };
+export { x as zz };
+export { x as a };
+export { x as A };
+export { x as aa };
+export { x as λ }; // u03bb
+export { x as _ };
+export { x as $$ };
+export { x as $ };
+export default null;
+
+import * as ns from './own-property-keys-sort.js';
+
+var stringKeys = Object.getOwnPropertyNames(ns);
+
+assert.sameValue(stringKeys.length, 16);
+assert.sameValue(stringKeys[0], '$', 'stringKeys[0] === "$"');
+assert.sameValue(stringKeys[1], '$$', 'stringKeys[1] === "$$"');
+assert.sameValue(stringKeys[2], 'A', 'stringKeys[2] === "A"');
+assert.sameValue(stringKeys[3], 'Z', 'stringKeys[3] === "Z"');
+assert.sameValue(stringKeys[4], '_', 'stringKeys[4] === "_"');
+assert.sameValue(stringKeys[5], '__', 'stringKeys[5] === "__"');
+assert.sameValue(stringKeys[6], 'a', 'stringKeys[6] === "a"');
+assert.sameValue(stringKeys[7], 'aa', 'stringKeys[7] === "aa"');
+assert.sameValue(stringKeys[8], 'az', 'stringKeys[8] === "az"');
+assert.sameValue(stringKeys[9], 'default', 'stringKeys[9] === "default"');
+assert.sameValue(stringKeys[10], 'z', 'stringKeys[10] === "z"');
+assert.sameValue(stringKeys[11], 'za', 'stringKeys[11] === "za"');
+assert.sameValue(stringKeys[12], 'zz', 'stringKeys[12] === "zz"');
+assert.sameValue(stringKeys[13], '\u03bb', 'stringKeys[13] === "\u03bb"');
+assert.sameValue(stringKeys[14], '\u03bc', 'stringKeys[14] === "\u03bc"');
+assert.sameValue(stringKeys[15], '\u03c0', 'stringKeys[15] === "\u03c0"');
+
+var allKeys = Reflect.ownKeys(ns);
+assert(
+ allKeys.length >= 17,
+ 'at least as many keys as defined by the module and the specification'
+);
+assert.sameValue(allKeys[0], '$', 'allKeys[0] === "$"');
+assert.sameValue(allKeys[1], '$$', 'allKeys[1] === "$$"');
+assert.sameValue(allKeys[2], 'A', 'allKeys[2] === "A"');
+assert.sameValue(allKeys[3], 'Z', 'allKeys[3] === "Z"');
+assert.sameValue(allKeys[4], '_', 'allKeys[4] === "_"');
+assert.sameValue(allKeys[5], '__', 'allKeys[5] === "__"');
+assert.sameValue(allKeys[6], 'a', 'allKeys[6] === "a"');
+assert.sameValue(allKeys[7], 'aa', 'allKeys[7] === "aa"');
+assert.sameValue(allKeys[8], 'az', 'allKeys[8] === "az"');
+assert.sameValue(allKeys[9], 'default', 'allKeys[9] === "default"');
+assert.sameValue(allKeys[10], 'z', 'allKeys[10] === "z"');
+assert.sameValue(allKeys[11], 'za', 'allKeys[11] === "za"');
+assert.sameValue(allKeys[12], 'zz', 'allKeys[12] === "zz"');
+assert.sameValue(allKeys[13], '\u03bb', 'allKeys[13] === "\u03bb"');
+assert.sameValue(allKeys[14], '\u03bc', 'allKeys[14] === "\u03bc"');
+assert.sameValue(allKeys[15], '\u03c0', 'allKeys[15] === "\u03c0"');
+assert(
+ allKeys.indexOf(Symbol.toStringTag) > 15,
+ 'keys array includes Symbol.toStringTag'
+);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/namespace/internals/prevent-extensions.js b/js/src/tests/test262/language/module-code/namespace/internals/prevent-extensions.js
new file mode 100644
index 0000000000..c95ba59e96
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/namespace/internals/prevent-extensions.js
@@ -0,0 +1,18 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-module-namespace-exotic-objects-preventextensions
+description: The [[PreventExtensions]] internal method returns `true`
+flags: [module]
+features: [Reflect]
+---*/
+
+import * as ns from './prevent-extensions.js';
+
+// This invocation should not throw an exception
+Object.preventExtensions(ns);
+
+assert.sameValue(Reflect.preventExtensions(ns), true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/namespace/internals/set-prototype-of-null.js b/js/src/tests/test262/language/module-code/namespace/internals/set-prototype-of-null.js
new file mode 100644
index 0000000000..518cef68cc
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/namespace/internals/set-prototype-of-null.js
@@ -0,0 +1,17 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-module-namespace-exotic-objects-setprototypeof-v
+description: >
+ The [[SetPrototypeOf]] internal method returns `true` if
+ passed `null`
+flags: [module]
+---*/
+
+import * as ns from './set-prototype-of-null.js';
+
+assert.sameValue(typeof Object.setPrototypeOf, 'function');
+assert.sameValue(ns, Object.setPrototypeOf(ns, null));
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/namespace/internals/set-prototype-of.js b/js/src/tests/test262/language/module-code/namespace/internals/set-prototype-of.js
new file mode 100644
index 0000000000..d24340dcec
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/namespace/internals/set-prototype-of.js
@@ -0,0 +1,19 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-module-namespace-exotic-objects-setprototypeof
+description: The [[SetPrototypeOf]] internal method returns `false`
+flags: [module]
+---*/
+
+import * as ns from './set-prototype-of.js';
+var newProto = {};
+
+assert.sameValue(typeof Object.setPrototypeOf, 'function');
+
+assert.throws(TypeError, function() {
+ Object.setPrototypeOf(ns, newProto);
+});
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/namespace/internals/set.js b/js/src/tests/test262/language/module-code/namespace/internals/set.js
new file mode 100644
index 0000000000..192f0def9d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/namespace/internals/set.js
@@ -0,0 +1,59 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-module-namespace-exotic-objects-set-p-v-receiver
+description: The [[Set]] internal method consistently returns `false`
+info: |
+ 1. Return false.
+flags: [module]
+features: [Reflect, Symbol, Symbol.toStringTag]
+---*/
+
+import * as ns from './set.js';
+export var local1 = null;
+var local2 = null;
+export { local2 as renamed };
+export { local1 as indirect } from './set.js';
+var sym = Symbol('test262');
+
+assert.sameValue(Reflect.set(ns, 'local1'), false, 'Reflect.set: local1');
+assert.throws(TypeError, function() {
+ ns.local1 = null;
+}, 'AssignmentExpression: local1');
+
+assert.sameValue(Reflect.set(ns, 'local2'), false, 'Reflect.set: local2');
+assert.throws(TypeError, function() {
+ ns.local2 = null;
+}, 'AssignmentExpression: local2');
+
+assert.sameValue(Reflect.set(ns, 'renamed'), false, 'Reflect.set: renamed');
+assert.throws(TypeError, function() {
+ ns.renamed = null;
+}, 'AssignmentExpression: renamed');
+
+assert.sameValue(Reflect.set(ns, 'indirect'), false, 'Reflect.set: indirect');
+assert.throws(TypeError, function() {
+ ns.indirect = null;
+}, 'AssignmentExpression: indirect');
+
+assert.sameValue(Reflect.set(ns, 'default'), false, 'Reflect.set: default');
+assert.throws(TypeError, function() {
+ ns.default = null;
+}, 'AssignmentExpression: default');
+
+assert.sameValue(
+ Reflect.set(ns, Symbol.toStringTag),
+ false,
+ 'Reflect.set: Symbol.toStringTag'
+);
+assert.throws(TypeError, function() {
+ ns[Symbol.toStringTag] = null;
+}, 'AssignmentExpression: Symbol.toStringTag');
+
+assert.sameValue(Reflect.set(ns, sym), false, 'Reflect.set: sym');
+assert.throws(TypeError, function() {
+ ns[sym] = null;
+}, 'AssignmentExpression: sym');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/namespace/internals/shell.js b/js/src/tests/test262/language/module-code/namespace/internals/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/namespace/internals/shell.js
diff --git a/js/src/tests/test262/language/module-code/namespace/shell.js b/js/src/tests/test262/language/module-code/namespace/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/namespace/shell.js
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-arrow-function.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-arrow-function.js
new file mode 100644
index 0000000000..cb125c7c03
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-arrow-function.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Expression cannot contain an `export` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+() => { export default null; };
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-block-stmt-list.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-block-stmt-list.js
new file mode 100644
index 0000000000..da5614db41
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-block-stmt-list.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `export` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+{ void 0; export default null; }
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-block-stmt.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-block-stmt.js
new file mode 100644
index 0000000000..45c41fa0a8
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-block-stmt.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `export` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+{ export default null; }
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-class-decl-meth-static.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-class-decl-meth-static.js
new file mode 100644
index 0000000000..0d4590c62a
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-class-decl-meth-static.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `export` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+class C { static method() { export default null; } }
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-class-decl-meth.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-class-decl-meth.js
new file mode 100644
index 0000000000..f636312e54
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-class-decl-meth.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `export` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+class C { method() { export default null; } }
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-class-decl-method-gen-static.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-class-decl-method-gen-static.js
new file mode 100644
index 0000000000..8b4f0f75dc
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-class-decl-method-gen-static.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `export` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+features: [generators]
+---*/
+
+$DONOTEVALUATE();
+
+class C { static *method() { export default null; } }
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-class-decl-method-gen.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-class-decl-method-gen.js
new file mode 100644
index 0000000000..124a6e0621
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-class-decl-method-gen.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `export` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+features: [generators]
+---*/
+
+$DONOTEVALUATE();
+
+class C { *method() { export default null; } }
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-class-expr-meth-gen-static.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-class-expr-meth-gen-static.js
new file mode 100644
index 0000000000..20e9cc9e26
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-class-expr-meth-gen-static.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Expression cannot contain an `export` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+features: [generators]
+---*/
+
+$DONOTEVALUATE();
+
+(class { static *method() { export default null; } });
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-class-expr-meth-gen.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-class-expr-meth-gen.js
new file mode 100644
index 0000000000..96e4dbb0e3
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-class-expr-meth-gen.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Expression cannot contain an `export` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+features: [generators]
+---*/
+
+$DONOTEVALUATE();
+
+(class { *method() { export default null; } });
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-class-expr-meth-static.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-class-expr-meth-static.js
new file mode 100644
index 0000000000..b99abf6ba1
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-class-expr-meth-static.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Expression cannot contain an `export` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+(class { static method() { export default null; } });
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-class-expr-meth.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-class-expr-meth.js
new file mode 100644
index 0000000000..e0f1f654ba
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-class-expr-meth.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Expression cannot contain an `export` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+(class { method() { export default null; } });
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-do-while.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-do-while.js
new file mode 100644
index 0000000000..1dde723b1c
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-do-while.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `export` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+do export default null; while (false)
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-for-const.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-for-const.js
new file mode 100644
index 0000000000..d3f5e8c12d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-for-const.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `export` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+for (const x = 0; false;)
+ export default null;
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-for-in-const.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-for-in-const.js
new file mode 100644
index 0000000000..8e16df981e
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-for-in-const.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `export` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+for (const y in [])
+ export default null;
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-for-in-let.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-for-in-let.js
new file mode 100644
index 0000000000..7b1268efe1
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-for-in-let.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `export` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+for (let y in [])
+ export default null;
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-for-in-lhs.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-for-in-lhs.js
new file mode 100644
index 0000000000..0d7b7fff48
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-for-in-lhs.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `export` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+for (y in [])
+ export default null;
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-for-in-var.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-for-in-var.js
new file mode 100644
index 0000000000..97282ccef6
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-for-in-var.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `export` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+for (var y in [])
+ export default null;
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-for-let.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-for-let.js
new file mode 100644
index 0000000000..c1431a9317
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-for-let.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `export` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+for (let x = 0; false;)
+ export default null;
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-for-lhs.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-for-lhs.js
new file mode 100644
index 0000000000..cd7a08c8b3
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-for-lhs.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `export` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+for (x = 0; false;)
+ export default null;
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-for-of-const.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-for-of-const.js
new file mode 100644
index 0000000000..84a4b1d35f
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-for-of-const.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `export` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+for (const y of [])
+ export default null;
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-for-of-let.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-for-of-let.js
new file mode 100644
index 0000000000..46d01bdf38
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-for-of-let.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `export` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+for (let y of [])
+ export default null;
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-for-of-lhs.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-for-of-lhs.js
new file mode 100644
index 0000000000..4e2c05559f
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-for-of-lhs.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `export` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+for (y of [])
+ export default null;
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-for-of-var.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-for-of-var.js
new file mode 100644
index 0000000000..33d3e852d6
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-for-of-var.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `export` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+for (var y of [])
+ export default null;
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-for-var.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-for-var.js
new file mode 100644
index 0000000000..df68fed660
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-for-var.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `export` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+for (var x = 0; false;)
+ export default null;
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-function-decl.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-function-decl.js
new file mode 100644
index 0000000000..c38760a8d2
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-function-decl.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `export` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+function f() { export default null; }
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-function-expr.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-function-expr.js
new file mode 100644
index 0000000000..b1b4d041f4
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-function-expr.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Expression cannot contain an `export` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+(function() { export default null; });
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-generator-decl.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-generator-decl.js
new file mode 100644
index 0000000000..4627a1c447
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-generator-decl.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `export` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+features: [generators]
+---*/
+
+$DONOTEVALUATE();
+
+function* g() { export default null; }
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-generator-expr.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-generator-expr.js
new file mode 100644
index 0000000000..28ac9bd571
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-generator-expr.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Expression cannot contain an `export` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+(function*() { export default null; });
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-if-else.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-if-else.js
new file mode 100644
index 0000000000..57c531eefb
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-if-else.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `export` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+if (true) { } else export default null;
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-if-if.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-if-if.js
new file mode 100644
index 0000000000..8f44899ecb
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-if-if.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `export` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+if (false) export default null;
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-labeled.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-labeled.js
new file mode 100644
index 0000000000..e7cf0408b5
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-labeled.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `export` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+test262: export default null;
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-object-gen-method.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-object-gen-method.js
new file mode 100644
index 0000000000..48e1961d66
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-object-gen-method.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Expression cannot contain an `export` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+features: [generators]
+---*/
+
+$DONOTEVALUATE();
+
+({ *m() { export default null; } });
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-object-getter.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-object-getter.js
new file mode 100644
index 0000000000..cec6015c20
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-object-getter.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Expression cannot contain an `export` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+({ get m() { export default null; } });
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-object-method.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-object-method.js
new file mode 100644
index 0000000000..b753bc3f95
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-object-method.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Expression cannot contain an `export` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+({ m() { export default null; } });
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-object-setter.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-object-setter.js
new file mode 100644
index 0000000000..2dffc83179
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-object-setter.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Expression cannot contain an `export` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+({ set m(x) { export default null; } });
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-switch-case-dflt.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-switch-case-dflt.js
new file mode 100644
index 0000000000..6a36fd842d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-switch-case-dflt.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `export` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+switch(0) { case 1: export default null; default: }
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-switch-case.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-switch-case.js
new file mode 100644
index 0000000000..4dadc591a7
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-switch-case.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `export` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+switch(0) { case 1: export default null; }
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-switch-dftl.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-switch-dftl.js
new file mode 100644
index 0000000000..ff139d09ad
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-switch-dftl.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `export` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+switch(0) { default: export default null; }
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-try-catch-finally.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-try-catch-finally.js
new file mode 100644
index 0000000000..f51a4d26ae
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-try-catch-finally.js
@@ -0,0 +1,17 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `export` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+try { } catch (err) { } finally {
+ export default null;
+}
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-try-catch.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-try-catch.js
new file mode 100644
index 0000000000..b808656626
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-try-catch.js
@@ -0,0 +1,17 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `export` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+try { } catch (err) {
+ export default null;
+}
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-try-finally.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-try-finally.js
new file mode 100644
index 0000000000..d16c7ab421
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-try-finally.js
@@ -0,0 +1,17 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `export` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+try { } finally {
+ export default null;
+}
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-try-try.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-try-try.js
new file mode 100644
index 0000000000..f0315d36e7
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-try-try.js
@@ -0,0 +1,17 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `export` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+try {
+ export default null;
+} catch (err) { }
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-while.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-while.js
new file mode 100644
index 0000000000..63d98eeae8
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-export-while.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `export` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+while (false) export default null;
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-arrow-function.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-arrow-function.js
new file mode 100644
index 0000000000..9a6934b164
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-arrow-function.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Expression cannot contain an `import` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+() => { import v from './decl-pos-import-arrow-function.js'; };
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-block-stmt-list.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-block-stmt-list.js
new file mode 100644
index 0000000000..d9da7dbc32
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-block-stmt-list.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `import` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+{ void 0; import v from './decl-pos-import-block-stmt-list.js'; }
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-block-stmt.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-block-stmt.js
new file mode 100644
index 0000000000..fff15b4888
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-block-stmt.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `import` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+{ import v from './decl-pos-import-block-stmt.js'; }
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-class-decl-meth-static.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-class-decl-meth-static.js
new file mode 100644
index 0000000000..48ac298508
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-class-decl-meth-static.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `import` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+class C { static method() { import v from './decl-pos-import-class-decl-meth-static.js'; } }
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-class-decl-meth.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-class-decl-meth.js
new file mode 100644
index 0000000000..4395f038da
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-class-decl-meth.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `import` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+class C { method() { import v from './decl-pos-import-class-decl-meth.js'; } }
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-class-decl-method-gen-static.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-class-decl-method-gen-static.js
new file mode 100644
index 0000000000..94f61b5e86
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-class-decl-method-gen-static.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `import` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+features: [generators]
+---*/
+
+$DONOTEVALUATE();
+
+class C { static *method() { import v from './decl-pos-import-class-decl-method-gen-static.js'; } }
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-class-decl-method-gen.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-class-decl-method-gen.js
new file mode 100644
index 0000000000..21b4fb7882
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-class-decl-method-gen.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `import` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+features: [generators]
+---*/
+
+$DONOTEVALUATE();
+
+class C { *method() { import v from './decl-pos-import-class-decl-method-gen.js'; } }
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-class-expr-meth-gen-static.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-class-expr-meth-gen-static.js
new file mode 100644
index 0000000000..49cc703d56
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-class-expr-meth-gen-static.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Expression cannot contain an `import` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+features: [generators]
+---*/
+
+$DONOTEVALUATE();
+
+(class { static *method() { import v from './decl-pos-import-class-expr-meth-gen-static.js'; } });
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-class-expr-meth-gen.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-class-expr-meth-gen.js
new file mode 100644
index 0000000000..abe2e0a5bc
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-class-expr-meth-gen.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Expression cannot contain an `import` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+features: [generators]
+---*/
+
+$DONOTEVALUATE();
+
+(class { *method() { import v from './decl-pos-import-class-expr-meth-gen.js'; } });
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-class-expr-meth-static.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-class-expr-meth-static.js
new file mode 100644
index 0000000000..57e44fc2d4
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-class-expr-meth-static.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Expression cannot contain an `import` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+(class { static method() { import v from './decl-pos-import-class-expr-meth-static.js'; } });
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-class-expr-meth.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-class-expr-meth.js
new file mode 100644
index 0000000000..ebcaa94359
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-class-expr-meth.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Expression cannot contain an `import` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+(class { method() { import v from './decl-pos-import-class-expr-meth.js'; } });
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-do-while.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-do-while.js
new file mode 100644
index 0000000000..6775088017
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-do-while.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `import` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+do import v from './decl-pos-import-do-while.js'; while (false)
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-for-const.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-for-const.js
new file mode 100644
index 0000000000..d4ede84b1c
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-for-const.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `import` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+for (const x = 0; false;)
+ import v from './decl-pos-import-for-const.js';
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-for-in-const.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-for-in-const.js
new file mode 100644
index 0000000000..a82532e223
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-for-in-const.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `import` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+for (const y in [])
+ import v from './decl-pos-import-for-in-const.js';
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-for-in-let.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-for-in-let.js
new file mode 100644
index 0000000000..78f3e63786
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-for-in-let.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `import` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+for (let y in [])
+ import v from './decl-pos-import-for-in-let.js';
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-for-in-lhs.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-for-in-lhs.js
new file mode 100644
index 0000000000..3900f5753e
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-for-in-lhs.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `import` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+for (y in [])
+ import v from './decl-pos-import-for-in-lhs.js';
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-for-in-var.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-for-in-var.js
new file mode 100644
index 0000000000..fcabfedf92
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-for-in-var.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `import` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+for (var y in [])
+ import v from './decl-pos-import-for-in-var.js';
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-for-let.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-for-let.js
new file mode 100644
index 0000000000..8d4ab629a0
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-for-let.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `import` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+for (let x = 0; false;)
+ import v from './decl-pos-import-for-let.js';
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-for-lhs.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-for-lhs.js
new file mode 100644
index 0000000000..61532afb29
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-for-lhs.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `import` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+for (x = 0; false;)
+ import v from './decl-pos-import-for-lhs.js';
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-for-of-const.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-for-of-const.js
new file mode 100644
index 0000000000..14f67da27d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-for-of-const.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `import` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+for (const y of [])
+ import v from './decl-pos-import-for-of-const.js';
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-for-of-let.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-for-of-let.js
new file mode 100644
index 0000000000..878c4328a6
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-for-of-let.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `import` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+for (let y of [])
+ import v from './decl-pos-import-for-of-let.js';
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-for-of-lhs.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-for-of-lhs.js
new file mode 100644
index 0000000000..39663534bd
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-for-of-lhs.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `import` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+for (y of [])
+ import v from './decl-pos-import-for-of-lhs.js';
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-for-of-var.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-for-of-var.js
new file mode 100644
index 0000000000..1348816e93
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-for-of-var.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `import` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+for (var y of [])
+ import v from './decl-pos-import-for-of-var.js';
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-for-var.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-for-var.js
new file mode 100644
index 0000000000..b1e6a4486d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-for-var.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `import` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+for (var x = 0; false;)
+ import v from './decl-pos-import-for-var.js';
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-function-decl.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-function-decl.js
new file mode 100644
index 0000000000..55a4ee84c5
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-function-decl.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `import` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+function f() { import v from './decl-pos-import-function-decl.js'; }
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-function-expr.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-function-expr.js
new file mode 100644
index 0000000000..1b9463875b
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-function-expr.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Expression cannot contain an `import` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+(function() { import v from './decl-pos-import-function-expr.js'; });
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-generator-decl.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-generator-decl.js
new file mode 100644
index 0000000000..9423a97000
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-generator-decl.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `import` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+features: [generators]
+---*/
+
+$DONOTEVALUATE();
+
+function* g() { import v from './decl-pos-import-generator-decl.js'; }
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-generator-expr.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-generator-expr.js
new file mode 100644
index 0000000000..15488f44f2
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-generator-expr.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Expression cannot contain an `import` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+(function*() { import v from './decl-pos-import-generator-expr.js'; });
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-if-else.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-if-else.js
new file mode 100644
index 0000000000..09b51a27ea
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-if-else.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `import` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+if (true) { } else import v from './decl-pos-import-if-else.js';
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-if-if.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-if-if.js
new file mode 100644
index 0000000000..ae0359ce57
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-if-if.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `import` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+if (false) import v from './decl-pos-import-if-if.js';
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-labeled.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-labeled.js
new file mode 100644
index 0000000000..fe65df38ce
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-labeled.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `import` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+test262: import v from './decl-pos-import-labeled.js';
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-object-gen-method.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-object-gen-method.js
new file mode 100644
index 0000000000..f82f1081b2
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-object-gen-method.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Expression cannot contain an `import` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+features: [generators]
+---*/
+
+$DONOTEVALUATE();
+
+({ *m() { import v from './decl-pos-import-object-gen-method.js'; } });
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-object-getter.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-object-getter.js
new file mode 100644
index 0000000000..04ca00873c
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-object-getter.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Expression cannot contain an `import` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+({ get m() { import v from './decl-pos-import-object-getter.js'; } });
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-object-method.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-object-method.js
new file mode 100644
index 0000000000..6c9e170e4e
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-object-method.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Expression cannot contain an `import` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+({ m() { import v from './decl-pos-import-object-method.js'; } });
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-object-setter.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-object-setter.js
new file mode 100644
index 0000000000..4092616a25
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-object-setter.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Expression cannot contain an `import` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+({ set m(x) { import v from './decl-pos-import-object-setter.js'; } });
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-switch-case-dflt.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-switch-case-dflt.js
new file mode 100644
index 0000000000..cd3bfd99da
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-switch-case-dflt.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `import` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+switch(0) { case 1: import v from './decl-pos-import-switch-case-dflt.js'; default: }
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-switch-case.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-switch-case.js
new file mode 100644
index 0000000000..bd61b611f8
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-switch-case.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `import` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+switch(0) { case 1: import v from './decl-pos-import-switch-case.js'; }
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-switch-dftl.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-switch-dftl.js
new file mode 100644
index 0000000000..d3415cd511
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-switch-dftl.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `import` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+switch(0) { default: import v from './decl-pos-import-switch-dftl.js'; }
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-try-catch-finally.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-try-catch-finally.js
new file mode 100644
index 0000000000..1636d2ae38
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-try-catch-finally.js
@@ -0,0 +1,17 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `import` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+try { } catch (err) { } finally {
+ import v from './decl-pos-import-try-catch-finally.js';
+}
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-try-catch.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-try-catch.js
new file mode 100644
index 0000000000..2f015663ed
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-try-catch.js
@@ -0,0 +1,17 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `import` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+try { } catch (err) {
+ import v from './decl-pos-import-try-catch.js';
+}
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-try-finally.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-try-finally.js
new file mode 100644
index 0000000000..4ec1556811
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-try-finally.js
@@ -0,0 +1,17 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `import` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+try { } finally {
+ import v from './decl-pos-import-try-finally.js';
+}
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-try-try.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-try-try.js
new file mode 100644
index 0000000000..6079c59250
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-try-try.js
@@ -0,0 +1,17 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `import` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+try {
+ import v from './decl-pos-import-try-try.js';
+} catch (err) { }
diff --git a/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-while.js b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-while.js
new file mode 100644
index 0000000000..034fac18c9
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-decl-pos-import-while.js
@@ -0,0 +1,15 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Statement cannot contain an `import` declaration
+esid: sec-modules
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+while (false) import v from './decl-pos-import-while.js';
diff --git a/js/src/tests/test262/language/module-code/parse-err-export-dflt-const.js b/js/src/tests/test262/language/module-code/parse-err-export-dflt-const.js
new file mode 100644
index 0000000000..d0bd77e41e
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-export-dflt-const.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-exports
+es6id: 15.2.3
+description: The default export may not be a LexicalDeclaration (const)
+flags: [module]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+export default const x = null;
diff --git a/js/src/tests/test262/language/module-code/parse-err-export-dflt-expr.js b/js/src/tests/test262/language/module-code/parse-err-export-dflt-expr.js
new file mode 100644
index 0000000000..e69c67932f
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-export-dflt-expr.js
@@ -0,0 +1,27 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Expression not permitted in AssignmentExpression position
+esid: sec-exports
+info: |
+ ExportDeclaration:
+ export * FromClause;
+ export * as IdentifierName FromClause;
+ export NamedExports FromClause;
+ export NamedExports;
+ export VariableStatement
+ export Declaration
+ export default HoistableDeclaration[Default]
+ export default ClassDeclaration[Default]
+ export default [lookahead ∉ { function, class }] AssignmentExpression[In];
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+export default null, null;
diff --git a/js/src/tests/test262/language/module-code/parse-err-export-dflt-let.js b/js/src/tests/test262/language/module-code/parse-err-export-dflt-let.js
new file mode 100644
index 0000000000..fa725fff6b
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-export-dflt-let.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-exports
+es6id: 15.2.3
+description: The default export may not be a LexicalDeclaration (let)
+flags: [module]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+export default let x;
diff --git a/js/src/tests/test262/language/module-code/parse-err-export-dflt-var.js b/js/src/tests/test262/language/module-code/parse-err-export-dflt-var.js
new file mode 100644
index 0000000000..7a7ec74f5a
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-export-dflt-var.js
@@ -0,0 +1,16 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-exports
+es6id: 15.2.3
+description: The default export may not be a VariableStatement
+flags: [module]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+export default var x;
diff --git a/js/src/tests/test262/language/module-code/parse-err-hoist-lex-fun.js b/js/src/tests/test262/language/module-code/parse-err-hoist-lex-fun.js
new file mode 100644
index 0000000000..a2e9b271b8
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-hoist-lex-fun.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Function declarations are interpreted as lexically-scoped in module code
+esid: sec-module-semantics-static-semantics-lexicallydeclarednames
+info: |
+ ModuleItem : StatementListItem
+
+ 1. Return LexicallyDeclaredNames of StatementListItem.
+
+ 15.2.1.1 Static Semantics: Early Errors
+
+ - It is a Syntax Error if any element of the LexicallyDeclaredNames of
+ ModuleItemList also occurs in the VarDeclaredNames of ModuleItemList.
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+var f;
+function f() {}
diff --git a/js/src/tests/test262/language/module-code/parse-err-hoist-lex-gen.js b/js/src/tests/test262/language/module-code/parse-err-hoist-lex-gen.js
new file mode 100644
index 0000000000..5eeb410387
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-hoist-lex-gen.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Generator function declarations are interpreted as lexically-scoped in
+ module code
+esid: sec-module-semantics-static-semantics-lexicallydeclarednames
+info: |
+ ModuleItem : StatementListItem
+
+ 1. Return LexicallyDeclaredNames of StatementListItem.
+
+ 15.2.1.1 Static Semantics: Early Errors
+
+ - It is a Syntax Error if any element of the LexicallyDeclaredNames of
+ ModuleItemList also occurs in the VarDeclaredNames of ModuleItemList.
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+features: [generators]
+---*/
+
+$DONOTEVALUATE();
+
+var g;
+function* g() {}
diff --git a/js/src/tests/test262/language/module-code/parse-err-invoke-anon-fun-decl.js b/js/src/tests/test262/language/module-code/parse-err-invoke-anon-fun-decl.js
new file mode 100644
index 0000000000..a6646ca7fb
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-invoke-anon-fun-decl.js
@@ -0,0 +1,27 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Anonymous function declaration must not be interpreted as an expression
+esid: sec-exports
+info: |
+ ExportDeclaration:
+ export * FromClause
+ export * as IdentifierName FromClause;
+ export NamedExports FromClause;
+ export NamedExports;
+ export VariableStatement
+ export Declaration
+ export default HoistableDeclaration[Default]
+ export default ClassDeclaration[Default]
+ export default [lookahead ∉ { function, class }] AssignmentExpression[In];
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+export default function() {}();
diff --git a/js/src/tests/test262/language/module-code/parse-err-invoke-anon-gen-decl.js b/js/src/tests/test262/language/module-code/parse-err-invoke-anon-gen-decl.js
new file mode 100644
index 0000000000..0cacedb823
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-invoke-anon-gen-decl.js
@@ -0,0 +1,29 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ Anonymous generator function declaration must not be interpreted as an
+ expression
+esid: sec-exports
+info: |
+ ExportDeclaration:
+ export * FromClause;
+ export * as IdentifierName FromClause;
+ export NamedExports FromClause;
+ export NamedExports;
+ export VariableStatement
+ export Declaration
+ export default HoistableDeclaration[Default]
+ export default ClassDeclaration[Default]
+ export default [lookahead ∉ { function, class }] AssignmentExpression[In];
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+features: [generators]
+---*/
+
+$DONOTEVALUATE();
+
+export default function* () {}();
diff --git a/js/src/tests/test262/language/module-code/parse-err-return.js b/js/src/tests/test262/language/module-code/parse-err-return.js
new file mode 100644
index 0000000000..2325d7b37c
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-return.js
@@ -0,0 +1,33 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-modules
+es6id: 15.2
+description: ReturnStatement may not be used directly within ModuleBody
+info: |
+ Syntax
+
+ Module :
+ ModuleBodyopt
+
+ ModuleBody :
+ ModuleItemList
+
+ ModuleItemList :
+ ModuleItem
+ ModuleItemList ModuleItem
+
+ ModuleItem:
+ ImportDeclaration
+ ExportDeclaration
+ StatementListItem[~Yield, ~Return]
+flags: [module]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+return;
diff --git a/js/src/tests/test262/language/module-code/parse-err-semi-dflt-expr.js b/js/src/tests/test262/language/module-code/parse-err-semi-dflt-expr.js
new file mode 100644
index 0000000000..95176e2bf0
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-semi-dflt-expr.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ "export default AssignmentExpression" declarations require a trailing
+ semicolon or LineTerminator
+esid: sec-exports
+info: |
+ ExportDeclaration:
+ export * FromClause;
+ export * as IdentifierName FromClause;
+ export NamedExports FromClause;
+ export NamedExports;
+ export VariableStatement
+ export Declaration
+ export default HoistableDeclaration[Default]
+ export default ClassDeclaration[Default]
+ export default [lookahead ∉ { function, class }] AssignmentExpression[In];
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+export default null null;
diff --git a/js/src/tests/test262/language/module-code/parse-err-semi-export-star.js b/js/src/tests/test262/language/module-code/parse-err-semi-export-star.js
new file mode 100644
index 0000000000..c74204e5e2
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-semi-export-star.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ "export *" declarations require a trailing semicolon or LineTerminator
+esid: sec-exports
+info: |
+ ExportDeclaration:
+ export * FromClause;
+ export * as IdentifierName FromClause;
+ export NamedExports FromClause;
+ export NamedExports;
+ export VariableStatement
+ export Declaration
+ export default HoistableDeclaration[Default]
+ export default ClassDeclaration[Default]
+ export default [lookahead ∉ { function, class }] AssignmentExpression[In];
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+features: [export-star-as-namespace-from-module]
+---*/
+
+$DONOTEVALUATE();
+
+export * from './parse-err-semi-export-star.js' null;
diff --git a/js/src/tests/test262/language/module-code/parse-err-semi-name-space-export.js b/js/src/tests/test262/language/module-code/parse-err-semi-name-space-export.js
new file mode 100644
index 0000000000..a225fbe16f
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-semi-name-space-export.js
@@ -0,0 +1,29 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2018 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ "export NameSpaceExport FromClause" declarations require a trailing semicolon
+ or LineTerminator
+esid: sec-exports
+info: |
+ ExportDeclaration:
+ export * FromClause;
+ export * as IdentifierName FromClause;
+ export NamedExports FromClause;
+ export NamedExports;
+ export VariableStatement
+ export Declaration
+ export default HoistableDeclaration[Default]
+ export default ClassDeclaration[Default]
+ export default [lookahead ∉ { function, class }] AssignmentExpression[In];
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+features: [export-star-as-namespace-from-module]
+---*/
+
+$DONOTEVALUATE();
+
+export * as namespace from './parse-err-semi-name-space-export.js' null;
diff --git a/js/src/tests/test262/language/module-code/parse-err-semi-named-export-from.js b/js/src/tests/test262/language/module-code/parse-err-semi-named-export-from.js
new file mode 100644
index 0000000000..f075beda0f
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-semi-named-export-from.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ "export NamedExports FromClause" declarations require a trailing semicolon
+ or LineTerminator
+esid: sec-exports
+info: |
+ ExportDeclaration:
+ export * FromClause;
+ export * as IdentifierName FromClause;
+ export NamedExports FromClause;
+ export NamedExports;
+ export VariableStatement
+ export Declaration
+ export default HoistableDeclaration[Default]
+ export default ClassDeclaration[Default]
+ export default [lookahead ∉ { function, class }] AssignmentExpression[In];
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+export {} from './parse-err-semi-export-clause-from.js' null;
diff --git a/js/src/tests/test262/language/module-code/parse-err-semi-named-export.js b/js/src/tests/test262/language/module-code/parse-err-semi-named-export.js
new file mode 100644
index 0000000000..8729c049d2
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-semi-named-export.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: >
+ "export NamedExports" declarations require a trailing semicolon or
+ LineTerminator
+esid: sec-exports
+info: |
+ ExportDeclaration:
+ export * FromClause;
+ export * as IdentifierName FromClause;
+ export NamedExports FromClause;
+ export NamedExports;
+ export VariableStatement
+ export Declaration
+ export default HoistableDeclaration[Default]
+ export default ClassDeclaration[Default]
+ export default [lookahead ∉ { function, class }] AssignmentExpression[In];
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+export {} null;
diff --git a/js/src/tests/test262/language/module-code/parse-err-syntax-1.js b/js/src/tests/test262/language/module-code/parse-err-syntax-1.js
new file mode 100644
index 0000000000..54fda4c7a6
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-syntax-1.js
@@ -0,0 +1,22 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Early SyntaxError resulting from module parsing
+esid: sec-parsemodule
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ [...]
+ 2. Parse sourceText using Module as the goal symbol and analyze the parse
+ result for any Early Error conditions. If the parse was successful and
+ no early errors were found, let body be the resulting parse tree.
+ Otherwise, let body be a List of one or more SyntaxError objects
+ representing the parsing errors and/or early errors.
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+?
diff --git a/js/src/tests/test262/language/module-code/parse-err-syntax-2.js b/js/src/tests/test262/language/module-code/parse-err-syntax-2.js
new file mode 100644
index 0000000000..ae5f15effa
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-syntax-2.js
@@ -0,0 +1,22 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Early SyntaxError resulting from module parsing
+esid: sec-parsemodule
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ [...]
+ 2. Parse sourceText using Module as the goal symbol and analyze the parse
+ result for any Early Error conditions. If the parse was successful and
+ no early errors were found, let body be the resulting parse tree.
+ Otherwise, let body be a List of one or more SyntaxError objects
+ representing the parsing errors and/or early errors.
+flags: [module]
+---*/
+
+$DONOTEVALUATE();
+
+1++;
diff --git a/js/src/tests/test262/language/module-code/parse-err-yield.js b/js/src/tests/test262/language/module-code/parse-err-yield.js
new file mode 100644
index 0000000000..d34377df9d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-err-yield.js
@@ -0,0 +1,33 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-modules
+es6id: 15.2
+description: YieldExpression may not be used directly within ModuleBody
+info: |
+ Syntax
+
+ Module :
+ ModuleBodyopt
+
+ ModuleBody :
+ ModuleItemList
+
+ ModuleItemList :
+ ModuleItem
+ ModuleItemList ModuleItem
+
+ ModuleItem:
+ ImportDeclaration
+ ExportDeclaration
+ StatementListItem[~Yield, ~Return]
+flags: [module]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+yield;
diff --git a/js/src/tests/test262/language/module-code/parse-export-empty.js b/js/src/tests/test262/language/module-code/parse-export-empty.js
new file mode 100644
index 0000000000..d313bebf98
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/parse-export-empty.js
@@ -0,0 +1,42 @@
+// |reftest| module
+// Copyright (C) 2016 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: A NamedExport does not require an ExportsList.
+esid: sec-parsemodule
+info: |
+ ExportDeclaration:
+ export * FromClause;
+ export * as IdentifierName FromClause;
+ export NamedExports FromClause;
+ export NamedExports;
+ export VariableStatement
+ export Declaration
+ export default HoistableDeclaration[Default]
+ export default ClassDeclaration[Default]
+ export default [lookahead ∉ { function, class }] AssignmentExpression[In];
+
+ NamedExports:
+ { }
+ { ExportsList }
+ { ExportsList , }
+
+ NOTE: This form has no observable side effects.
+flags: [module]
+---*/
+
+export{};
+export {};
+export {}
+export { };
+export
+{
+
+};
+export//-
+{//-
+//-
+};
+export/**/{/**/};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/private-identifiers-not-empty.js b/js/src/tests/test262/language/module-code/private-identifiers-not-empty.js
new file mode 100644
index 0000000000..7a2e004e8f
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/private-identifiers-not-empty.js
@@ -0,0 +1,19 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2019 Caio Lima (Igalia SL). All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-static-semantics-early-errors
+description: >
+ ModuleBody : ModuleItemList
+ It is a Syntax Error if AllPrivateIdentifiersValid of ModuleItemList with an empty List as an argument is false.
+flags: [module]
+features: [class-static-fields-private]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+var x = {};
+x.#f = 'Test262';
diff --git a/js/src/tests/test262/language/module-code/privatename-not-valid-earlyerr-module-1.js b/js/src/tests/test262/language/module-code/privatename-not-valid-earlyerr-module-1.js
new file mode 100644
index 0000000000..7e5595c786
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/privatename-not-valid-earlyerr-module-1.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-module-semantics-static-semantics-early-errors
+description: Early error when referencing privatename in constructor without being declared in class fields
+info: |
+ Static Semantics: Early Errors
+ Module : ModuleBody
+ It is a Syntax Error if AllPrivateNamesValid of ModuleBody with an empty List as an argument is false.
+features: [class, class-fields-private]
+flags: [module]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ constructor() {
+ this.#x;
+ }
+}
diff --git a/js/src/tests/test262/language/module-code/privatename-not-valid-earlyerr-module-2.js b/js/src/tests/test262/language/module-code/privatename-not-valid-earlyerr-module-2.js
new file mode 100644
index 0000000000..f4a6aee833
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/privatename-not-valid-earlyerr-module-2.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-module-semantics-static-semantics-early-errors
+description: Early error when referencing privatename in function without declaring in class
+info: |
+ Static Semantics: Early Errors
+ Module : ModuleBody
+ It is a Syntax Error if AllPrivateNamesValid of ModuleBody with an empty List as an argument is false.
+features: [class, class-fields-private]
+flags: [module]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ f() {
+ this.#x;
+ }
+}
diff --git a/js/src/tests/test262/language/module-code/privatename-not-valid-earlyerr-module-3.js b/js/src/tests/test262/language/module-code/privatename-not-valid-earlyerr-module-3.js
new file mode 100644
index 0000000000..7cb12cc797
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/privatename-not-valid-earlyerr-module-3.js
@@ -0,0 +1,22 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-module-semantics-static-semantics-early-errors
+description: Early error when referencing privatename in field without being declared in class fields
+info: |
+ Static Semantics: Early Errors
+ Module : ModuleBody
+ It is a Syntax Error if AllPrivateNamesValid of ModuleBody with an empty List as an argument is false.
+features: [class, class-fields-private, class-fields-public]
+flags: [module]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ y = this.#x;
+}
diff --git a/js/src/tests/test262/language/module-code/privatename-not-valid-earlyerr-module-4.js b/js/src/tests/test262/language/module-code/privatename-not-valid-earlyerr-module-4.js
new file mode 100644
index 0000000000..cd5d27f590
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/privatename-not-valid-earlyerr-module-4.js
@@ -0,0 +1,28 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-module-semantics-static-semantics-early-errors
+description: Early error when referencing privatename that has not been declared in class.
+info: |
+ Static Semantics: Early Errors
+ Static Semantics: Early Errors
+ Module : ModuleBody
+ It is a Syntax Error if AllPrivateNamesValid of ModuleBody with an empty List as an argument is false.
+features: [class, class-fields-private]
+flags: [module]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ f() {
+ this.#x;
+ class D extends C {
+ #x;
+ }
+ }
+}
diff --git a/js/src/tests/test262/language/module-code/privatename-not-valid-earlyerr-module-5.js b/js/src/tests/test262/language/module-code/privatename-not-valid-earlyerr-module-5.js
new file mode 100644
index 0000000000..ef3efaed81
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/privatename-not-valid-earlyerr-module-5.js
@@ -0,0 +1,24 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-module-semantics-static-semantics-early-errors
+description: Early error when referencing privatename outside of class
+info: |
+ Static Semantics: Early Errors
+ Module : ModuleBody
+ It is a Syntax Error if AllPrivateNamesValid of ModuleBody with an empty List as an argument is false.
+features: [class, class-fields-private]
+flags: [module]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+class C {
+ #x;
+}
+
+new C().#x;
diff --git a/js/src/tests/test262/language/module-code/privatename-not-valid-earlyerr-module-6.js b/js/src/tests/test262/language/module-code/privatename-not-valid-earlyerr-module-6.js
new file mode 100644
index 0000000000..cf6036eafc
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/privatename-not-valid-earlyerr-module-6.js
@@ -0,0 +1,22 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-module-semantics-static-semantics-early-errors
+description: Early error when referencing privatename outside of class.
+info: |
+ Static Semantics: Early Errors
+ Module : ModuleBody
+ It is a Syntax Error if AllPrivateNamesValid of ModuleBody with an empty List as an argument is false.
+features: [class, class-fields-private]
+flags: [module]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+class C {}
+
+new C().#x;
diff --git a/js/src/tests/test262/language/module-code/privatename-not-valid-earlyerr-module-7.js b/js/src/tests/test262/language/module-code/privatename-not-valid-earlyerr-module-7.js
new file mode 100644
index 0000000000..6c4204e509
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/privatename-not-valid-earlyerr-module-7.js
@@ -0,0 +1,22 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-module-semantics-static-semantics-early-errors
+description: Early error when referencing privatename on object, outside of class.
+info: |
+ Static Semantics: Early Errors
+ Module : ModuleBody
+ It is a Syntax Error if AllPrivateNamesValid of ModuleBody with an empty List as an argument is false.
+features: [class-fields-private]
+flags: [module]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+obj = {};
+
+obj.#x;
diff --git a/js/src/tests/test262/language/module-code/privatename-not-valid-earlyerr-module-8.js b/js/src/tests/test262/language/module-code/privatename-not-valid-earlyerr-module-8.js
new file mode 100644
index 0000000000..6350131e9e
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/privatename-not-valid-earlyerr-module-8.js
@@ -0,0 +1,22 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-module-semantics-static-semantics-early-errors
+description: Early error when referencing privatename on object, outside of class.
+info: |
+ Static Semantics: Early Errors
+ Module : ModuleBody
+ It is a Syntax Error if AllPrivateNamesValid of ModuleBody with an empty List as an argument is false.
+features: [class-fields-private]
+flags: [module]
+negative:
+ phase: parse
+ type: SyntaxError
+---*/
+
+$DONOTEVALUATE();
+
+function f() {
+ this.#x;
+}
diff --git a/js/src/tests/test262/language/module-code/privatename-valid-no-earlyerr.js b/js/src/tests/test262/language/module-code/privatename-valid-no-earlyerr.js
new file mode 100644
index 0000000000..a9b3c121d6
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/privatename-valid-no-earlyerr.js
@@ -0,0 +1,50 @@
+// |reftest| module
+// Copyright (C) 2017 Valerie Young. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+esid: sec-module-semantics-static-semantics-early-errors
+description: Referencing privatename in class within class does not error.
+info: |
+ Static Semantics: Early Errors
+ Module : ModuleBody
+ It is a Syntax Error if AllPrivateNamesValid of ModuleBody with an empty List as an argument is false.
+
+ Static Semantics: AllPrivateNamesValid
+ AllPrivateNamesValid is an abstract operation which takes names as an argument.
+
+ MemberExpression : MemberExpression . PrivateName
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+ CallExpression : CallExpression . PrivateName
+ 1. If StringValue of PrivateName is in names, return true.
+ 2. Return false.
+
+ ClassBody:ClassElementList
+ 1. Let newNames be the concatenation of names with PrivateBoundNames of ClassBody.
+ 2.Return AllPrivateNamesValid of ClassElementList with the argument newNames.
+
+ For all other grammatical productions, recurse on subexpressions/substatements, passing in the names of the caller. If all pieces return true, then return true. If any returns false, return false.
+flags: [module]
+features: [class, class-fields-private]
+---*/
+
+class outer {
+ #x = 42;
+
+ f() {
+ var self = this;
+ return class inner {
+ g() {
+ return self.#x;
+ }
+ }
+ }
+}
+
+var innerclass = new outer().f();
+var test = new innerclass().g();
+
+assert.sameValue(test, 42);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/shell.js b/js/src/tests/test262/language/module-code/shell.js
new file mode 100644
index 0000000000..d8963d9d60
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/shell.js
@@ -0,0 +1,14 @@
+// GENERATED, DO NOT EDIT
+// file: fnGlobalObject.js
+// Copyright (C) 2017 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: |
+ Produce a reliable global object
+defines: [fnGlobalObject]
+---*/
+
+var __globalObject = Function("return this;")();
+function fnGlobalObject() {
+ return __globalObject;
+}
diff --git a/js/src/tests/test262/language/module-code/top-level-await/await-awaits-thenable-not-callable.js b/js/src/tests/test262/language/module-code/top-level-await/await-awaits-thenable-not-callable.js
new file mode 100644
index 0000000000..44ac15e00f
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/await-awaits-thenable-not-callable.js
@@ -0,0 +1,19 @@
+// |reftest| module async
+// Copyright 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: prod-AwaitExpression
+description: >
+ Await can await any thenable. If the thenable's then is not callable,
+ await evaluates to the thenable
+flags: [module, async]
+features: [top-level-await]
+---*/
+
+var thenable = { then: 42 };
+var res = await thenable;
+assert.sameValue(res, thenable);
+
+$DONE();
+
diff --git a/js/src/tests/test262/language/module-code/top-level-await/await-awaits-thenables-that-throw.js b/js/src/tests/test262/language/module-code/top-level-await/await-awaits-thenables-that-throw.js
new file mode 100644
index 0000000000..c3d28ddc2d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/await-awaits-thenables-that-throw.js
@@ -0,0 +1,30 @@
+// |reftest| module async
+// Copyright 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: prod-AwaitExpression
+description: >
+ Await can await any thenable.
+flags: [module, async]
+features: [top-level-await]
+---*/
+
+var error = {};
+var thenable = {
+ then: function (resolve, reject) {
+ throw error;
+ }
+}
+
+var caught = false;
+try {
+ await thenable;
+} catch(e) {
+ caught = e;
+
+}
+
+assert.sameValue(caught, error);
+
+$DONE();
diff --git a/js/src/tests/test262/language/module-code/top-level-await/await-awaits-thenables.js b/js/src/tests/test262/language/module-code/top-level-await/await-awaits-thenables.js
new file mode 100644
index 0000000000..8eb5689ff2
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/await-awaits-thenables.js
@@ -0,0 +1,21 @@
+// |reftest| module async
+// Copyright 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: prod-AwaitExpression
+description: >
+ Await can await any thenable.
+flags: [module, async]
+features: [top-level-await]
+---*/
+
+var thenable = {
+ then: function (resolve, reject) {
+ resolve(42);
+ }
+}
+
+assert.sameValue(await thenable, 42);
+
+$DONE();
diff --git a/js/src/tests/test262/language/module-code/top-level-await/await-dynamic-import-rejection.js b/js/src/tests/test262/language/module-code/top-level-await/await-dynamic-import-rejection.js
new file mode 100644
index 0000000000..584e13bb06
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/await-dynamic-import-rejection.js
@@ -0,0 +1,54 @@
+// |reftest| error:TypeError module
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-moduleevaluation
+description: >
+ Top Level Await on a Dynamic import
+info: |
+ InnerModuleEvaluation( module, stack, index )
+
+ ...
+ 14. If module.[[PendingAsyncDependencies]] is > 0, set module.[[AsyncEvaluating]] to true.
+ 15. Otherwise, if module.[[Async]] is true, perform ! ExecuteAsyncModule(module).
+ 16. Otherwise, perform ? module.ExecuteModule().
+
+ ExecuteAsyncModule ( module )
+
+ 1. Assert: module.[[Status]] is "evaluating" or "evaluated".
+ 2. Assert: module.[[Async]] is true.
+ 3. Set module.[[AsyncEvaluating]] to true.
+ 4. Let capability be ! NewPromiseCapability(%Promise%).
+ 5. Let stepsFulfilled be the steps of a CallAsyncModuleFulfilled function as specified below.
+ ...
+ 8. Let stepsRejected be the steps of a CallAsyncModuleRejected function as specified below.
+ ...
+ 11. Perform ! PerformPromiseThen(capability.[[Promise]], onFulfilled, onRejected).
+ 12. Perform ! module.ExecuteModule(capability).
+ 13. Return.
+
+ ExecuteModule ( [ capability ] )
+
+ ...
+ 11. If module.[[Async]] is false, then
+ a. Assert: capability was not provided.
+ b. Push moduleCxt on to the execution context stack; moduleCxt is now the running execution context.
+ c. Let result be the result of evaluating module.[[ECMAScriptCode]].
+ d. Suspend moduleCxt and remove it from the execution context stack.
+ e. Resume the context that is now on the top of the execution context stack as the running execution context.
+ f. Return Completion(result).
+ 12. Otherwise,
+ a. Assert: capability is a PromiseCapability Record.
+ b. Perform ! AsyncBlockStart(capability, module.[[ECMAScriptCode]], moduleCxt).
+ c. Return.
+flags: [module]
+features: [top-level-await, dynamic-import]
+negative:
+ phase: runtime
+ type: TypeError
+---*/
+
+await import('./module-import-rejection-body_FIXTURE.js');
+
+throw new Test262Error('this should be unreachable');
diff --git a/js/src/tests/test262/language/module-code/top-level-await/await-dynamic-import-resolution.js b/js/src/tests/test262/language/module-code/top-level-await/await-dynamic-import-resolution.js
new file mode 100644
index 0000000000..44966325bc
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/await-dynamic-import-resolution.js
@@ -0,0 +1,55 @@
+// |reftest| module async
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-moduleevaluation
+description: >
+ Top Level Await on a Dynamic import
+info: |
+ InnerModuleEvaluation( module, stack, index )
+
+ ...
+ 14. If module.[[PendingAsyncDependencies]] is > 0, set module.[[AsyncEvaluating]] to true.
+ 15. Otherwise, if module.[[Async]] is true, perform ! ExecuteAsyncModule(module).
+ 16. Otherwise, perform ? module.ExecuteModule().
+
+ ExecuteAsyncModule ( module )
+
+ 1. Assert: module.[[Status]] is "evaluating" or "evaluated".
+ 2. Assert: module.[[Async]] is true.
+ 3. Set module.[[AsyncEvaluating]] to true.
+ 4. Let capability be ! NewPromiseCapability(%Promise%).
+ 5. Let stepsFulfilled be the steps of a CallAsyncModuleFulfilled function as specified below.
+ ...
+ 8. Let stepsRejected be the steps of a CallAsyncModuleRejected function as specified below.
+ ...
+ 11. Perform ! PerformPromiseThen(capability.[[Promise]], onFulfilled, onRejected).
+ 12. Perform ! module.ExecuteModule(capability).
+ 13. Return.
+
+ ExecuteModule ( [ capability ] )
+
+ ...
+ 11. If module.[[Async]] is false, then
+ a. Assert: capability was not provided.
+ b. Push moduleCxt on to the execution context stack; moduleCxt is now the running execution context.
+ c. Let result be the result of evaluating module.[[ECMAScriptCode]].
+ d. Suspend moduleCxt and remove it from the execution context stack.
+ e. Resume the context that is now on the top of the execution context stack as the running execution context.
+ f. Return Completion(result).
+ 12. Otherwise,
+ a. Assert: capability is a PromiseCapability Record.
+ b. Perform ! AsyncBlockStart(capability, module.[[ECMAScriptCode]], moduleCxt).
+ c. Return.
+flags: [module, async]
+features: [top-level-await, dynamic-import]
+---*/
+
+var ns = await import('./module-import-resolution_FIXTURE.js');
+
+assert.sameValue(ns.default, 42);
+assert.sameValue(ns.x, 'named');
+assert.sameValue(ns.y, 39);
+
+$DONE();
diff --git a/js/src/tests/test262/language/module-code/top-level-await/await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/await-expr-func-expression.js
new file mode 100644
index 0000000000..fef2a48fce
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/await-expr-func-expression.js
@@ -0,0 +1,50 @@
+// |reftest| module async
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ A function after top level await is an expression and not a hoistable declaration
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+esid: prod-AwaitExpression
+flags: [module, async]
+features: [top-level-await]
+---*/
+
+function fn() { return 42; }
+await function fn() { return 111; };
+
+assert.sameValue(fn(), 42);
+
+$DONE();
diff --git a/js/src/tests/test262/language/module-code/top-level-await/await-expr-new-expr-reject.js b/js/src/tests/test262/language/module-code/top-level-await/await-expr-new-expr-reject.js
new file mode 100644
index 0000000000..95568cf129
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/await-expr-new-expr-reject.js
@@ -0,0 +1,47 @@
+// |reftest| module async
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Evaluation of a rejected promise
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+esid: prod-AwaitExpression
+flags: [module, async]
+features: [top-level-await]
+---*/
+
+var obj = new Test262Error();
+
+try {
+ await Promise.reject(obj);
+} catch (e) {
+ assert.sameValue(e, obj);
+ $DONE();
+}
+
+// Can't use assert.throws here as it relies in a nested function.
diff --git a/js/src/tests/test262/language/module-code/top-level-await/await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/await-expr-new-expr.js
new file mode 100644
index 0000000000..9c5388ae58
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/await-expr-new-expr.js
@@ -0,0 +1,44 @@
+// |reftest| module async
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Evaluation of await before a NewExpression
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+esid: prod-AwaitExpression
+flags: [module, async]
+features: [top-level-await]
+---*/
+
+var value = await new Promise(function(res, rej) {
+ res(42);
+});
+
+assert.sameValue(value, 42);
+
+$DONE();
diff --git a/js/src/tests/test262/language/module-code/top-level-await/await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/await-expr-regexp.js
new file mode 100644
index 0000000000..9bb6e88c08
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/await-expr-regexp.js
@@ -0,0 +1,57 @@
+// |reftest| module async
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Verify a RegularExpressionLiteral following an AwaitExpression is
+ not ambiguous to an Division
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+esid: prod-AwaitExpression
+flags: [module, async]
+features: [top-level-await]
+---*/
+
+var lol = false;
+var x = {
+ get y() {
+ lol = true;
+ }
+};
+
+var g = 42;
+
+await /x.y/g;
+
+if (lol) {
+ $DONE('It should be a RegExp');
+} else {
+ $DONE();
+}
diff --git a/js/src/tests/test262/language/module-code/top-level-await/await-expr-reject-throws.js b/js/src/tests/test262/language/module-code/top-level-await/await-expr-reject-throws.js
new file mode 100644
index 0000000000..9998177136
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/await-expr-reject-throws.js
@@ -0,0 +1,92 @@
+// |reftest| module async
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ AwaitExpression evaluates to abrupt completions in promise rejections
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ void UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+esid: prod-AwaitExpression
+flags: [module, async]
+features: [top-level-await]
+---*/
+
+var x;
+
+try {
+ await Promise.reject(42);
+} catch (e) {
+ x = e;
+}
+assert.sameValue(x, 42, 'number');
+
+try {
+ await Promise.reject('');
+} catch (e) {
+ x = e;
+}
+assert.sameValue(x, '', 'string');
+
+try {
+ var s = Symbol();
+ await Promise.reject(s);
+} catch (e) {
+ x = e;
+}
+assert.sameValue(x, s, 'symbol');
+
+try {
+ await Promise.reject(false);
+} catch (e) {
+ x = e;
+}
+assert.sameValue(x, false, 'false');
+
+try {
+ await Promise.reject(true);
+} catch (e) {
+ x = e;
+}
+assert.sameValue(x, true, 'true');
+
+try {
+ await Promise.reject(NaN);
+} catch (e) {
+ x = e;
+}
+assert.sameValue(x, NaN, 'NaN');
+
+try {
+ await Promise.reject(null);
+} catch (e) {
+ x = e;
+}
+assert.sameValue(x, null, 'null');
+
+try {
+ await Promise.reject(undefined);
+} catch (e) {
+ x = e;
+}
+assert.sameValue(x, undefined, 'undefined');
+
+try {
+ var obj = {};
+ await Promise.reject(obj);
+} catch (e) {
+ x = e;
+}
+assert.sameValue(x, obj, 'object');
+
+$DONE();
diff --git a/js/src/tests/test262/language/module-code/top-level-await/await-expr-resolution.js b/js/src/tests/test262/language/module-code/top-level-await/await-expr-resolution.js
new file mode 100644
index 0000000000..9abfeadcc2
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/await-expr-resolution.js
@@ -0,0 +1,59 @@
+// |reftest| module async
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ AwaitExpression Resolutions
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ void UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+esid: prod-AwaitExpression
+flags: [module, async]
+features: [top-level-await]
+---*/
+
+var x;
+
+x = await 42;
+assert.sameValue(x, 42, 'number');
+
+x = await '';
+assert.sameValue(x, '', 'string');
+
+var s = Symbol();
+x = await s;
+assert.sameValue(x, s, 'symbol');
+
+x = await false;
+assert.sameValue(x, false, 'false');
+
+x = await true;
+assert.sameValue(x, true, 'true');
+
+x = await NaN;
+assert.sameValue(x, NaN, 'NaN');
+
+x = await null;
+assert.sameValue(x, null, 'null');
+
+x = await undefined;
+assert.sameValue(x, undefined, 'undefined');
+
+var obj = {};
+x = await obj;
+assert.sameValue(x, obj, 'object');
+
+x = await Promise.resolve(1).then(v => v * 2).then(v => v * 3);
+assert.sameValue(x, 6, 'promise');
+
+$DONE();
diff --git a/js/src/tests/test262/language/module-code/top-level-await/await-void-expr.js b/js/src/tests/test262/language/module-code/top-level-await/await-void-expr.js
new file mode 100644
index 0000000000..f9dda1888a
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/await-void-expr.js
@@ -0,0 +1,29 @@
+// |reftest| module async
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ AwaitExpression void resolves into undefined
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ void UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+esid: prod-AwaitExpression
+flags: [module, async]
+features: [top-level-await]
+---*/
+
+var x = await void 1;
+
+assert.sameValue(x, undefined);
+
+$DONE();
diff --git a/js/src/tests/test262/language/module-code/top-level-await/browser.js b/js/src/tests/test262/language/module-code/top-level-await/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/browser.js
diff --git a/js/src/tests/test262/language/module-code/top-level-await/dfs-invariant-async_FIXTURE.js b/js/src/tests/test262/language/module-code/top-level-await/dfs-invariant-async_FIXTURE.js
new file mode 100644
index 0000000000..64c5bce13e
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/dfs-invariant-async_FIXTURE.js
@@ -0,0 +1,5 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+await 0;
+globalThis.test262 = 'async';
diff --git a/js/src/tests/test262/language/module-code/top-level-await/dfs-invariant-direct-1_FIXTURE.js b/js/src/tests/test262/language/module-code/top-level-await/dfs-invariant-direct-1_FIXTURE.js
new file mode 100644
index 0000000000..32763e3559
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/dfs-invariant-direct-1_FIXTURE.js
@@ -0,0 +1,5 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+import './dfs-invariant-async_FIXTURE.js';
+globalThis.test262 += ':direct-1';
diff --git a/js/src/tests/test262/language/module-code/top-level-await/dfs-invariant-direct-2_FIXTURE.js b/js/src/tests/test262/language/module-code/top-level-await/dfs-invariant-direct-2_FIXTURE.js
new file mode 100644
index 0000000000..03ab534275
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/dfs-invariant-direct-2_FIXTURE.js
@@ -0,0 +1,5 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+import './dfs-invariant-async_FIXTURE.js';
+globalThis.test262 += ':direct-2';
diff --git a/js/src/tests/test262/language/module-code/top-level-await/dfs-invariant-indirect_FIXTURE.js b/js/src/tests/test262/language/module-code/top-level-await/dfs-invariant-indirect_FIXTURE.js
new file mode 100644
index 0000000000..22a2aaae34
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/dfs-invariant-indirect_FIXTURE.js
@@ -0,0 +1,5 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+import './dfs-invariant-direct-1_FIXTURE.js';
+globalThis.test262 += ':indirect';
diff --git a/js/src/tests/test262/language/module-code/top-level-await/dfs-invariant.js b/js/src/tests/test262/language/module-code/top-level-await/dfs-invariant.js
new file mode 100644
index 0000000000..64a6f6803c
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/dfs-invariant.js
@@ -0,0 +1,43 @@
+// |reftest| module
+// Copyright (C) 2021 the V8 project authors. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+/*---
+description: Parent completion orderings match the synchronous module behavior
+info: |
+ 6.2.4 AsyncModuleExecutionFulfilled ( module )
+
+ [...]
+ 5. Let _execList_ be a new empty List.
+ 6. Perform ! GatherAsyncParentCompletions(_module_, _execList_).
+ 7. Let _sortedExecList_ be a List of elements that are the elements of
+ _execList_, in the order in which they had their [[AsyncEvaluating]]
+ fields set to *true* in InnerModuleEvaluation.
+ 8. Assert: All elements of _sortedExecList_ have their [[AsyncEvaluating]]
+ field set to *true*, [[PendingAsyncDependencies]] field set to 0 and
+ [[EvaluationError]] field set to *undefined*.
+ [...]
+
+ Dependency graph for this test:
+
+ dfs-invariant.js
+ .-----------------------------------+-------.
+ | | v
+ | | dfs-invariant-indirect_FIXTURE.js
+ | .---|----------------------'
+ v v v
+ dfs-invariant-direct-1_FIXTURE.js dfs-invariant-direct-2_FIXTURE.js
+ '--------. .--------'
+ v v
+ dfs-invariant-async_FIXTURE.js
+esid: sec-moduleevaluation
+flags: [module]
+features: [top-level-await, globalThis]
+---*/
+
+import './dfs-invariant-direct-1_FIXTURE.js';
+import './dfs-invariant-direct-2_FIXTURE.js';
+import './dfs-invariant-indirect_FIXTURE.js';
+
+assert.sameValue(globalThis.test262, 'async:direct-1:direct-2:indirect');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/dynamic-import-rejection.js b/js/src/tests/test262/language/module-code/top-level-await/dynamic-import-rejection.js
new file mode 100644
index 0000000000..44240e2cad
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/dynamic-import-rejection.js
@@ -0,0 +1,55 @@
+// |reftest| module async
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-moduleevaluation
+description: >
+ Dynamic imported module with async exports
+info: |
+ InnerModuleEvaluation( module, stack, index )
+
+ ...
+ 14. If module.[[PendingAsyncDependencies]] is > 0, set module.[[AsyncEvaluating]] to true.
+ 15. Otherwise, if module.[[Async]] is true, perform ! ExecuteAsyncModule(module).
+ 16. Otherwise, perform ? module.ExecuteModule().
+
+ ExecuteAsyncModule ( module )
+
+ 1. Assert: module.[[Status]] is "evaluating" or "evaluated".
+ 2. Assert: module.[[Async]] is true.
+ 3. Set module.[[AsyncEvaluating]] to true.
+ 4. Let capability be ! NewPromiseCapability(%Promise%).
+ 5. Let stepsFulfilled be the steps of a CallAsyncModuleFulfilled function as specified below.
+ ...
+ 8. Let stepsRejected be the steps of a CallAsyncModuleRejected function as specified below.
+ ...
+ 11. Perform ! PerformPromiseThen(capability.[[Promise]], onFulfilled, onRejected).
+ 12. Perform ! module.ExecuteModule(capability).
+ 13. Return.
+
+ ExecuteModule ( [ capability ] )
+
+ ...
+ 11. If module.[[Async]] is false, then
+ a. Assert: capability was not provided.
+ b. Push moduleCxt on to the execution context stack; moduleCxt is now the running execution context.
+ c. Let result be the result of evaluating module.[[ECMAScriptCode]].
+ d. Suspend moduleCxt and remove it from the execution context stack.
+ e. Resume the context that is now on the top of the execution context stack as the running execution context.
+ f. Return Completion(result).
+ 12. Otherwise,
+ a. Assert: capability is a PromiseCapability Record.
+ b. Perform ! AsyncBlockStart(capability, module.[[ECMAScriptCode]], moduleCxt).
+ c. Return.
+flags: [module, async]
+features: [top-level-await, dynamic-import]
+---*/
+
+import('./module-import-rejection_FIXTURE.js').then(() => {
+ throw new Test262Error('Should not be fulfilled');
+}, (err) => {
+ assert(err instanceof TypeError);
+ assert.sameValue(err.constructor, TypeError);
+ assert.sameValue(err.message, 'error in the default export line');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/dynamic-import-resolution.js b/js/src/tests/test262/language/module-code/top-level-await/dynamic-import-resolution.js
new file mode 100644
index 0000000000..c208025342
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/dynamic-import-resolution.js
@@ -0,0 +1,53 @@
+// |reftest| module async
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-moduleevaluation
+description: >
+ Dynamic imported module with async exports
+info: |
+ InnerModuleEvaluation( module, stack, index )
+
+ ...
+ 14. If module.[[PendingAsyncDependencies]] is > 0, set module.[[AsyncEvaluating]] to true.
+ 15. Otherwise, if module.[[Async]] is true, perform ! ExecuteAsyncModule(module).
+ 16. Otherwise, perform ? module.ExecuteModule().
+
+ ExecuteAsyncModule ( module )
+
+ 1. Assert: module.[[Status]] is "evaluating" or "evaluated".
+ 2. Assert: module.[[Async]] is true.
+ 3. Set module.[[AsyncEvaluating]] to true.
+ 4. Let capability be ! NewPromiseCapability(%Promise%).
+ 5. Let stepsFulfilled be the steps of a CallAsyncModuleFulfilled function as specified below.
+ ...
+ 8. Let stepsRejected be the steps of a CallAsyncModuleRejected function as specified below.
+ ...
+ 11. Perform ! PerformPromiseThen(capability.[[Promise]], onFulfilled, onRejected).
+ 12. Perform ! module.ExecuteModule(capability).
+ 13. Return.
+
+ ExecuteModule ( [ capability ] )
+
+ ...
+ 11. If module.[[Async]] is false, then
+ a. Assert: capability was not provided.
+ b. Push moduleCxt on to the execution context stack; moduleCxt is now the running execution context.
+ c. Let result be the result of evaluating module.[[ECMAScriptCode]].
+ d. Suspend moduleCxt and remove it from the execution context stack.
+ e. Resume the context that is now on the top of the execution context stack as the running execution context.
+ f. Return Completion(result).
+ 12. Otherwise,
+ a. Assert: capability is a PromiseCapability Record.
+ b. Perform ! AsyncBlockStart(capability, module.[[ECMAScriptCode]], moduleCxt).
+ c. Return.
+flags: [module, async]
+features: [top-level-await, dynamic-import]
+---*/
+
+import('./module-import-resolution_FIXTURE.js').then(ns => {
+ assert.sameValue(ns.default, 42);
+ assert.sameValue(ns.x, 'named');
+ assert.sameValue(ns.y, 39);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/early-errors-await-not-simple-assignment-target.js b/js/src/tests/test262/language/module-code/top-level-await/early-errors-await-not-simple-assignment-target.js
new file mode 100644
index 0000000000..f55e199b46
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/early-errors-await-not-simple-assignment-target.js
@@ -0,0 +1,18 @@
+// |reftest| error:SyntaxError module
+// Copyright 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: prod-AwaitExpression
+description: >
+ await is not a simple assignment target and cannot be assigned to.
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+features: [top-level-await]
+---*/
+
+$DONOTEVALUATE();
+
+(await 1) = 1;
diff --git a/js/src/tests/test262/language/module-code/top-level-await/if-await-expr.js b/js/src/tests/test262/language/module-code/top-level-await/if-await-expr.js
new file mode 100644
index 0000000000..74ac54b5b6
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/if-await-expr.js
@@ -0,0 +1,33 @@
+// |reftest| module async
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Evaluate Await expression for IfStatement
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+esid: prod-AwaitExpression
+flags: [module, async]
+features: [top-level-await]
+---*/
+
+var completed = 0;
+var p = Promise.resolve(true);
+
+if (await p) {
+ completed += 1;
+}
+
+assert.sameValue(completed, 1);
+
+$DONE();
diff --git a/js/src/tests/test262/language/module-code/top-level-await/module-async-import-async-resolution-ticks.js b/js/src/tests/test262/language/module-code/top-level-await/module-async-import-async-resolution-ticks.js
new file mode 100644
index 0000000000..49f1084a6d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/module-async-import-async-resolution-ticks.js
@@ -0,0 +1,87 @@
+// |reftest| module async
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-moduleevaluation
+description: >
+ Ticks from async module (w/ TLA) won't change loading async module
+info: |
+ Table 3: Additional Fields of Cyclic Module Records
+
+ [[Async]]
+
+ ...
+ Having an asynchronous dependency does not make the module asynchronous. This field must not change after the module is parsed.
+
+ Evaluate ( ) Concrete Method
+
+ ...
+ 6. Let capability be ! NewPromiseCapability(%Promise%).
+ 7. Set module.[[TopLevelCapability]] to capability.
+ 8. Let result be InnerModuleEvaluation(module, stack, 0).
+ 9. If result is an abrupt completion, then
+ ...
+ d. Perform ! Call(capability.[[Reject]], undefined, «result.[[Value]]»).
+ 10. Otherwise,
+ ...
+ b. If module.[[AsyncEvaluating]] is false, then
+ i. Perform ! Call(capability.[[Resolve]], undefined, «undefined»).
+ ...
+ 11. Return undefinedcapability.[[Promise]].
+
+ InnerModuleEvaluation( module, stack, index )
+
+ ...
+ 14. If module.[[PendingAsyncDependencies]] is > 0, set module.[[AsyncEvaluating]] to true.
+ 15. Otherwise, if module.[[Async]] is true, perform ! ExecuteAsyncModule(module).
+ 16. Otherwise, perform ? module.ExecuteModule().
+
+ ExecuteAsyncModule ( module )
+
+ 1. Assert: module.[[Status]] is "evaluating" or "evaluated".
+ 2. Assert: module.[[Async]] is true.
+ 3. Set module.[[AsyncEvaluating]] to true.
+ 4. Let capability be ! NewPromiseCapability(%Promise%).
+ 5. Let stepsFulfilled be the steps of a CallAsyncModuleFulfilled function as specified below.
+ ...
+ 8. Let stepsRejected be the steps of a CallAsyncModuleRejected function as specified below.
+ ...
+ 11. Perform ! PerformPromiseThen(capability.[[Promise]], onFulfilled, onRejected).
+ 12. Perform ! module.ExecuteModule(capability).
+ 13. Return.
+
+ ExecuteModule ( [ capability ] )
+
+ ...
+ 11. If module.[[Async]] is false, then
+ a. Assert: capability was not provided.
+ b. Push moduleCxt on to the execution context stack; moduleCxt is now the running execution context.
+ c. Let result be the result of evaluating module.[[ECMAScriptCode]].
+ d. Suspend moduleCxt and remove it from the execution context stack.
+ e. Resume the context that is now on the top of the execution context stack as the running execution context.
+ f. Return Completion(result).
+ 12. Otherwise,
+ a. Assert: capability is a PromiseCapability Record.
+ b. Perform ! AsyncBlockStart(capability, module.[[ECMAScriptCode]], moduleCxt).
+ c. Return.
+flags: [module, async]
+features: [top-level-await]
+---*/
+
+var x = 'synchronous evaluation';
+
+Promise.resolve().then(() => x = 'tick in the async evaluation');
+
+// module 'foo' won't tick here
+import foo from './module-import-resolution_FIXTURE.js';
+
+assert.sameValue(foo, 42);
+assert.sameValue(x, 'synchronous evaluation');
+
+// Enforce [[Async]] to true, and tick
+await 1;
+
+assert.sameValue(x, 'tick in the async evaluation');
+
+$DONE();
diff --git a/js/src/tests/test262/language/module-code/top-level-await/module-import-rejection-body.js b/js/src/tests/test262/language/module-code/top-level-await/module-import-rejection-body.js
new file mode 100644
index 0000000000..5996ef4eac
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/module-import-rejection-body.js
@@ -0,0 +1,77 @@
+// |reftest| error:TypeError module
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-moduleevaluation
+description: >
+ Evaluate imported rejected module
+info: |
+ Table 3: Additional Fields of Cyclic Module Records
+
+ [[Async]]
+
+ ...
+ Having an asynchronous dependency does not make the module asynchronous. This field must not change after the module is parsed.
+
+ Evaluate ( ) Concrete Method
+
+ ...
+ 6. Let capability be ! NewPromiseCapability(%Promise%).
+ 7. Set module.[[TopLevelCapability]] to capability.
+ 8. Let result be InnerModuleEvaluation(module, stack, 0).
+ 9. If result is an abrupt completion, then
+ ...
+ d. Perform ! Call(capability.[[Reject]], undefined, «result.[[Value]]»).
+ 10. Otherwise,
+ ...
+ b. If module.[[AsyncEvaluating]] is false, then
+ i. Perform ! Call(capability.[[Resolve]], undefined, «undefined»).
+ ...
+ 11. Return undefinedcapability.[[Promise]].
+
+ InnerModuleEvaluation( module, stack, index )
+
+ ...
+ 14. If module.[[PendingAsyncDependencies]] is > 0, set module.[[AsyncEvaluating]] to true.
+ 15. Otherwise, if module.[[Async]] is true, perform ! ExecuteAsyncModule(module).
+ 16. Otherwise, perform ? module.ExecuteModule().
+
+ ExecuteAsyncModule ( module )
+
+ 1. Assert: module.[[Status]] is "evaluating" or "evaluated".
+ 2. Assert: module.[[Async]] is true.
+ 3. Set module.[[AsyncEvaluating]] to true.
+ 4. Let capability be ! NewPromiseCapability(%Promise%).
+ 5. Let stepsFulfilled be the steps of a CallAsyncModuleFulfilled function as specified below.
+ ...
+ 8. Let stepsRejected be the steps of a CallAsyncModuleRejected function as specified below.
+ ...
+ 11. Perform ! PerformPromiseThen(capability.[[Promise]], onFulfilled, onRejected).
+ 12. Perform ! module.ExecuteModule(capability).
+ 13. Return.
+
+ ExecuteModule ( [ capability ] )
+
+ ...
+ 11. If module.[[Async]] is false, then
+ a. Assert: capability was not provided.
+ b. Push moduleCxt on to the execution context stack; moduleCxt is now the running execution context.
+ c. Let result be the result of evaluating module.[[ECMAScriptCode]].
+ d. Suspend moduleCxt and remove it from the execution context stack.
+ e. Resume the context that is now on the top of the execution context stack as the running execution context.
+ f. Return Completion(result).
+ 12. Otherwise,
+ a. Assert: capability is a PromiseCapability Record.
+ b. Perform ! AsyncBlockStart(capability, module.[[ECMAScriptCode]], moduleCxt).
+ c. Return.
+flags: [module]
+features: [top-level-await]
+negative:
+ phase: runtime
+ type: TypeError
+---*/
+
+import foo from './module-import-rejection-body_FIXTURE.js';
+
+throw new Test262Error('this should be unreachable');
diff --git a/js/src/tests/test262/language/module-code/top-level-await/module-import-rejection-body_FIXTURE.js b/js/src/tests/test262/language/module-code/top-level-await/module-import-rejection-body_FIXTURE.js
new file mode 100644
index 0000000000..8d8173db71
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/module-import-rejection-body_FIXTURE.js
@@ -0,0 +1,10 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export default 42;
+
+export const named = 'named';
+
+var rejection = Promise.reject(new TypeError('I reject this!'));
+await rejection;
diff --git a/js/src/tests/test262/language/module-code/top-level-await/module-import-rejection-tick.js b/js/src/tests/test262/language/module-code/top-level-await/module-import-rejection-tick.js
new file mode 100644
index 0000000000..c1b14d205f
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/module-import-rejection-tick.js
@@ -0,0 +1,77 @@
+// |reftest| error:RangeError module
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-moduleevaluation
+description: >
+ Evaluate imported rejected module
+info: |
+ Table 3: Additional Fields of Cyclic Module Records
+
+ [[Async]]
+
+ ...
+ Having an asynchronous dependency does not make the module asynchronous. This field must not change after the module is parsed.
+
+ Evaluate ( ) Concrete Method
+
+ ...
+ 6. Let capability be ! NewPromiseCapability(%Promise%).
+ 7. Set module.[[TopLevelCapability]] to capability.
+ 8. Let result be InnerModuleEvaluation(module, stack, 0).
+ 9. If result is an abrupt completion, then
+ ...
+ d. Perform ! Call(capability.[[Reject]], undefined, «result.[[Value]]»).
+ 10. Otherwise,
+ ...
+ b. If module.[[AsyncEvaluating]] is false, then
+ i. Perform ! Call(capability.[[Resolve]], undefined, «undefined»).
+ ...
+ 11. Return undefinedcapability.[[Promise]].
+
+ InnerModuleEvaluation( module, stack, index )
+
+ ...
+ 14. If module.[[PendingAsyncDependencies]] is > 0, set module.[[AsyncEvaluating]] to true.
+ 15. Otherwise, if module.[[Async]] is true, perform ! ExecuteAsyncModule(module).
+ 16. Otherwise, perform ? module.ExecuteModule().
+
+ ExecuteAsyncModule ( module )
+
+ 1. Assert: module.[[Status]] is "evaluating" or "evaluated".
+ 2. Assert: module.[[Async]] is true.
+ 3. Set module.[[AsyncEvaluating]] to true.
+ 4. Let capability be ! NewPromiseCapability(%Promise%).
+ 5. Let stepsFulfilled be the steps of a CallAsyncModuleFulfilled function as specified below.
+ ...
+ 8. Let stepsRejected be the steps of a CallAsyncModuleRejected function as specified below.
+ ...
+ 11. Perform ! PerformPromiseThen(capability.[[Promise]], onFulfilled, onRejected).
+ 12. Perform ! module.ExecuteModule(capability).
+ 13. Return.
+
+ ExecuteModule ( [ capability ] )
+
+ ...
+ 11. If module.[[Async]] is false, then
+ a. Assert: capability was not provided.
+ b. Push moduleCxt on to the execution context stack; moduleCxt is now the running execution context.
+ c. Let result be the result of evaluating module.[[ECMAScriptCode]].
+ d. Suspend moduleCxt and remove it from the execution context stack.
+ e. Resume the context that is now on the top of the execution context stack as the running execution context.
+ f. Return Completion(result).
+ 12. Otherwise,
+ a. Assert: capability is a PromiseCapability Record.
+ b. Perform ! AsyncBlockStart(capability, module.[[ECMAScriptCode]], moduleCxt).
+ c. Return.
+flags: [module]
+features: [top-level-await]
+negative:
+ phase: runtime
+ type: RangeError
+---*/
+
+import foo from './module-import-rejection-tick_FIXTURE.js';
+
+throw new Test262Error('this should be unreachable');
diff --git a/js/src/tests/test262/language/module-code/top-level-await/module-import-rejection-tick_FIXTURE.js b/js/src/tests/test262/language/module-code/top-level-await/module-import-rejection-tick_FIXTURE.js
new file mode 100644
index 0000000000..4fedc13aa4
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/module-import-rejection-tick_FIXTURE.js
@@ -0,0 +1,13 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export default 42;
+
+await Promise.resolve().then(() => {
+ // This rejection will tick first unwrapping all the promises first
+ return Promise.reject(new RangeError());
+});
+
+var rejection = Promise.reject(new TypeError());
+await rejection;
diff --git a/js/src/tests/test262/language/module-code/top-level-await/module-import-rejection.js b/js/src/tests/test262/language/module-code/top-level-await/module-import-rejection.js
new file mode 100644
index 0000000000..4d178150f5
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/module-import-rejection.js
@@ -0,0 +1,77 @@
+// |reftest| error:TypeError module
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-moduleevaluation
+description: >
+ Evaluate imported rejected module
+info: |
+ Table 3: Additional Fields of Cyclic Module Records
+
+ [[Async]]
+
+ ...
+ Having an asynchronous dependency does not make the module asynchronous. This field must not change after the module is parsed.
+
+ Evaluate ( ) Concrete Method
+
+ ...
+ 6. Let capability be ! NewPromiseCapability(%Promise%).
+ 7. Set module.[[TopLevelCapability]] to capability.
+ 8. Let result be InnerModuleEvaluation(module, stack, 0).
+ 9. If result is an abrupt completion, then
+ ...
+ d. Perform ! Call(capability.[[Reject]], undefined, «result.[[Value]]»).
+ 10. Otherwise,
+ ...
+ b. If module.[[AsyncEvaluating]] is false, then
+ i. Perform ! Call(capability.[[Resolve]], undefined, «undefined»).
+ ...
+ 11. Return undefinedcapability.[[Promise]].
+
+ InnerModuleEvaluation( module, stack, index )
+
+ ...
+ 14. If module.[[PendingAsyncDependencies]] is > 0, set module.[[AsyncEvaluating]] to true.
+ 15. Otherwise, if module.[[Async]] is true, perform ! ExecuteAsyncModule(module).
+ 16. Otherwise, perform ? module.ExecuteModule().
+
+ ExecuteAsyncModule ( module )
+
+ 1. Assert: module.[[Status]] is "evaluating" or "evaluated".
+ 2. Assert: module.[[Async]] is true.
+ 3. Set module.[[AsyncEvaluating]] to true.
+ 4. Let capability be ! NewPromiseCapability(%Promise%).
+ 5. Let stepsFulfilled be the steps of a CallAsyncModuleFulfilled function as specified below.
+ ...
+ 8. Let stepsRejected be the steps of a CallAsyncModuleRejected function as specified below.
+ ...
+ 11. Perform ! PerformPromiseThen(capability.[[Promise]], onFulfilled, onRejected).
+ 12. Perform ! module.ExecuteModule(capability).
+ 13. Return.
+
+ ExecuteModule ( [ capability ] )
+
+ ...
+ 11. If module.[[Async]] is false, then
+ a. Assert: capability was not provided.
+ b. Push moduleCxt on to the execution context stack; moduleCxt is now the running execution context.
+ c. Let result be the result of evaluating module.[[ECMAScriptCode]].
+ d. Suspend moduleCxt and remove it from the execution context stack.
+ e. Resume the context that is now on the top of the execution context stack as the running execution context.
+ f. Return Completion(result).
+ 12. Otherwise,
+ a. Assert: capability is a PromiseCapability Record.
+ b. Perform ! AsyncBlockStart(capability, module.[[ECMAScriptCode]], moduleCxt).
+ c. Return.
+flags: [module]
+features: [top-level-await]
+negative:
+ phase: runtime
+ type: TypeError
+---*/
+
+import { resolved } from './module-import-rejection_FIXTURE.js';
+
+throw new Test262Error('this should be unreachable');
diff --git a/js/src/tests/test262/language/module-code/top-level-await/module-import-rejection_FIXTURE.js b/js/src/tests/test262/language/module-code/top-level-await/module-import-rejection_FIXTURE.js
new file mode 100644
index 0000000000..3a5d4d024e
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/module-import-rejection_FIXTURE.js
@@ -0,0 +1,12 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export const resolved = await 42;
+
+// Can't use Test262Error in this file because it's not referenced here
+export default await Promise.reject(new TypeError('error in the default export line'));
+
+// Use RangeError to differentiate from initial error
+export const x = await Promise.reject(new RangeError('named x rejection'));
+export const y = await Promise.reject(new RangeError('named y rejection'));
diff --git a/js/src/tests/test262/language/module-code/top-level-await/module-import-resolution.js b/js/src/tests/test262/language/module-code/top-level-await/module-import-resolution.js
new file mode 100644
index 0000000000..445b2ead84
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/module-import-resolution.js
@@ -0,0 +1,82 @@
+// |reftest| module async
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-moduleevaluation
+description: >
+ Evaluate imported module with async exports
+info: |
+ Table 3: Additional Fields of Cyclic Module Records
+
+ [[Async]]
+
+ ...
+ Having an asynchronous dependency does not make the module asynchronous. This field must not change after the module is parsed.
+
+ Evaluate ( ) Concrete Method
+
+ ...
+ 6. Let capability be ! NewPromiseCapability(%Promise%).
+ 7. Set module.[[TopLevelCapability]] to capability.
+ 8. Let result be InnerModuleEvaluation(module, stack, 0).
+ 9. If result is an abrupt completion, then
+ ...
+ d. Perform ! Call(capability.[[Reject]], undefined, «result.[[Value]]»).
+ 10. Otherwise,
+ ...
+ b. If module.[[AsyncEvaluating]] is false, then
+ i. Perform ! Call(capability.[[Resolve]], undefined, «undefined»).
+ ...
+ 11. Return undefinedcapability.[[Promise]].
+
+ InnerModuleEvaluation( module, stack, index )
+
+ ...
+ 14. If module.[[PendingAsyncDependencies]] is > 0, set module.[[AsyncEvaluating]] to true.
+ 15. Otherwise, if module.[[Async]] is true, perform ! ExecuteAsyncModule(module).
+ 16. Otherwise, perform ? module.ExecuteModule().
+
+ ExecuteAsyncModule ( module )
+
+ 1. Assert: module.[[Status]] is "evaluating" or "evaluated".
+ 2. Assert: module.[[Async]] is true.
+ 3. Set module.[[AsyncEvaluating]] to true.
+ 4. Let capability be ! NewPromiseCapability(%Promise%).
+ 5. Let stepsFulfilled be the steps of a CallAsyncModuleFulfilled function as specified below.
+ ...
+ 8. Let stepsRejected be the steps of a CallAsyncModuleRejected function as specified below.
+ ...
+ 11. Perform ! PerformPromiseThen(capability.[[Promise]], onFulfilled, onRejected).
+ 12. Perform ! module.ExecuteModule(capability).
+ 13. Return.
+
+ ExecuteModule ( [ capability ] )
+
+ ...
+ 11. If module.[[Async]] is false, then
+ a. Assert: capability was not provided.
+ b. Push moduleCxt on to the execution context stack; moduleCxt is now the running execution context.
+ c. Let result be the result of evaluating module.[[ECMAScriptCode]].
+ d. Suspend moduleCxt and remove it from the execution context stack.
+ e. Resume the context that is now on the top of the execution context stack as the running execution context.
+ f. Return Completion(result).
+ 12. Otherwise,
+ a. Assert: capability is a PromiseCapability Record.
+ b. Perform ! AsyncBlockStart(capability, module.[[ECMAScriptCode]], moduleCxt).
+ c. Return.
+flags: [module, async]
+features: [top-level-await]
+---*/
+
+import foo from './module-import-resolution_FIXTURE.js';
+
+assert.sameValue(foo, 42);
+
+import { x, y } from './module-import-resolution_FIXTURE.js';
+
+assert.sameValue(x, 'named');
+assert.sameValue(y, 39);
+
+// $DONE is set at the end to reflect the async operations from the imported module
+$DONE();
diff --git a/js/src/tests/test262/language/module-code/top-level-await/module-import-resolution_FIXTURE.js b/js/src/tests/test262/language/module-code/top-level-await/module-import-resolution_FIXTURE.js
new file mode 100644
index 0000000000..eeafdef3cd
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/module-import-resolution_FIXTURE.js
@@ -0,0 +1,15 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+await 1;
+await 2;
+export default await Promise.resolve(42);
+
+export const y = await 39;
+export const x = await 'named';
+
+// Bonus: this rejection is not unwrapped
+if (false) {
+ await Promise.reject(42);
+}
diff --git a/js/src/tests/test262/language/module-code/top-level-await/module-import-unwrapped.js b/js/src/tests/test262/language/module-code/top-level-await/module-import-unwrapped.js
new file mode 100644
index 0000000000..ec4ef1e6f9
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/module-import-unwrapped.js
@@ -0,0 +1,96 @@
+// |reftest| module async
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-moduleevaluation
+description: >
+ Evaluate imported module with unwrapped imported promises
+info: |
+ Table 3: Additional Fields of Cyclic Module Records
+
+ [[Async]]
+
+ ...
+ Having an asynchronous dependency does not make the module asynchronous. This field must not change after the module is parsed.
+
+ Evaluate ( ) Concrete Method
+
+ ...
+ 6. Let capability be ! NewPromiseCapability(%Promise%).
+ 7. Set module.[[TopLevelCapability]] to capability.
+ 8. Let result be InnerModuleEvaluation(module, stack, 0).
+ 9. If result is an abrupt completion, then
+ ...
+ d. Perform ! Call(capability.[[Reject]], undefined, «result.[[Value]]»).
+ 10. Otherwise,
+ ...
+ b. If module.[[AsyncEvaluating]] is false, then
+ i. Perform ! Call(capability.[[Resolve]], undefined, «undefined»).
+ ...
+ 11. Return undefinedcapability.[[Promise]].
+
+ InnerModuleEvaluation( module, stack, index )
+
+ ...
+ 14. If module.[[PendingAsyncDependencies]] is > 0, set module.[[AsyncEvaluating]] to true.
+ 15. Otherwise, if module.[[Async]] is true, perform ! ExecuteAsyncModule(module).
+ 16. Otherwise, perform ? module.ExecuteModule().
+
+ ExecuteAsyncModule ( module )
+
+ 1. Assert: module.[[Status]] is "evaluating" or "evaluated".
+ 2. Assert: module.[[Async]] is true.
+ 3. Set module.[[AsyncEvaluating]] to true.
+ 4. Let capability be ! NewPromiseCapability(%Promise%).
+ 5. Let stepsFulfilled be the steps of a CallAsyncModuleFulfilled function as specified below.
+ ...
+ 8. Let stepsRejected be the steps of a CallAsyncModuleRejected function as specified below.
+ ...
+ 11. Perform ! PerformPromiseThen(capability.[[Promise]], onFulfilled, onRejected).
+ 12. Perform ! module.ExecuteModule(capability).
+ 13. Return.
+
+ ExecuteModule ( [ capability ] )
+
+ ...
+ 11. If module.[[Async]] is false, then
+ a. Assert: capability was not provided.
+ b. Push moduleCxt on to the execution context stack; moduleCxt is now the running execution context.
+ c. Let result be the result of evaluating module.[[ECMAScriptCode]].
+ d. Suspend moduleCxt and remove it from the execution context stack.
+ e. Resume the context that is now on the top of the execution context stack as the running execution context.
+ f. Return Completion(result).
+ 12. Otherwise,
+ a. Assert: capability is a PromiseCapability Record.
+ b. Perform ! AsyncBlockStart(capability, module.[[ECMAScriptCode]], moduleCxt).
+ c. Return.
+flags: [module, async]
+features: [top-level-await]
+---*/
+
+import mod from './module-import-unwrapped_FIXTURE.js';
+import { x, y } from './module-import-unwrapped_FIXTURE.js';
+
+assert(mod instanceof Promise, 'mod is an instance of Promise');
+assert(x instanceof Promise, 'x is an instance of Promise');
+assert(y instanceof Promise, 'y is an instance of Promise');
+
+assert.sameValue(Object.getPrototypeOf(mod), Promise.prototype, 'Proto of mod');
+assert.sameValue(Object.getPrototypeOf(x), Promise.prototype, 'Proto of x');
+assert.sameValue(Object.getPrototypeOf(y), Promise.prototype, 'Proto of y');
+
+assert.sameValue(await mod, 'default');
+assert.sameValue(await y, 'unwrapped resolution');
+
+var err;
+try {
+ await x;
+} catch (e) {
+ err = e;
+}
+
+assert.sameValue(err, 'unwrapped rejection');
+
+// $DONE is set at the end to reflect the async operations from the imported module
+$DONE();
diff --git a/js/src/tests/test262/language/module-code/top-level-await/module-import-unwrapped_FIXTURE.js b/js/src/tests/test262/language/module-code/top-level-await/module-import-unwrapped_FIXTURE.js
new file mode 100644
index 0000000000..51417c7c5a
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/module-import-unwrapped_FIXTURE.js
@@ -0,0 +1,10 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+await 1;
+
+export default Promise.resolve('default');
+
+export const x = Promise.reject('unwrapped rejection');
+export const y = Promise.resolve('unwrapped resolution');
diff --git a/js/src/tests/test262/language/module-code/top-level-await/module-self-import-async-resolution-ticks.js b/js/src/tests/test262/language/module-code/top-level-await/module-self-import-async-resolution-ticks.js
new file mode 100644
index 0000000000..78dc4fff05
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/module-self-import-async-resolution-ticks.js
@@ -0,0 +1,89 @@
+// |reftest| module async
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-moduleevaluation
+description: >
+ Ticks from async module (w/ TLA) self importing
+info: |
+ Table 3: Additional Fields of Cyclic Module Records
+
+ [[Async]]
+
+ ...
+ Having an asynchronous dependency does not make the module asynchronous. This field must not change after the module is parsed.
+
+ Evaluate ( ) Concrete Method
+
+ ...
+ 6. Let capability be ! NewPromiseCapability(%Promise%).
+ 7. Set module.[[TopLevelCapability]] to capability.
+ 8. Let result be InnerModuleEvaluation(module, stack, 0).
+ 9. If result is an abrupt completion, then
+ ...
+ d. Perform ! Call(capability.[[Reject]], undefined, «result.[[Value]]»).
+ 10. Otherwise,
+ ...
+ b. If module.[[AsyncEvaluating]] is false, then
+ i. Perform ! Call(capability.[[Resolve]], undefined, «undefined»).
+ ...
+ 11. Return undefinedcapability.[[Promise]].
+
+ InnerModuleEvaluation( module, stack, index )
+
+ ...
+ 14. If module.[[PendingAsyncDependencies]] is > 0, set module.[[AsyncEvaluating]] to true.
+ 15. Otherwise, if module.[[Async]] is true, perform ! ExecuteAsyncModule(module).
+ 16. Otherwise, perform ? module.ExecuteModule().
+
+ ExecuteAsyncModule ( module )
+
+ 1. Assert: module.[[Status]] is "evaluating" or "evaluated".
+ 2. Assert: module.[[Async]] is true.
+ 3. Set module.[[AsyncEvaluating]] to true.
+ 4. Let capability be ! NewPromiseCapability(%Promise%).
+ 5. Let stepsFulfilled be the steps of a CallAsyncModuleFulfilled function as specified below.
+ ...
+ 8. Let stepsRejected be the steps of a CallAsyncModuleRejected function as specified below.
+ ...
+ 11. Perform ! PerformPromiseThen(capability.[[Promise]], onFulfilled, onRejected).
+ 12. Perform ! module.ExecuteModule(capability).
+ 13. Return.
+
+ ExecuteModule ( [ capability ] )
+
+ ...
+ 11. If module.[[Async]] is false, then
+ a. Assert: capability was not provided.
+ b. Push moduleCxt on to the execution context stack; moduleCxt is now the running execution context.
+ c. Let result be the result of evaluating module.[[ECMAScriptCode]].
+ d. Suspend moduleCxt and remove it from the execution context stack.
+ e. Resume the context that is now on the top of the execution context stack as the running execution context.
+ f. Return Completion(result).
+ 12. Otherwise,
+ a. Assert: capability is a PromiseCapability Record.
+ b. Perform ! AsyncBlockStart(capability, module.[[ECMAScriptCode]], moduleCxt).
+ c. Return.
+flags: [module, async]
+features: [top-level-await]
+---*/
+
+var x = 'synchronous evaluation';
+
+Promise.resolve().then(() => x = 'tick in the async evaluation');
+
+import self from './module-self-import-async-resolution-ticks.js';
+
+assert.sameValue(x, 'synchronous evaluation');
+
+assert.throws(ReferenceError, function() {
+ self;
+}, 'self is not initialized yet');
+
+export default await Promise.resolve(42);
+
+assert.sameValue(x, 'tick in the async evaluation');
+assert.sameValue(self, 42), 'self is initialized after export';
+
+$DONE();
diff --git a/js/src/tests/test262/language/module-code/top-level-await/module-sync-import-async-resolution-ticks.js b/js/src/tests/test262/language/module-code/top-level-await/module-sync-import-async-resolution-ticks.js
new file mode 100644
index 0000000000..af1d9e5506
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/module-sync-import-async-resolution-ticks.js
@@ -0,0 +1,82 @@
+// |reftest| module async
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-moduleevaluation
+description: >
+ Ticks from sync module (no TLA) loading async module
+info: |
+ Table 3: Additional Fields of Cyclic Module Records
+
+ [[Async]]
+
+ ...
+ Having an asynchronous dependency does not make the module asynchronous. This field must not change after the module is parsed.
+
+ Evaluate ( ) Concrete Method
+
+ ...
+ 6. Let capability be ! NewPromiseCapability(%Promise%).
+ 7. Set module.[[TopLevelCapability]] to capability.
+ 8. Let result be InnerModuleEvaluation(module, stack, 0).
+ 9. If result is an abrupt completion, then
+ ...
+ d. Perform ! Call(capability.[[Reject]], undefined, «result.[[Value]]»).
+ 10. Otherwise,
+ ...
+ b. If module.[[AsyncEvaluating]] is false, then
+ i. Perform ! Call(capability.[[Resolve]], undefined, «undefined»).
+ ...
+ 11. Return undefinedcapability.[[Promise]].
+
+ InnerModuleEvaluation( module, stack, index )
+
+ ...
+ 14. If module.[[PendingAsyncDependencies]] is > 0, set module.[[AsyncEvaluating]] to true.
+ 15. Otherwise, if module.[[Async]] is true, perform ! ExecuteAsyncModule(module).
+ 16. Otherwise, perform ? module.ExecuteModule().
+
+ ExecuteAsyncModule ( module )
+
+ 1. Assert: module.[[Status]] is "evaluating" or "evaluated".
+ 2. Assert: module.[[Async]] is true.
+ 3. Set module.[[AsyncEvaluating]] to true.
+ 4. Let capability be ! NewPromiseCapability(%Promise%).
+ 5. Let stepsFulfilled be the steps of a CallAsyncModuleFulfilled function as specified below.
+ ...
+ 8. Let stepsRejected be the steps of a CallAsyncModuleRejected function as specified below.
+ ...
+ 11. Perform ! PerformPromiseThen(capability.[[Promise]], onFulfilled, onRejected).
+ 12. Perform ! module.ExecuteModule(capability).
+ 13. Return.
+
+ ExecuteModule ( [ capability ] )
+
+ ...
+ 11. If module.[[Async]] is false, then
+ a. Assert: capability was not provided.
+ b. Push moduleCxt on to the execution context stack; moduleCxt is now the running execution context.
+ c. Let result be the result of evaluating module.[[ECMAScriptCode]].
+ d. Suspend moduleCxt and remove it from the execution context stack.
+ e. Resume the context that is now on the top of the execution context stack as the running execution context.
+ f. Return Completion(result).
+ 12. Otherwise,
+ a. Assert: capability is a PromiseCapability Record.
+ b. Perform ! AsyncBlockStart(capability, module.[[ECMAScriptCode]], moduleCxt).
+ c. Return.
+flags: [module, async]
+features: [top-level-await]
+---*/
+
+var x = 'synchronous evaluation';
+
+Promise.resolve().then(() => x = 'tick in the async evaluation');
+
+import foo from './module-import-resolution_FIXTURE.js';
+assert.sameValue(foo, 42);
+assert.sameValue(x, 'synchronous evaluation');
+
+Promise.resolve().then(() => {
+ assert.sameValue(x, 'tick in the async evaluation');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/new-await-parens.js b/js/src/tests/test262/language/module-code/top-level-await/new-await-parens.js
new file mode 100644
index 0000000000..db9ddf76a8
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/new-await-parens.js
@@ -0,0 +1,20 @@
+// |reftest| module async
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: prod-AwaitExpression
+description: >
+ `new (await Constructor)` returns instance of Constructor
+flags: [module, async]
+features: [top-level-await]
+---*/
+
+assert.sameValue((new (await Number)).valueOf(), 0);
+assert.sameValue((new (await String)).valueOf(), '');
+assert.sameValue((new (await Boolean)).valueOf(), false);
+assert.sameValue((new (await Array)).length, 0);
+assert.sameValue((new (await Map)).size, 0);
+assert.sameValue((new (await Set)).size, 0);
+
+$DONE();
diff --git a/js/src/tests/test262/language/module-code/top-level-await/new-await-script-code.js b/js/src/tests/test262/language/module-code/top-level-await/new-await-script-code.js
new file mode 100644
index 0000000000..6abe09e94e
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/new-await-script-code.js
@@ -0,0 +1,15 @@
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: prod-AwaitExpression
+description: >
+ await is not a keyword in script code
+features: [top-level-await]
+---*/
+
+class await {}
+
+assert.sameValue(new await instanceof await, true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/new-await.js b/js/src/tests/test262/language/module-code/top-level-await/new-await.js
new file mode 100644
index 0000000000..456fad6c99
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/new-await.js
@@ -0,0 +1,18 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: prod-AwaitExpression
+description: >
+ await cannot immediately follow new in module code
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+features: [top-level-await]
+---*/
+
+$DONOTEVALUATE();
+
+new await;
diff --git a/js/src/tests/test262/language/module-code/top-level-await/no-operand.js b/js/src/tests/test262/language/module-code/top-level-await/no-operand.js
new file mode 100644
index 0000000000..1635c09083
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/no-operand.js
@@ -0,0 +1,18 @@
+// |reftest| error:SyntaxError module
+// Copyright 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: prod-AwaitExpression
+description: >
+ await requries an operand.
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+features: [top-level-await]
+---*/
+
+$DONOTEVALUATE();
+
+await;
diff --git a/js/src/tests/test262/language/module-code/top-level-await/shell.js b/js/src/tests/test262/language/module-code/top-level-await/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/shell.js
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/await-expr-dyn-import.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/await-expr-dyn-import.js
new file mode 100644
index 0000000000..205e568b68
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/await-expr-dyn-import.js
@@ -0,0 +1,44 @@
+// |reftest| module
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Valid syntax for top level await.
+ AwaitExpression ImportCall
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ CallExpression[Yield, Await]:
+ ImportCall[?Yield, ?Await]
+
+ ImportCall[Yield, Await]:
+ import ( AssignmentExpression[+In, ?Yield, ?Await] )
+esid: prod-AwaitExpression
+flags: [module]
+features: [top-level-await, dynamic-import]
+---*/
+
+try {
+ await import('foo');
+} catch (e) {
+ // Ignore errors, we are just checking if the syntax is valid and
+ // we should not worry if a module was loaded.
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-array-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-array-literal.js
new file mode 100644
index 0000000000..9f97b36bbe
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-array-literal.js
@@ -0,0 +1,79 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-array-literal.case
+// - src/top-level-await/syntax/block.template
+/*---
+description: AwaitExpression ArrayLiteral (Valid syntax for top level await in a block.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+{
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ await [];
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-func-expression.js
new file mode 100644
index 0000000000..10ab1da5ba
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-func-expression.js
@@ -0,0 +1,85 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-func-expression.case
+// - src/top-level-await/syntax/block.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in a block.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+{
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ await function() {};
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-identifier.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-identifier.js
new file mode 100644
index 0000000000..ea6697b6c5
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-identifier.js
@@ -0,0 +1,80 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-identifier.case
+// - src/top-level-await/syntax/block.template
+/*---
+description: AwaitExpression IdentifierReference (Valid syntax for top level await in a block.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+var foo = 1;
+
+
+{
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ await foo;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-literal-number.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-literal-number.js
new file mode 100644
index 0000000000..1d008abbfc
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-literal-number.js
@@ -0,0 +1,79 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-number.case
+// - src/top-level-await/syntax/block.template
+/*---
+description: AwaitExpression NumberLiteral (Valid syntax for top level await in a block.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+{
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ await 1;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-literal-string.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-literal-string.js
new file mode 100644
index 0000000000..65afc2e366
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-literal-string.js
@@ -0,0 +1,79 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-string.case
+// - src/top-level-await/syntax/block.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in a block.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+{
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ await '';
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-nested.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-nested.js
new file mode 100644
index 0000000000..6a473db1ce
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-nested.js
@@ -0,0 +1,75 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-nested.case
+// - src/top-level-await/syntax/block.template
+/*---
+description: Nested AwaitExpressions (Valid syntax for top level await in a block.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+---*/
+
+
+{
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ await await await await await await await await await await await await await await await 'await';
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-new-expr.js
new file mode 100644
index 0000000000..b0e07b01c9
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-new-expr.js
@@ -0,0 +1,76 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-new-expr.case
+// - src/top-level-await/syntax/block.template
+/*---
+description: AwaitExpression new MemberExpression (Valid syntax for top level await in a block.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+---*/
+
+
+{
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ await new Promise(function(res, rej) { res(1); });
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-null.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-null.js
new file mode 100644
index 0000000000..4dd72047fa
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-null.js
@@ -0,0 +1,79 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-null.case
+// - src/top-level-await/syntax/block.template
+/*---
+description: AwaitExpression NullLiteral (Valid syntax for top level await in a block.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+{
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ await null;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-obj-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-obj-literal.js
new file mode 100644
index 0000000000..110a42006f
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-obj-literal.js
@@ -0,0 +1,79 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-obj-literal.case
+// - src/top-level-await/syntax/block.template
+/*---
+description: AwaitExpression ObjectLiteral (Valid syntax for top level await in a block.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+{
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ await { function() {} };
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-regexp.js
new file mode 100644
index 0000000000..2fcbeb6ca3
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-regexp.js
@@ -0,0 +1,79 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-regexp.case
+// - src/top-level-await/syntax/block.template
+/*---
+description: AwaitExpression RegularExpressionLiteral (Valid syntax for top level await in a block.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+{
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ await /1/;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-template-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-template-literal.js
new file mode 100644
index 0000000000..1839ea3fe0
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-template-literal.js
@@ -0,0 +1,79 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-template-literal.case
+// - src/top-level-await/syntax/block.template
+/*---
+description: AwaitExpression TemplateLiteral (Valid syntax for top level await in a block.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+{
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ await ``;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-this.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-this.js
new file mode 100644
index 0000000000..2851e707c8
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-this.js
@@ -0,0 +1,79 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-this.case
+// - src/top-level-await/syntax/block.template
+/*---
+description: AwaitExpression this (Valid syntax for top level await in a block.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+{
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ await this;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/browser.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/browser.js
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/catch-parameter.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/catch-parameter.js
new file mode 100644
index 0000000000..855d1199d7
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/catch-parameter.js
@@ -0,0 +1,47 @@
+// |reftest| module
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Valid syntax for top level await.
+ AwaitExpression ImportCall
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ Catch[Yield, Await, Return]:
+ catch(CatchParameter[?Yield, ?Await])Block[?Yield, ?Await, ?Return]
+ catchBlock[?Yield, ?Await, ?Return]
+
+ Finally[Yield, Await, Return]:
+ finallyBlock[?Yield, ?Await, ?Return]
+
+ CatchParameter[Yield, Await]:
+ BindingIdentifier[?Yield, ?Await]
+ BindingPattern[?Yield, ?Await]
+esid: prod-AwaitExpression
+flags: [module]
+features: [top-level-await, dynamic-import]
+---*/
+
+try {} catch ({ x = await 42 }) {} // Initializer
+try {} catch ({ x: y = await 42 }) {} // BindingElement Initializer
+try {} catch ([ x = await 42 ]) {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/early-does-not-propagate-to-fn-declaration-body.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/early-does-not-propagate-to-fn-declaration-body.js
new file mode 100644
index 0000000000..70db9d1ed7
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/early-does-not-propagate-to-fn-declaration-body.js
@@ -0,0 +1,39 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ The Await capability does not propagate to the body of a function declaration
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ StatementListItem[Yield, Await, Return]:
+ Statement[?Yield, ?Await, ?Return]
+ Declaration[?Yield, ?Await]
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ HoistableDeclaration[Yield, Await, Default]:
+ FunctionDeclaration[?Yield, ?Await, ?Default]
+ GeneratorDeclaration[?Yield, ?Await, ?Default]
+ AsyncFunctionDeclaration[?Yield, ?Await, ?Default]
+ AsyncGeneratorDeclaration[?Yield, ?Await, ?Default]
+
+ FunctionDeclaration[Yield, Await, Default]:
+ function BindingIdentifier[?Yield, ?Await] ( FormalParameters[~Yield, ~Await] ) { FunctionBody[~Yield, ~Await] }
+negative:
+ phase: parse
+ type: SyntaxError
+esid: prod-ModuleItem
+flags: [module]
+features: [top-level-await]
+---*/
+
+$DONOTEVALUATE();
+
+function fn() { await 0; }
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/early-does-not-propagate-to-fn-declaration-params.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/early-does-not-propagate-to-fn-declaration-params.js
new file mode 100644
index 0000000000..ed59aabea1
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/early-does-not-propagate-to-fn-declaration-params.js
@@ -0,0 +1,41 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ The Await capability does not propagate to the parameters of a function declaration
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ StatementListItem[Yield, Await, Return]:
+ Statement[?Yield, ?Await, ?Return]
+ Declaration[?Yield, ?Await]
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ HoistableDeclaration[Yield, Await, Default]:
+ FunctionDeclaration[?Yield, ?Await, ?Default]
+ GeneratorDeclaration[?Yield, ?Await, ?Default]
+ AsyncFunctionDeclaration[?Yield, ?Await, ?Default]
+ AsyncGeneratorDeclaration[?Yield, ?Await, ?Default]
+
+ FunctionDeclaration[Yield, Await, Default]:
+ function BindingIdentifier[?Yield, ?Await] ( FormalParameters[~Yield, ~Await] ) { FunctionBody[~Yield, ~Await] }
+negative:
+ phase: parse
+ type: SyntaxError
+esid: prod-ModuleItem
+flags: [module]
+features: [top-level-await]
+---*/
+
+$DONOTEVALUATE();
+
+function fn(x = await 1) {
+ return x;
+}
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/early-does-not-propagate-to-fn-expr-body.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/early-does-not-propagate-to-fn-expr-body.js
new file mode 100644
index 0000000000..fd6d58a99f
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/early-does-not-propagate-to-fn-expr-body.js
@@ -0,0 +1,31 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ The Await capability does not propagate to the body of a function expression
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ StatementListItem[Yield, Await, Return]:
+ Statement[?Yield, ?Await, ?Return]
+ Declaration[?Yield, ?Await]
+
+ FunctionExpression:
+ function BindingIdentifier[~Yield, ~Await]_opt ( FormalParameters[~Yield, ~Await] )
+ { FunctionBody[~Yield, ~Await] }
+negative:
+ phase: parse
+ type: SyntaxError
+esid: prod-ModuleItem
+flags: [module]
+features: [top-level-await]
+---*/
+
+$DONOTEVALUATE();
+
+0, function () {
+ await 1;
+};
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/early-does-not-propagate-to-fn-expr-params.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/early-does-not-propagate-to-fn-expr-params.js
new file mode 100644
index 0000000000..a7b46e3dae
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/early-does-not-propagate-to-fn-expr-params.js
@@ -0,0 +1,31 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ The Await capability does not propagate to the parameters of a function expression
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ StatementListItem[Yield, Await, Return]:
+ Statement[?Yield, ?Await, ?Return]
+ Declaration[?Yield, ?Await]
+
+ FunctionExpression:
+ function BindingIdentifier[~Yield, ~Await]_opt ( FormalParameters[~Yield, ~Await] )
+ { FunctionBody[~Yield, ~Await] }
+negative:
+ phase: parse
+ type: SyntaxError
+esid: prod-ModuleItem
+flags: [module]
+features: [top-level-await]
+---*/
+
+$DONOTEVALUATE();
+
+0, function (x = await 1) {
+ return x;
+};
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/early-no-escaped-await.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/early-no-escaped-await.js
new file mode 100644
index 0000000000..b9a733198b
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/early-no-escaped-await.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ The await keyword can't be escaped
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+negative:
+ phase: parse
+ type: SyntaxError
+esid: prod-ModuleItem
+flags: [module]
+features: [top-level-await]
+---*/
+
+$DONOTEVALUATE();
+
+\u0061wait 0;
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-array-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-array-literal.js
new file mode 100644
index 0000000000..0887badb54
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-array-literal.js
@@ -0,0 +1,71 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-array-literal.case
+// - src/top-level-await/syntax/export-class-decl.template
+/*---
+description: AwaitExpression ArrayLiteral (Valid syntax for top level await in export ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export class C extends fn(await []) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-func-expression.js
new file mode 100644
index 0000000000..d537ffeea1
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-func-expression.js
@@ -0,0 +1,77 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-func-expression.case
+// - src/top-level-await/syntax/export-class-decl.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in export ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export class C extends fn(await function() {}) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-identifier.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-identifier.js
new file mode 100644
index 0000000000..3d589f977f
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-identifier.js
@@ -0,0 +1,72 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-identifier.case
+// - src/top-level-await/syntax/export-class-decl.template
+/*---
+description: AwaitExpression IdentifierReference (Valid syntax for top level await in export ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+var foo = 1;
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export class C extends fn(await foo) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-literal-number.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-literal-number.js
new file mode 100644
index 0000000000..1649f423cc
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-literal-number.js
@@ -0,0 +1,71 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-number.case
+// - src/top-level-await/syntax/export-class-decl.template
+/*---
+description: AwaitExpression NumberLiteral (Valid syntax for top level await in export ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export class C extends fn(await 1) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-literal-string.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-literal-string.js
new file mode 100644
index 0000000000..bce09cf412
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-literal-string.js
@@ -0,0 +1,71 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-string.case
+// - src/top-level-await/syntax/export-class-decl.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in export ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export class C extends fn(await '') {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-nested.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-nested.js
new file mode 100644
index 0000000000..3ee6da673e
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-nested.js
@@ -0,0 +1,67 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-nested.case
+// - src/top-level-await/syntax/export-class-decl.template
+/*---
+description: Nested AwaitExpressions (Valid syntax for top level await in export ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export class C extends fn(await await await await await await await await await await await await await await await 'await') {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-new-expr.js
new file mode 100644
index 0000000000..4e35f88d38
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-new-expr.js
@@ -0,0 +1,68 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-new-expr.case
+// - src/top-level-await/syntax/export-class-decl.template
+/*---
+description: AwaitExpression new MemberExpression (Valid syntax for top level await in export ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export class C extends fn(await new Promise(function(res, rej) { res(1); })) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-null.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-null.js
new file mode 100644
index 0000000000..928afce300
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-null.js
@@ -0,0 +1,71 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-null.case
+// - src/top-level-await/syntax/export-class-decl.template
+/*---
+description: AwaitExpression NullLiteral (Valid syntax for top level await in export ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export class C extends fn(await null) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-obj-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-obj-literal.js
new file mode 100644
index 0000000000..90b2ccc6f6
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-obj-literal.js
@@ -0,0 +1,71 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-obj-literal.case
+// - src/top-level-await/syntax/export-class-decl.template
+/*---
+description: AwaitExpression ObjectLiteral (Valid syntax for top level await in export ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export class C extends fn(await { function() {} }) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-regexp.js
new file mode 100644
index 0000000000..af0466bdbc
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-regexp.js
@@ -0,0 +1,71 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-regexp.case
+// - src/top-level-await/syntax/export-class-decl.template
+/*---
+description: AwaitExpression RegularExpressionLiteral (Valid syntax for top level await in export ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export class C extends fn(await /1/) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-template-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-template-literal.js
new file mode 100644
index 0000000000..7b088080fc
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-template-literal.js
@@ -0,0 +1,71 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-template-literal.case
+// - src/top-level-await/syntax/export-class-decl.template
+/*---
+description: AwaitExpression TemplateLiteral (Valid syntax for top level await in export ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export class C extends fn(await ``) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-this.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-this.js
new file mode 100644
index 0000000000..f7608382a9
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-this.js
@@ -0,0 +1,71 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-this.case
+// - src/top-level-await/syntax/export-class-decl.template
+/*---
+description: AwaitExpression this (Valid syntax for top level await in export ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export class C extends fn(await this) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-array-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-array-literal.js
new file mode 100644
index 0000000000..98a8debc1b
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-array-literal.js
@@ -0,0 +1,67 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-array-literal.case
+// - src/top-level-await/syntax/export-dflt-assign-expr.template
+/*---
+description: AwaitExpression ArrayLiteral (Valid syntax for top level await in export default AssignmentExpression)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default [lookahead ∉ { function, async [no LineTerminator here] function, class }] AssignmentExpression [+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export default await [];
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-func-expression.js
new file mode 100644
index 0000000000..ae0939f26d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-func-expression.js
@@ -0,0 +1,73 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-func-expression.case
+// - src/top-level-await/syntax/export-dflt-assign-expr.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in export default AssignmentExpression)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default [lookahead ∉ { function, async [no LineTerminator here] function, class }] AssignmentExpression [+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export default await function() {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-identifier.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-identifier.js
new file mode 100644
index 0000000000..2bbd3c5896
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-identifier.js
@@ -0,0 +1,68 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-identifier.case
+// - src/top-level-await/syntax/export-dflt-assign-expr.template
+/*---
+description: AwaitExpression IdentifierReference (Valid syntax for top level await in export default AssignmentExpression)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default [lookahead ∉ { function, async [no LineTerminator here] function, class }] AssignmentExpression [+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+var foo = 1;
+
+
+export default await foo;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-literal-number.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-literal-number.js
new file mode 100644
index 0000000000..ab222ff08b
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-literal-number.js
@@ -0,0 +1,67 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-number.case
+// - src/top-level-await/syntax/export-dflt-assign-expr.template
+/*---
+description: AwaitExpression NumberLiteral (Valid syntax for top level await in export default AssignmentExpression)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default [lookahead ∉ { function, async [no LineTerminator here] function, class }] AssignmentExpression [+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export default await 1;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-literal-string.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-literal-string.js
new file mode 100644
index 0000000000..3fdbd1af01
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-literal-string.js
@@ -0,0 +1,67 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-string.case
+// - src/top-level-await/syntax/export-dflt-assign-expr.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in export default AssignmentExpression)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default [lookahead ∉ { function, async [no LineTerminator here] function, class }] AssignmentExpression [+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export default await '';
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-nested.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-nested.js
new file mode 100644
index 0000000000..c1153bd3f6
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-nested.js
@@ -0,0 +1,63 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-nested.case
+// - src/top-level-await/syntax/export-dflt-assign-expr.template
+/*---
+description: Nested AwaitExpressions (Valid syntax for top level await in export default AssignmentExpression)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default [lookahead ∉ { function, async [no LineTerminator here] function, class }] AssignmentExpression [+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+---*/
+
+
+export default await await await await await await await await await await await await await await await 'await';
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-new-expr.js
new file mode 100644
index 0000000000..8615527fd0
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-new-expr.js
@@ -0,0 +1,64 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-new-expr.case
+// - src/top-level-await/syntax/export-dflt-assign-expr.template
+/*---
+description: AwaitExpression new MemberExpression (Valid syntax for top level await in export default AssignmentExpression)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default [lookahead ∉ { function, async [no LineTerminator here] function, class }] AssignmentExpression [+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+---*/
+
+
+export default await new Promise(function(res, rej) { res(1); });
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-null.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-null.js
new file mode 100644
index 0000000000..bcbb845782
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-null.js
@@ -0,0 +1,67 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-null.case
+// - src/top-level-await/syntax/export-dflt-assign-expr.template
+/*---
+description: AwaitExpression NullLiteral (Valid syntax for top level await in export default AssignmentExpression)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default [lookahead ∉ { function, async [no LineTerminator here] function, class }] AssignmentExpression [+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export default await null;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-obj-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-obj-literal.js
new file mode 100644
index 0000000000..1095d8591f
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-obj-literal.js
@@ -0,0 +1,67 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-obj-literal.case
+// - src/top-level-await/syntax/export-dflt-assign-expr.template
+/*---
+description: AwaitExpression ObjectLiteral (Valid syntax for top level await in export default AssignmentExpression)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default [lookahead ∉ { function, async [no LineTerminator here] function, class }] AssignmentExpression [+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export default await { function() {} };
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-regexp.js
new file mode 100644
index 0000000000..3a1c490565
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-regexp.js
@@ -0,0 +1,67 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-regexp.case
+// - src/top-level-await/syntax/export-dflt-assign-expr.template
+/*---
+description: AwaitExpression RegularExpressionLiteral (Valid syntax for top level await in export default AssignmentExpression)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default [lookahead ∉ { function, async [no LineTerminator here] function, class }] AssignmentExpression [+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export default await /1/;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-template-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-template-literal.js
new file mode 100644
index 0000000000..dbd25378cb
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-template-literal.js
@@ -0,0 +1,67 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-template-literal.case
+// - src/top-level-await/syntax/export-dflt-assign-expr.template
+/*---
+description: AwaitExpression TemplateLiteral (Valid syntax for top level await in export default AssignmentExpression)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default [lookahead ∉ { function, async [no LineTerminator here] function, class }] AssignmentExpression [+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export default await ``;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-this.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-this.js
new file mode 100644
index 0000000000..6213f8352c
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-this.js
@@ -0,0 +1,67 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-this.case
+// - src/top-level-await/syntax/export-dflt-assign-expr.template
+/*---
+description: AwaitExpression this (Valid syntax for top level await in export default AssignmentExpression)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default [lookahead ∉ { function, async [no LineTerminator here] function, class }] AssignmentExpression [+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export default await this;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-array-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-array-literal.js
new file mode 100644
index 0000000000..f96d40f644
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-array-literal.js
@@ -0,0 +1,71 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-array-literal.case
+// - src/top-level-await/syntax/export-dflt-class-decl.template
+/*---
+description: AwaitExpression ArrayLiteral (Valid syntax for top level await in export default ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export default class extends fn(await []) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-func-expression.js
new file mode 100644
index 0000000000..7fa06f4c42
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-func-expression.js
@@ -0,0 +1,77 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-func-expression.case
+// - src/top-level-await/syntax/export-dflt-class-decl.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in export default ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export default class extends fn(await function() {}) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-identifier.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-identifier.js
new file mode 100644
index 0000000000..0c6291a762
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-identifier.js
@@ -0,0 +1,72 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-identifier.case
+// - src/top-level-await/syntax/export-dflt-class-decl.template
+/*---
+description: AwaitExpression IdentifierReference (Valid syntax for top level await in export default ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+var foo = 1;
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export default class extends fn(await foo) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-literal-number.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-literal-number.js
new file mode 100644
index 0000000000..e44240b3f5
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-literal-number.js
@@ -0,0 +1,71 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-number.case
+// - src/top-level-await/syntax/export-dflt-class-decl.template
+/*---
+description: AwaitExpression NumberLiteral (Valid syntax for top level await in export default ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export default class extends fn(await 1) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-literal-string.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-literal-string.js
new file mode 100644
index 0000000000..47c0ed7119
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-literal-string.js
@@ -0,0 +1,71 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-string.case
+// - src/top-level-await/syntax/export-dflt-class-decl.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in export default ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export default class extends fn(await '') {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-nested.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-nested.js
new file mode 100644
index 0000000000..9177084508
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-nested.js
@@ -0,0 +1,67 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-nested.case
+// - src/top-level-await/syntax/export-dflt-class-decl.template
+/*---
+description: Nested AwaitExpressions (Valid syntax for top level await in export default ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export default class extends fn(await await await await await await await await await await await await await await await 'await') {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-new-expr.js
new file mode 100644
index 0000000000..b1c185140f
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-new-expr.js
@@ -0,0 +1,68 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-new-expr.case
+// - src/top-level-await/syntax/export-dflt-class-decl.template
+/*---
+description: AwaitExpression new MemberExpression (Valid syntax for top level await in export default ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export default class extends fn(await new Promise(function(res, rej) { res(1); })) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-null.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-null.js
new file mode 100644
index 0000000000..1238b239ae
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-null.js
@@ -0,0 +1,71 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-null.case
+// - src/top-level-await/syntax/export-dflt-class-decl.template
+/*---
+description: AwaitExpression NullLiteral (Valid syntax for top level await in export default ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export default class extends fn(await null) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-obj-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-obj-literal.js
new file mode 100644
index 0000000000..a150838ec3
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-obj-literal.js
@@ -0,0 +1,71 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-obj-literal.case
+// - src/top-level-await/syntax/export-dflt-class-decl.template
+/*---
+description: AwaitExpression ObjectLiteral (Valid syntax for top level await in export default ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export default class extends fn(await { function() {} }) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-regexp.js
new file mode 100644
index 0000000000..e55bf5eb1a
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-regexp.js
@@ -0,0 +1,71 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-regexp.case
+// - src/top-level-await/syntax/export-dflt-class-decl.template
+/*---
+description: AwaitExpression RegularExpressionLiteral (Valid syntax for top level await in export default ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export default class extends fn(await /1/) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-template-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-template-literal.js
new file mode 100644
index 0000000000..b5e2fdc2bf
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-template-literal.js
@@ -0,0 +1,71 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-template-literal.case
+// - src/top-level-await/syntax/export-dflt-class-decl.template
+/*---
+description: AwaitExpression TemplateLiteral (Valid syntax for top level await in export default ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export default class extends fn(await ``) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-this.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-this.js
new file mode 100644
index 0000000000..48bad9a85b
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-this.js
@@ -0,0 +1,71 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-this.case
+// - src/top-level-await/syntax/export-dflt-class-decl.template
+/*---
+description: AwaitExpression this (Valid syntax for top level await in export default ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export default class extends fn(await this) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-array-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-array-literal.js
new file mode 100644
index 0000000000..c40d5836a9
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-array-literal.js
@@ -0,0 +1,64 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-array-literal.case
+// - src/top-level-await/syntax/export-lex-declaration.template
+/*---
+description: AwaitExpression ArrayLiteral (Valid syntax for top level await in export LexicalDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ LexicalDeclaration[In, Yield, Await]:
+ LetOrConstBindingList[?In, ?Yield, ?Await];
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export let x = await [];
+export const y = await [];
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-func-expression.js
new file mode 100644
index 0000000000..0840230395
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-func-expression.js
@@ -0,0 +1,70 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-func-expression.case
+// - src/top-level-await/syntax/export-lex-declaration.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in export LexicalDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ LexicalDeclaration[In, Yield, Await]:
+ LetOrConstBindingList[?In, ?Yield, ?Await];
+
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export let x = await function() {};
+export const y = await function() {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-identifier.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-identifier.js
new file mode 100644
index 0000000000..f0a13b6a02
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-identifier.js
@@ -0,0 +1,65 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-identifier.case
+// - src/top-level-await/syntax/export-lex-declaration.template
+/*---
+description: AwaitExpression IdentifierReference (Valid syntax for top level await in export LexicalDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ LexicalDeclaration[In, Yield, Await]:
+ LetOrConstBindingList[?In, ?Yield, ?Await];
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+var foo = 1;
+
+
+export let x = await foo;
+export const y = await foo;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-literal-number.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-literal-number.js
new file mode 100644
index 0000000000..3f2bc85b30
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-literal-number.js
@@ -0,0 +1,64 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-number.case
+// - src/top-level-await/syntax/export-lex-declaration.template
+/*---
+description: AwaitExpression NumberLiteral (Valid syntax for top level await in export LexicalDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ LexicalDeclaration[In, Yield, Await]:
+ LetOrConstBindingList[?In, ?Yield, ?Await];
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export let x = await 1;
+export const y = await 1;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-literal-string.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-literal-string.js
new file mode 100644
index 0000000000..ad68d4fef4
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-literal-string.js
@@ -0,0 +1,64 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-string.case
+// - src/top-level-await/syntax/export-lex-declaration.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in export LexicalDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ LexicalDeclaration[In, Yield, Await]:
+ LetOrConstBindingList[?In, ?Yield, ?Await];
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export let x = await '';
+export const y = await '';
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-nested.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-nested.js
new file mode 100644
index 0000000000..40cef7606e
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-nested.js
@@ -0,0 +1,60 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-nested.case
+// - src/top-level-await/syntax/export-lex-declaration.template
+/*---
+description: Nested AwaitExpressions (Valid syntax for top level await in export LexicalDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ LexicalDeclaration[In, Yield, Await]:
+ LetOrConstBindingList[?In, ?Yield, ?Await];
+
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+---*/
+
+
+export let x = await await await await await await await await await await await await await await await 'await';
+export const y = await await await await await await await await await await await await await await await 'await';
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-new-expr.js
new file mode 100644
index 0000000000..8e541d3ecd
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-new-expr.js
@@ -0,0 +1,61 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-new-expr.case
+// - src/top-level-await/syntax/export-lex-declaration.template
+/*---
+description: AwaitExpression new MemberExpression (Valid syntax for top level await in export LexicalDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ LexicalDeclaration[In, Yield, Await]:
+ LetOrConstBindingList[?In, ?Yield, ?Await];
+
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+---*/
+
+
+export let x = await new Promise(function(res, rej) { res(1); });
+export const y = await new Promise(function(res, rej) { res(1); });
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-null.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-null.js
new file mode 100644
index 0000000000..d3f2721cf6
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-null.js
@@ -0,0 +1,64 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-null.case
+// - src/top-level-await/syntax/export-lex-declaration.template
+/*---
+description: AwaitExpression NullLiteral (Valid syntax for top level await in export LexicalDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ LexicalDeclaration[In, Yield, Await]:
+ LetOrConstBindingList[?In, ?Yield, ?Await];
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export let x = await null;
+export const y = await null;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-obj-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-obj-literal.js
new file mode 100644
index 0000000000..85f992cb82
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-obj-literal.js
@@ -0,0 +1,64 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-obj-literal.case
+// - src/top-level-await/syntax/export-lex-declaration.template
+/*---
+description: AwaitExpression ObjectLiteral (Valid syntax for top level await in export LexicalDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ LexicalDeclaration[In, Yield, Await]:
+ LetOrConstBindingList[?In, ?Yield, ?Await];
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export let x = await { function() {} };
+export const y = await { function() {} };
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-regexp.js
new file mode 100644
index 0000000000..bfa7acd2f9
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-regexp.js
@@ -0,0 +1,64 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-regexp.case
+// - src/top-level-await/syntax/export-lex-declaration.template
+/*---
+description: AwaitExpression RegularExpressionLiteral (Valid syntax for top level await in export LexicalDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ LexicalDeclaration[In, Yield, Await]:
+ LetOrConstBindingList[?In, ?Yield, ?Await];
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export let x = await /1/;
+export const y = await /1/;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-template-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-template-literal.js
new file mode 100644
index 0000000000..9f0e217c10
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-template-literal.js
@@ -0,0 +1,64 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-template-literal.case
+// - src/top-level-await/syntax/export-lex-declaration.template
+/*---
+description: AwaitExpression TemplateLiteral (Valid syntax for top level await in export LexicalDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ LexicalDeclaration[In, Yield, Await]:
+ LetOrConstBindingList[?In, ?Yield, ?Await];
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export let x = await ``;
+export const y = await ``;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-this.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-this.js
new file mode 100644
index 0000000000..b0da185029
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-this.js
@@ -0,0 +1,64 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-this.case
+// - src/top-level-await/syntax/export-lex-declaration.template
+/*---
+description: AwaitExpression this (Valid syntax for top level await in export LexicalDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ LexicalDeclaration[In, Yield, Await]:
+ LetOrConstBindingList[?In, ?Yield, ?Await];
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export let x = await this;
+export const y = await this;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-array-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-array-literal.js
new file mode 100644
index 0000000000..ced0f70e5f
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-array-literal.js
@@ -0,0 +1,67 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-array-literal.case
+// - src/top-level-await/syntax/export-var-init.template
+/*---
+description: AwaitExpression ArrayLiteral (Valid syntax for top level await in export var BindingIdentifier Await_initializer)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ VariableStatement[Yield, Await]:
+ var VariableDeclarationList[+In, ?Yield, ?Await];
+
+ VariableDeclarationList[In, Yield, Await]:
+ VariableDeclaration[?In, ?Yield, ?Await]
+ VariableDeclarationList[?In, ?Yield, ?Await] , VariableDeclaration[?In, ?Yield, ?Await]
+
+ VariableDeclaration[In, Yield, Await]:
+ BindingIdentifier[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]opt
+ BindingPattern[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export var name1 = await [];
+export var { x = await [] } = {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-func-expression.js
new file mode 100644
index 0000000000..571b357815
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-func-expression.js
@@ -0,0 +1,73 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-func-expression.case
+// - src/top-level-await/syntax/export-var-init.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in export var BindingIdentifier Await_initializer)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ VariableStatement[Yield, Await]:
+ var VariableDeclarationList[+In, ?Yield, ?Await];
+
+ VariableDeclarationList[In, Yield, Await]:
+ VariableDeclaration[?In, ?Yield, ?Await]
+ VariableDeclarationList[?In, ?Yield, ?Await] , VariableDeclaration[?In, ?Yield, ?Await]
+
+ VariableDeclaration[In, Yield, Await]:
+ BindingIdentifier[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]opt
+ BindingPattern[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]
+
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export var name1 = await function() {};
+export var { x = await function() {} } = {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-identifier.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-identifier.js
new file mode 100644
index 0000000000..98c5c87f43
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-identifier.js
@@ -0,0 +1,68 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-identifier.case
+// - src/top-level-await/syntax/export-var-init.template
+/*---
+description: AwaitExpression IdentifierReference (Valid syntax for top level await in export var BindingIdentifier Await_initializer)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ VariableStatement[Yield, Await]:
+ var VariableDeclarationList[+In, ?Yield, ?Await];
+
+ VariableDeclarationList[In, Yield, Await]:
+ VariableDeclaration[?In, ?Yield, ?Await]
+ VariableDeclarationList[?In, ?Yield, ?Await] , VariableDeclaration[?In, ?Yield, ?Await]
+
+ VariableDeclaration[In, Yield, Await]:
+ BindingIdentifier[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]opt
+ BindingPattern[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+var foo = 1;
+
+
+export var name1 = await foo;
+export var { x = await foo } = {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-literal-number.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-literal-number.js
new file mode 100644
index 0000000000..2e8a4d28f1
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-literal-number.js
@@ -0,0 +1,67 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-number.case
+// - src/top-level-await/syntax/export-var-init.template
+/*---
+description: AwaitExpression NumberLiteral (Valid syntax for top level await in export var BindingIdentifier Await_initializer)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ VariableStatement[Yield, Await]:
+ var VariableDeclarationList[+In, ?Yield, ?Await];
+
+ VariableDeclarationList[In, Yield, Await]:
+ VariableDeclaration[?In, ?Yield, ?Await]
+ VariableDeclarationList[?In, ?Yield, ?Await] , VariableDeclaration[?In, ?Yield, ?Await]
+
+ VariableDeclaration[In, Yield, Await]:
+ BindingIdentifier[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]opt
+ BindingPattern[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export var name1 = await 1;
+export var { x = await 1 } = {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-literal-string.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-literal-string.js
new file mode 100644
index 0000000000..ae48211128
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-literal-string.js
@@ -0,0 +1,67 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-string.case
+// - src/top-level-await/syntax/export-var-init.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in export var BindingIdentifier Await_initializer)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ VariableStatement[Yield, Await]:
+ var VariableDeclarationList[+In, ?Yield, ?Await];
+
+ VariableDeclarationList[In, Yield, Await]:
+ VariableDeclaration[?In, ?Yield, ?Await]
+ VariableDeclarationList[?In, ?Yield, ?Await] , VariableDeclaration[?In, ?Yield, ?Await]
+
+ VariableDeclaration[In, Yield, Await]:
+ BindingIdentifier[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]opt
+ BindingPattern[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export var name1 = await '';
+export var { x = await '' } = {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-nested.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-nested.js
new file mode 100644
index 0000000000..144d8314c5
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-nested.js
@@ -0,0 +1,63 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-nested.case
+// - src/top-level-await/syntax/export-var-init.template
+/*---
+description: Nested AwaitExpressions (Valid syntax for top level await in export var BindingIdentifier Await_initializer)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ VariableStatement[Yield, Await]:
+ var VariableDeclarationList[+In, ?Yield, ?Await];
+
+ VariableDeclarationList[In, Yield, Await]:
+ VariableDeclaration[?In, ?Yield, ?Await]
+ VariableDeclarationList[?In, ?Yield, ?Await] , VariableDeclaration[?In, ?Yield, ?Await]
+
+ VariableDeclaration[In, Yield, Await]:
+ BindingIdentifier[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]opt
+ BindingPattern[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]
+
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+---*/
+
+
+export var name1 = await await await await await await await await await await await await await await await 'await';
+export var { x = await await await await await await await await await await await await await await await 'await' } = {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-new-expr.js
new file mode 100644
index 0000000000..25d007addb
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-new-expr.js
@@ -0,0 +1,64 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-new-expr.case
+// - src/top-level-await/syntax/export-var-init.template
+/*---
+description: AwaitExpression new MemberExpression (Valid syntax for top level await in export var BindingIdentifier Await_initializer)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ VariableStatement[Yield, Await]:
+ var VariableDeclarationList[+In, ?Yield, ?Await];
+
+ VariableDeclarationList[In, Yield, Await]:
+ VariableDeclaration[?In, ?Yield, ?Await]
+ VariableDeclarationList[?In, ?Yield, ?Await] , VariableDeclaration[?In, ?Yield, ?Await]
+
+ VariableDeclaration[In, Yield, Await]:
+ BindingIdentifier[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]opt
+ BindingPattern[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]
+
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+---*/
+
+
+export var name1 = await new Promise(function(res, rej) { res(1); });
+export var { x = await new Promise(function(res, rej) { res(1); }) } = {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-null.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-null.js
new file mode 100644
index 0000000000..5b250b9f7a
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-null.js
@@ -0,0 +1,67 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-null.case
+// - src/top-level-await/syntax/export-var-init.template
+/*---
+description: AwaitExpression NullLiteral (Valid syntax for top level await in export var BindingIdentifier Await_initializer)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ VariableStatement[Yield, Await]:
+ var VariableDeclarationList[+In, ?Yield, ?Await];
+
+ VariableDeclarationList[In, Yield, Await]:
+ VariableDeclaration[?In, ?Yield, ?Await]
+ VariableDeclarationList[?In, ?Yield, ?Await] , VariableDeclaration[?In, ?Yield, ?Await]
+
+ VariableDeclaration[In, Yield, Await]:
+ BindingIdentifier[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]opt
+ BindingPattern[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export var name1 = await null;
+export var { x = await null } = {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-obj-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-obj-literal.js
new file mode 100644
index 0000000000..7ec7d4925b
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-obj-literal.js
@@ -0,0 +1,67 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-obj-literal.case
+// - src/top-level-await/syntax/export-var-init.template
+/*---
+description: AwaitExpression ObjectLiteral (Valid syntax for top level await in export var BindingIdentifier Await_initializer)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ VariableStatement[Yield, Await]:
+ var VariableDeclarationList[+In, ?Yield, ?Await];
+
+ VariableDeclarationList[In, Yield, Await]:
+ VariableDeclaration[?In, ?Yield, ?Await]
+ VariableDeclarationList[?In, ?Yield, ?Await] , VariableDeclaration[?In, ?Yield, ?Await]
+
+ VariableDeclaration[In, Yield, Await]:
+ BindingIdentifier[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]opt
+ BindingPattern[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export var name1 = await { function() {} };
+export var { x = await { function() {} } } = {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-regexp.js
new file mode 100644
index 0000000000..6ff3d71587
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-regexp.js
@@ -0,0 +1,67 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-regexp.case
+// - src/top-level-await/syntax/export-var-init.template
+/*---
+description: AwaitExpression RegularExpressionLiteral (Valid syntax for top level await in export var BindingIdentifier Await_initializer)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ VariableStatement[Yield, Await]:
+ var VariableDeclarationList[+In, ?Yield, ?Await];
+
+ VariableDeclarationList[In, Yield, Await]:
+ VariableDeclaration[?In, ?Yield, ?Await]
+ VariableDeclarationList[?In, ?Yield, ?Await] , VariableDeclaration[?In, ?Yield, ?Await]
+
+ VariableDeclaration[In, Yield, Await]:
+ BindingIdentifier[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]opt
+ BindingPattern[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export var name1 = await /1/;
+export var { x = await /1/ } = {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-template-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-template-literal.js
new file mode 100644
index 0000000000..62a8ce6c16
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-template-literal.js
@@ -0,0 +1,67 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-template-literal.case
+// - src/top-level-await/syntax/export-var-init.template
+/*---
+description: AwaitExpression TemplateLiteral (Valid syntax for top level await in export var BindingIdentifier Await_initializer)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ VariableStatement[Yield, Await]:
+ var VariableDeclarationList[+In, ?Yield, ?Await];
+
+ VariableDeclarationList[In, Yield, Await]:
+ VariableDeclaration[?In, ?Yield, ?Await]
+ VariableDeclarationList[?In, ?Yield, ?Await] , VariableDeclaration[?In, ?Yield, ?Await]
+
+ VariableDeclaration[In, Yield, Await]:
+ BindingIdentifier[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]opt
+ BindingPattern[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export var name1 = await ``;
+export var { x = await `` } = {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-this.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-this.js
new file mode 100644
index 0000000000..3ba66281f9
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-this.js
@@ -0,0 +1,67 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-this.case
+// - src/top-level-await/syntax/export-var-init.template
+/*---
+description: AwaitExpression this (Valid syntax for top level await in export var BindingIdentifier Await_initializer)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ VariableStatement[Yield, Await]:
+ var VariableDeclarationList[+In, ?Yield, ?Await];
+
+ VariableDeclarationList[In, Yield, Await]:
+ VariableDeclaration[?In, ?Yield, ?Await]
+ VariableDeclarationList[?In, ?Yield, ?Await] , VariableDeclaration[?In, ?Yield, ?Await]
+
+ VariableDeclaration[In, Yield, Await]:
+ BindingIdentifier[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]opt
+ BindingPattern[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export var name1 = await this;
+export var { x = await this } = {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-array-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-array-literal.js
new file mode 100644
index 0000000000..4bec9be34a
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-array-literal.js
@@ -0,0 +1,70 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-array-literal.case
+// - src/top-level-await/syntax/for-await-expr.template
+/*---
+description: AwaitExpression ArrayLiteral (Valid syntax for top level await in for await statements.)
+esid: prod-AwaitExpression
+features: [top-level-await, async-iteration]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (binding of [await []]) {
+ await [];
+ break;
+}
+
+// [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (var binding of [await []]) {
+ await [];
+ break;
+}
+
+// [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (let binding of [await []]) {
+ await [];
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-func-expression.js
new file mode 100644
index 0000000000..69b81d8eb7
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-func-expression.js
@@ -0,0 +1,76 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-func-expression.case
+// - src/top-level-await/syntax/for-await-expr.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in for await statements.)
+esid: prod-AwaitExpression
+features: [top-level-await, async-iteration]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (binding of [await function() {}]) {
+ await function() {};
+ break;
+}
+
+// [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (var binding of [await function() {}]) {
+ await function() {};
+ break;
+}
+
+// [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (let binding of [await function() {}]) {
+ await function() {};
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-identifier.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-identifier.js
new file mode 100644
index 0000000000..f0e22cedb6
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-identifier.js
@@ -0,0 +1,71 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-identifier.case
+// - src/top-level-await/syntax/for-await-expr.template
+/*---
+description: AwaitExpression IdentifierReference (Valid syntax for top level await in for await statements.)
+esid: prod-AwaitExpression
+features: [top-level-await, async-iteration]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+var foo = 1;
+
+
+var binding;
+
+// [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (binding of [await foo]) {
+ await foo;
+ break;
+}
+
+// [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (var binding of [await foo]) {
+ await foo;
+ break;
+}
+
+// [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (let binding of [await foo]) {
+ await foo;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-literal-number.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-literal-number.js
new file mode 100644
index 0000000000..2939e3bfe3
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-literal-number.js
@@ -0,0 +1,70 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-number.case
+// - src/top-level-await/syntax/for-await-expr.template
+/*---
+description: AwaitExpression NumberLiteral (Valid syntax for top level await in for await statements.)
+esid: prod-AwaitExpression
+features: [top-level-await, async-iteration]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (binding of [await 1]) {
+ await 1;
+ break;
+}
+
+// [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (var binding of [await 1]) {
+ await 1;
+ break;
+}
+
+// [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (let binding of [await 1]) {
+ await 1;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-literal-string.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-literal-string.js
new file mode 100644
index 0000000000..0867b427a7
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-literal-string.js
@@ -0,0 +1,70 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-string.case
+// - src/top-level-await/syntax/for-await-expr.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in for await statements.)
+esid: prod-AwaitExpression
+features: [top-level-await, async-iteration]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (binding of [await '']) {
+ await '';
+ break;
+}
+
+// [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (var binding of [await '']) {
+ await '';
+ break;
+}
+
+// [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (let binding of [await '']) {
+ await '';
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-nested.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-nested.js
new file mode 100644
index 0000000000..e0efd8f313
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-nested.js
@@ -0,0 +1,66 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-nested.case
+// - src/top-level-await/syntax/for-await-expr.template
+/*---
+description: Nested AwaitExpressions (Valid syntax for top level await in for await statements.)
+esid: prod-AwaitExpression
+features: [top-level-await, async-iteration]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+---*/
+
+
+var binding;
+
+// [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (binding of [await await await await await await await await await await await await await await await 'await']) {
+ await await await await await await await await await await await await await await await 'await';
+ break;
+}
+
+// [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (var binding of [await await await await await await await await await await await await await await await 'await']) {
+ await await await await await await await await await await await await await await await 'await';
+ break;
+}
+
+// [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (let binding of [await await await await await await await await await await await await await await await 'await']) {
+ await await await await await await await await await await await await await await await 'await';
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-new-expr.js
new file mode 100644
index 0000000000..906ef0c09d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-new-expr.js
@@ -0,0 +1,67 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-new-expr.case
+// - src/top-level-await/syntax/for-await-expr.template
+/*---
+description: AwaitExpression new MemberExpression (Valid syntax for top level await in for await statements.)
+esid: prod-AwaitExpression
+features: [top-level-await, async-iteration]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (binding of [await new Promise(function(res, rej) { res(1); })]) {
+ await new Promise(function(res, rej) { res(1); });
+ break;
+}
+
+// [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (var binding of [await new Promise(function(res, rej) { res(1); })]) {
+ await new Promise(function(res, rej) { res(1); });
+ break;
+}
+
+// [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (let binding of [await new Promise(function(res, rej) { res(1); })]) {
+ await new Promise(function(res, rej) { res(1); });
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-null.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-null.js
new file mode 100644
index 0000000000..4e3aa5654c
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-null.js
@@ -0,0 +1,70 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-null.case
+// - src/top-level-await/syntax/for-await-expr.template
+/*---
+description: AwaitExpression NullLiteral (Valid syntax for top level await in for await statements.)
+esid: prod-AwaitExpression
+features: [top-level-await, async-iteration]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (binding of [await null]) {
+ await null;
+ break;
+}
+
+// [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (var binding of [await null]) {
+ await null;
+ break;
+}
+
+// [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (let binding of [await null]) {
+ await null;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-obj-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-obj-literal.js
new file mode 100644
index 0000000000..fccfcb3445
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-obj-literal.js
@@ -0,0 +1,70 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-obj-literal.case
+// - src/top-level-await/syntax/for-await-expr.template
+/*---
+description: AwaitExpression ObjectLiteral (Valid syntax for top level await in for await statements.)
+esid: prod-AwaitExpression
+features: [top-level-await, async-iteration]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (binding of [await { function() {} }]) {
+ await { function() {} };
+ break;
+}
+
+// [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (var binding of [await { function() {} }]) {
+ await { function() {} };
+ break;
+}
+
+// [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (let binding of [await { function() {} }]) {
+ await { function() {} };
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-regexp.js
new file mode 100644
index 0000000000..5addcb3efb
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-regexp.js
@@ -0,0 +1,70 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-regexp.case
+// - src/top-level-await/syntax/for-await-expr.template
+/*---
+description: AwaitExpression RegularExpressionLiteral (Valid syntax for top level await in for await statements.)
+esid: prod-AwaitExpression
+features: [top-level-await, async-iteration]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (binding of [await /1/]) {
+ await /1/;
+ break;
+}
+
+// [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (var binding of [await /1/]) {
+ await /1/;
+ break;
+}
+
+// [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (let binding of [await /1/]) {
+ await /1/;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-template-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-template-literal.js
new file mode 100644
index 0000000000..aa6420f831
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-template-literal.js
@@ -0,0 +1,70 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-template-literal.case
+// - src/top-level-await/syntax/for-await-expr.template
+/*---
+description: AwaitExpression TemplateLiteral (Valid syntax for top level await in for await statements.)
+esid: prod-AwaitExpression
+features: [top-level-await, async-iteration]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (binding of [await ``]) {
+ await ``;
+ break;
+}
+
+// [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (var binding of [await ``]) {
+ await ``;
+ break;
+}
+
+// [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (let binding of [await ``]) {
+ await ``;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-this.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-this.js
new file mode 100644
index 0000000000..f6e28cc1c1
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-this.js
@@ -0,0 +1,70 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-this.case
+// - src/top-level-await/syntax/for-await-expr.template
+/*---
+description: AwaitExpression this (Valid syntax for top level await in for await statements.)
+esid: prod-AwaitExpression
+features: [top-level-await, async-iteration]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (binding of [await this]) {
+ await this;
+ break;
+}
+
+// [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (var binding of [await this]) {
+ await this;
+ break;
+}
+
+// [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (let binding of [await this]) {
+ await this;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-array-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-array-literal.js
new file mode 100644
index 0000000000..52c77f4e21
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-array-literal.js
@@ -0,0 +1,76 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-array-literal.case
+// - src/top-level-await/syntax/for-expr.template
+/*---
+description: AwaitExpression ArrayLiteral (Valid syntax for top level await in for statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+// for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( await [] ; await []; await [] ) {
+ await [];
+ break;
+}
+
+// for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( var binding; await []; await [] ) {
+ await [];
+ break;
+}
+
+// for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( let binding; await []; await [] ) {
+ await [];
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-func-expression.js
new file mode 100644
index 0000000000..b503c3b400
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-func-expression.js
@@ -0,0 +1,82 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-func-expression.case
+// - src/top-level-await/syntax/for-expr.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in for statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+// for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( await function() {} ; await function() {}; await function() {} ) {
+ await function() {};
+ break;
+}
+
+// for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( var binding; await function() {}; await function() {} ) {
+ await function() {};
+ break;
+}
+
+// for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( let binding; await function() {}; await function() {} ) {
+ await function() {};
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-identifier.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-identifier.js
new file mode 100644
index 0000000000..38a74ee54f
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-identifier.js
@@ -0,0 +1,77 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-identifier.case
+// - src/top-level-await/syntax/for-expr.template
+/*---
+description: AwaitExpression IdentifierReference (Valid syntax for top level await in for statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+var foo = 1;
+
+
+// for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( await foo ; await foo; await foo ) {
+ await foo;
+ break;
+}
+
+// for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( var binding; await foo; await foo ) {
+ await foo;
+ break;
+}
+
+// for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( let binding; await foo; await foo ) {
+ await foo;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-literal-number.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-literal-number.js
new file mode 100644
index 0000000000..75c6379260
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-literal-number.js
@@ -0,0 +1,76 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-number.case
+// - src/top-level-await/syntax/for-expr.template
+/*---
+description: AwaitExpression NumberLiteral (Valid syntax for top level await in for statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+// for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( await 1 ; await 1; await 1 ) {
+ await 1;
+ break;
+}
+
+// for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( var binding; await 1; await 1 ) {
+ await 1;
+ break;
+}
+
+// for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( let binding; await 1; await 1 ) {
+ await 1;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-literal-string.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-literal-string.js
new file mode 100644
index 0000000000..305d58852d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-literal-string.js
@@ -0,0 +1,76 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-string.case
+// - src/top-level-await/syntax/for-expr.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in for statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+// for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( await '' ; await ''; await '' ) {
+ await '';
+ break;
+}
+
+// for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( var binding; await ''; await '' ) {
+ await '';
+ break;
+}
+
+// for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( let binding; await ''; await '' ) {
+ await '';
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-nested.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-nested.js
new file mode 100644
index 0000000000..4a97e72792
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-nested.js
@@ -0,0 +1,72 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-nested.case
+// - src/top-level-await/syntax/for-expr.template
+/*---
+description: Nested AwaitExpressions (Valid syntax for top level await in for statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+---*/
+
+
+// for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( await await await await await await await await await await await await await await await 'await' ; await await await await await await await await await await await await await await await 'await'; await await await await await await await await await await await await await await await 'await' ) {
+ await await await await await await await await await await await await await await await 'await';
+ break;
+}
+
+// for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( var binding; await await await await await await await await await await await await await await await 'await'; await await await await await await await await await await await await await await await 'await' ) {
+ await await await await await await await await await await await await await await await 'await';
+ break;
+}
+
+// for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( let binding; await await await await await await await await await await await await await await await 'await'; await await await await await await await await await await await await await await await 'await' ) {
+ await await await await await await await await await await await await await await await 'await';
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-new-expr.js
new file mode 100644
index 0000000000..95c6053b62
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-new-expr.js
@@ -0,0 +1,73 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-new-expr.case
+// - src/top-level-await/syntax/for-expr.template
+/*---
+description: AwaitExpression new MemberExpression (Valid syntax for top level await in for statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+---*/
+
+
+// for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( await new Promise(function(res, rej) { res(1); }) ; await new Promise(function(res, rej) { res(1); }); await new Promise(function(res, rej) { res(1); }) ) {
+ await new Promise(function(res, rej) { res(1); });
+ break;
+}
+
+// for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( var binding; await new Promise(function(res, rej) { res(1); }); await new Promise(function(res, rej) { res(1); }) ) {
+ await new Promise(function(res, rej) { res(1); });
+ break;
+}
+
+// for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( let binding; await new Promise(function(res, rej) { res(1); }); await new Promise(function(res, rej) { res(1); }) ) {
+ await new Promise(function(res, rej) { res(1); });
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-null.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-null.js
new file mode 100644
index 0000000000..335d701269
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-null.js
@@ -0,0 +1,76 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-null.case
+// - src/top-level-await/syntax/for-expr.template
+/*---
+description: AwaitExpression NullLiteral (Valid syntax for top level await in for statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+// for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( await null ; await null; await null ) {
+ await null;
+ break;
+}
+
+// for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( var binding; await null; await null ) {
+ await null;
+ break;
+}
+
+// for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( let binding; await null; await null ) {
+ await null;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-obj-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-obj-literal.js
new file mode 100644
index 0000000000..a2dcfef5a6
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-obj-literal.js
@@ -0,0 +1,76 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-obj-literal.case
+// - src/top-level-await/syntax/for-expr.template
+/*---
+description: AwaitExpression ObjectLiteral (Valid syntax for top level await in for statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+// for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( await { function() {} } ; await { function() {} }; await { function() {} } ) {
+ await { function() {} };
+ break;
+}
+
+// for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( var binding; await { function() {} }; await { function() {} } ) {
+ await { function() {} };
+ break;
+}
+
+// for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( let binding; await { function() {} }; await { function() {} } ) {
+ await { function() {} };
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-regexp.js
new file mode 100644
index 0000000000..7e2c50c486
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-regexp.js
@@ -0,0 +1,76 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-regexp.case
+// - src/top-level-await/syntax/for-expr.template
+/*---
+description: AwaitExpression RegularExpressionLiteral (Valid syntax for top level await in for statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+// for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( await /1/ ; await /1/; await /1/ ) {
+ await /1/;
+ break;
+}
+
+// for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( var binding; await /1/; await /1/ ) {
+ await /1/;
+ break;
+}
+
+// for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( let binding; await /1/; await /1/ ) {
+ await /1/;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-template-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-template-literal.js
new file mode 100644
index 0000000000..9e5c396340
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-template-literal.js
@@ -0,0 +1,76 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-template-literal.case
+// - src/top-level-await/syntax/for-expr.template
+/*---
+description: AwaitExpression TemplateLiteral (Valid syntax for top level await in for statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+// for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( await `` ; await ``; await `` ) {
+ await ``;
+ break;
+}
+
+// for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( var binding; await ``; await `` ) {
+ await ``;
+ break;
+}
+
+// for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( let binding; await ``; await `` ) {
+ await ``;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-this.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-this.js
new file mode 100644
index 0000000000..d9e1454940
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-this.js
@@ -0,0 +1,76 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-this.case
+// - src/top-level-await/syntax/for-expr.template
+/*---
+description: AwaitExpression this (Valid syntax for top level await in for statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+// for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( await this ; await this; await this ) {
+ await this;
+ break;
+}
+
+// for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( var binding; await this; await this ) {
+ await this;
+ break;
+}
+
+// for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( let binding; await this; await this ) {
+ await this;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-array-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-array-literal.js
new file mode 100644
index 0000000000..1a7c09f7a0
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-array-literal.js
@@ -0,0 +1,78 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-array-literal.case
+// - src/top-level-await/syntax/for-in-expr.template
+/*---
+description: AwaitExpression ArrayLiteral (Valid syntax for top level await in for-in statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding in [await []]) {
+ await [];
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding in [await []]) {
+ await [];
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding in [await []]) {
+ await [];
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-func-expression.js
new file mode 100644
index 0000000000..df5ee5b75b
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-func-expression.js
@@ -0,0 +1,84 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-func-expression.case
+// - src/top-level-await/syntax/for-in-expr.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in for-in statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding in [await function() {}]) {
+ await function() {};
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding in [await function() {}]) {
+ await function() {};
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding in [await function() {}]) {
+ await function() {};
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-identifier.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-identifier.js
new file mode 100644
index 0000000000..8e70be07ab
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-identifier.js
@@ -0,0 +1,79 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-identifier.case
+// - src/top-level-await/syntax/for-in-expr.template
+/*---
+description: AwaitExpression IdentifierReference (Valid syntax for top level await in for-in statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+var foo = 1;
+
+
+var binding;
+
+// for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding in [await foo]) {
+ await foo;
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding in [await foo]) {
+ await foo;
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding in [await foo]) {
+ await foo;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-literal-number.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-literal-number.js
new file mode 100644
index 0000000000..37ef5586a0
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-literal-number.js
@@ -0,0 +1,78 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-number.case
+// - src/top-level-await/syntax/for-in-expr.template
+/*---
+description: AwaitExpression NumberLiteral (Valid syntax for top level await in for-in statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding in [await 1]) {
+ await 1;
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding in [await 1]) {
+ await 1;
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding in [await 1]) {
+ await 1;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-literal-string.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-literal-string.js
new file mode 100644
index 0000000000..9526966399
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-literal-string.js
@@ -0,0 +1,78 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-string.case
+// - src/top-level-await/syntax/for-in-expr.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in for-in statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding in [await '']) {
+ await '';
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding in [await '']) {
+ await '';
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding in [await '']) {
+ await '';
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-nested.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-nested.js
new file mode 100644
index 0000000000..126eaf6698
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-nested.js
@@ -0,0 +1,74 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-nested.case
+// - src/top-level-await/syntax/for-in-expr.template
+/*---
+description: Nested AwaitExpressions (Valid syntax for top level await in for-in statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding in [await await await await await await await await await await await await await await await 'await']) {
+ await await await await await await await await await await await await await await await 'await';
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding in [await await await await await await await await await await await await await await await 'await']) {
+ await await await await await await await await await await await await await await await 'await';
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding in [await await await await await await await await await await await await await await await 'await']) {
+ await await await await await await await await await await await await await await await 'await';
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-new-expr.js
new file mode 100644
index 0000000000..ae47d48012
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-new-expr.js
@@ -0,0 +1,75 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-new-expr.case
+// - src/top-level-await/syntax/for-in-expr.template
+/*---
+description: AwaitExpression new MemberExpression (Valid syntax for top level await in for-in statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding in [await new Promise(function(res, rej) { res(1); })]) {
+ await new Promise(function(res, rej) { res(1); });
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding in [await new Promise(function(res, rej) { res(1); })]) {
+ await new Promise(function(res, rej) { res(1); });
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding in [await new Promise(function(res, rej) { res(1); })]) {
+ await new Promise(function(res, rej) { res(1); });
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-null.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-null.js
new file mode 100644
index 0000000000..5e24dc89cc
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-null.js
@@ -0,0 +1,78 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-null.case
+// - src/top-level-await/syntax/for-in-expr.template
+/*---
+description: AwaitExpression NullLiteral (Valid syntax for top level await in for-in statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding in [await null]) {
+ await null;
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding in [await null]) {
+ await null;
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding in [await null]) {
+ await null;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-obj-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-obj-literal.js
new file mode 100644
index 0000000000..049a3711f3
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-obj-literal.js
@@ -0,0 +1,78 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-obj-literal.case
+// - src/top-level-await/syntax/for-in-expr.template
+/*---
+description: AwaitExpression ObjectLiteral (Valid syntax for top level await in for-in statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding in [await { function() {} }]) {
+ await { function() {} };
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding in [await { function() {} }]) {
+ await { function() {} };
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding in [await { function() {} }]) {
+ await { function() {} };
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-regexp.js
new file mode 100644
index 0000000000..e3469e0182
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-regexp.js
@@ -0,0 +1,78 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-regexp.case
+// - src/top-level-await/syntax/for-in-expr.template
+/*---
+description: AwaitExpression RegularExpressionLiteral (Valid syntax for top level await in for-in statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding in [await /1/]) {
+ await /1/;
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding in [await /1/]) {
+ await /1/;
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding in [await /1/]) {
+ await /1/;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-template-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-template-literal.js
new file mode 100644
index 0000000000..f6e75ceaba
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-template-literal.js
@@ -0,0 +1,78 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-template-literal.case
+// - src/top-level-await/syntax/for-in-expr.template
+/*---
+description: AwaitExpression TemplateLiteral (Valid syntax for top level await in for-in statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding in [await ``]) {
+ await ``;
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding in [await ``]) {
+ await ``;
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding in [await ``]) {
+ await ``;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-this.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-this.js
new file mode 100644
index 0000000000..70d7337cfa
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-this.js
@@ -0,0 +1,78 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-this.case
+// - src/top-level-await/syntax/for-in-expr.template
+/*---
+description: AwaitExpression this (Valid syntax for top level await in for-in statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding in [await this]) {
+ await this;
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding in [await this]) {
+ await this;
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding in [await this]) {
+ await this;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-array-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-array-literal.js
new file mode 100644
index 0000000000..28ee2d2cce
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-array-literal.js
@@ -0,0 +1,78 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-array-literal.case
+// - src/top-level-await/syntax/for-of-expr.template
+/*---
+description: AwaitExpression ArrayLiteral (Valid syntax for top level await in for-of statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding of [await []]) {
+ await [];
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding of [await []]) {
+ await [];
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding of [await []]) {
+ await [];
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-func-expression.js
new file mode 100644
index 0000000000..5ce9d79b0b
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-func-expression.js
@@ -0,0 +1,84 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-func-expression.case
+// - src/top-level-await/syntax/for-of-expr.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in for-of statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding of [await function() {}]) {
+ await function() {};
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding of [await function() {}]) {
+ await function() {};
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding of [await function() {}]) {
+ await function() {};
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-identifier.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-identifier.js
new file mode 100644
index 0000000000..ca583c1c4a
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-identifier.js
@@ -0,0 +1,79 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-identifier.case
+// - src/top-level-await/syntax/for-of-expr.template
+/*---
+description: AwaitExpression IdentifierReference (Valid syntax for top level await in for-of statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+var foo = 1;
+
+
+var binding;
+
+// for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding of [await foo]) {
+ await foo;
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding of [await foo]) {
+ await foo;
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding of [await foo]) {
+ await foo;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-literal-number.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-literal-number.js
new file mode 100644
index 0000000000..75255ded9b
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-literal-number.js
@@ -0,0 +1,78 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-number.case
+// - src/top-level-await/syntax/for-of-expr.template
+/*---
+description: AwaitExpression NumberLiteral (Valid syntax for top level await in for-of statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding of [await 1]) {
+ await 1;
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding of [await 1]) {
+ await 1;
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding of [await 1]) {
+ await 1;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-literal-string.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-literal-string.js
new file mode 100644
index 0000000000..266e7a0249
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-literal-string.js
@@ -0,0 +1,78 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-string.case
+// - src/top-level-await/syntax/for-of-expr.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in for-of statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding of [await '']) {
+ await '';
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding of [await '']) {
+ await '';
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding of [await '']) {
+ await '';
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-nested.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-nested.js
new file mode 100644
index 0000000000..0b34729eed
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-nested.js
@@ -0,0 +1,74 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-nested.case
+// - src/top-level-await/syntax/for-of-expr.template
+/*---
+description: Nested AwaitExpressions (Valid syntax for top level await in for-of statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding of [await await await await await await await await await await await await await await await 'await']) {
+ await await await await await await await await await await await await await await await 'await';
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding of [await await await await await await await await await await await await await await await 'await']) {
+ await await await await await await await await await await await await await await await 'await';
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding of [await await await await await await await await await await await await await await await 'await']) {
+ await await await await await await await await await await await await await await await 'await';
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-new-expr.js
new file mode 100644
index 0000000000..983736207d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-new-expr.js
@@ -0,0 +1,75 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-new-expr.case
+// - src/top-level-await/syntax/for-of-expr.template
+/*---
+description: AwaitExpression new MemberExpression (Valid syntax for top level await in for-of statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding of [await new Promise(function(res, rej) { res(1); })]) {
+ await new Promise(function(res, rej) { res(1); });
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding of [await new Promise(function(res, rej) { res(1); })]) {
+ await new Promise(function(res, rej) { res(1); });
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding of [await new Promise(function(res, rej) { res(1); })]) {
+ await new Promise(function(res, rej) { res(1); });
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-null.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-null.js
new file mode 100644
index 0000000000..2bb8e9e670
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-null.js
@@ -0,0 +1,78 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-null.case
+// - src/top-level-await/syntax/for-of-expr.template
+/*---
+description: AwaitExpression NullLiteral (Valid syntax for top level await in for-of statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding of [await null]) {
+ await null;
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding of [await null]) {
+ await null;
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding of [await null]) {
+ await null;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-obj-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-obj-literal.js
new file mode 100644
index 0000000000..6943cc6629
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-obj-literal.js
@@ -0,0 +1,78 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-obj-literal.case
+// - src/top-level-await/syntax/for-of-expr.template
+/*---
+description: AwaitExpression ObjectLiteral (Valid syntax for top level await in for-of statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding of [await { function() {} }]) {
+ await { function() {} };
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding of [await { function() {} }]) {
+ await { function() {} };
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding of [await { function() {} }]) {
+ await { function() {} };
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-regexp.js
new file mode 100644
index 0000000000..bfbbb74879
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-regexp.js
@@ -0,0 +1,78 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-regexp.case
+// - src/top-level-await/syntax/for-of-expr.template
+/*---
+description: AwaitExpression RegularExpressionLiteral (Valid syntax for top level await in for-of statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding of [await /1/]) {
+ await /1/;
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding of [await /1/]) {
+ await /1/;
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding of [await /1/]) {
+ await /1/;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-template-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-template-literal.js
new file mode 100644
index 0000000000..3346869b0c
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-template-literal.js
@@ -0,0 +1,78 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-template-literal.case
+// - src/top-level-await/syntax/for-of-expr.template
+/*---
+description: AwaitExpression TemplateLiteral (Valid syntax for top level await in for-of statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding of [await ``]) {
+ await ``;
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding of [await ``]) {
+ await ``;
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding of [await ``]) {
+ await ``;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-this.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-this.js
new file mode 100644
index 0000000000..7f6ea27cac
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-this.js
@@ -0,0 +1,78 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-this.case
+// - src/top-level-await/syntax/for-of-expr.template
+/*---
+description: AwaitExpression this (Valid syntax for top level await in for-of statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding of [await this]) {
+ await this;
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding of [await this]) {
+ await this;
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding of [await this]) {
+ await this;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-array-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-array-literal.js
new file mode 100644
index 0000000000..279e7e9ba7
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-array-literal.js
@@ -0,0 +1,53 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-array-literal.case
+// - src/top-level-await/syntax/if-block.template
+/*---
+description: AwaitExpression ArrayLiteral (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (true) {
+ await [];
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-func-expression.js
new file mode 100644
index 0000000000..2905605ba3
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-func-expression.js
@@ -0,0 +1,59 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-func-expression.case
+// - src/top-level-await/syntax/if-block.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (true) {
+ await function() {};
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-identifier.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-identifier.js
new file mode 100644
index 0000000000..967c1e830c
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-identifier.js
@@ -0,0 +1,54 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-identifier.case
+// - src/top-level-await/syntax/if-block.template
+/*---
+description: AwaitExpression IdentifierReference (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+var foo = 1;
+
+
+if (true) {
+ await foo;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-literal-number.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-literal-number.js
new file mode 100644
index 0000000000..2ca464a245
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-literal-number.js
@@ -0,0 +1,53 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-number.case
+// - src/top-level-await/syntax/if-block.template
+/*---
+description: AwaitExpression NumberLiteral (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (true) {
+ await 1;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-literal-string.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-literal-string.js
new file mode 100644
index 0000000000..f73ab8443f
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-literal-string.js
@@ -0,0 +1,53 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-string.case
+// - src/top-level-await/syntax/if-block.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (true) {
+ await '';
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-nested.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-nested.js
new file mode 100644
index 0000000000..452b331138
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-nested.js
@@ -0,0 +1,49 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-nested.case
+// - src/top-level-await/syntax/if-block.template
+/*---
+description: Nested AwaitExpressions (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+---*/
+
+
+if (true) {
+ await await await await await await await await await await await await await await await 'await';
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-new-expr.js
new file mode 100644
index 0000000000..c3e1eb1918
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-new-expr.js
@@ -0,0 +1,50 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-new-expr.case
+// - src/top-level-await/syntax/if-block.template
+/*---
+description: AwaitExpression new MemberExpression (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+---*/
+
+
+if (true) {
+ await new Promise(function(res, rej) { res(1); });
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-null.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-null.js
new file mode 100644
index 0000000000..b7bb69a4d4
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-null.js
@@ -0,0 +1,53 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-null.case
+// - src/top-level-await/syntax/if-block.template
+/*---
+description: AwaitExpression NullLiteral (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (true) {
+ await null;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-obj-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-obj-literal.js
new file mode 100644
index 0000000000..c0647493b9
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-obj-literal.js
@@ -0,0 +1,53 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-obj-literal.case
+// - src/top-level-await/syntax/if-block.template
+/*---
+description: AwaitExpression ObjectLiteral (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (true) {
+ await { function() {} };
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-regexp.js
new file mode 100644
index 0000000000..6c2edebf92
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-regexp.js
@@ -0,0 +1,53 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-regexp.case
+// - src/top-level-await/syntax/if-block.template
+/*---
+description: AwaitExpression RegularExpressionLiteral (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (true) {
+ await /1/;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-template-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-template-literal.js
new file mode 100644
index 0000000000..aae9410ad1
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-template-literal.js
@@ -0,0 +1,53 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-template-literal.case
+// - src/top-level-await/syntax/if-block.template
+/*---
+description: AwaitExpression TemplateLiteral (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (true) {
+ await ``;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-this.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-this.js
new file mode 100644
index 0000000000..a2ddcd2e13
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-this.js
@@ -0,0 +1,53 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-this.case
+// - src/top-level-await/syntax/if-block.template
+/*---
+description: AwaitExpression this (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (true) {
+ await this;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-array-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-array-literal.js
new file mode 100644
index 0000000000..cd3219b3c7
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-array-literal.js
@@ -0,0 +1,51 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-array-literal.case
+// - src/top-level-await/syntax/if-expr.template
+/*---
+description: AwaitExpression ArrayLiteral (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (await []) {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-func-expression.js
new file mode 100644
index 0000000000..b51c7e59e5
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-func-expression.js
@@ -0,0 +1,57 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-func-expression.case
+// - src/top-level-await/syntax/if-expr.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (await function() {}) {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-identifier.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-identifier.js
new file mode 100644
index 0000000000..57e171135d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-identifier.js
@@ -0,0 +1,52 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-identifier.case
+// - src/top-level-await/syntax/if-expr.template
+/*---
+description: AwaitExpression IdentifierReference (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+var foo = 1;
+
+
+if (await foo) {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-literal-number.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-literal-number.js
new file mode 100644
index 0000000000..5e7671b8c3
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-literal-number.js
@@ -0,0 +1,51 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-number.case
+// - src/top-level-await/syntax/if-expr.template
+/*---
+description: AwaitExpression NumberLiteral (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (await 1) {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-literal-string.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-literal-string.js
new file mode 100644
index 0000000000..5f245e111e
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-literal-string.js
@@ -0,0 +1,51 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-string.case
+// - src/top-level-await/syntax/if-expr.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (await '') {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-nested.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-nested.js
new file mode 100644
index 0000000000..e94e55bbee
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-nested.js
@@ -0,0 +1,47 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-nested.case
+// - src/top-level-await/syntax/if-expr.template
+/*---
+description: Nested AwaitExpressions (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+---*/
+
+
+if (await await await await await await await await await await await await await await await 'await') {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-new-expr.js
new file mode 100644
index 0000000000..9119c235e1
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-new-expr.js
@@ -0,0 +1,48 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-new-expr.case
+// - src/top-level-await/syntax/if-expr.template
+/*---
+description: AwaitExpression new MemberExpression (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+---*/
+
+
+if (await new Promise(function(res, rej) { res(1); })) {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-null.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-null.js
new file mode 100644
index 0000000000..ef14ac687d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-null.js
@@ -0,0 +1,51 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-null.case
+// - src/top-level-await/syntax/if-expr.template
+/*---
+description: AwaitExpression NullLiteral (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (await null) {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-obj-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-obj-literal.js
new file mode 100644
index 0000000000..7ebd37cb55
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-obj-literal.js
@@ -0,0 +1,51 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-obj-literal.case
+// - src/top-level-await/syntax/if-expr.template
+/*---
+description: AwaitExpression ObjectLiteral (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (await { function() {} }) {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-regexp.js
new file mode 100644
index 0000000000..e7c958bea2
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-regexp.js
@@ -0,0 +1,51 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-regexp.case
+// - src/top-level-await/syntax/if-expr.template
+/*---
+description: AwaitExpression RegularExpressionLiteral (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (await /1/) {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-template-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-template-literal.js
new file mode 100644
index 0000000000..0a2d306d6c
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-template-literal.js
@@ -0,0 +1,51 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-template-literal.case
+// - src/top-level-await/syntax/if-expr.template
+/*---
+description: AwaitExpression TemplateLiteral (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (await ``) {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-this.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-this.js
new file mode 100644
index 0000000000..2d27d027cf
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-this.js
@@ -0,0 +1,51 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-this.case
+// - src/top-level-await/syntax/if-expr.template
+/*---
+description: AwaitExpression this (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (await this) {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/shell.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/shell.js
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-array-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-array-literal.js
new file mode 100644
index 0000000000..12c4789327
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-array-literal.js
@@ -0,0 +1,45 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-array-literal.case
+// - src/top-level-await/syntax/top-level.template
+/*---
+description: AwaitExpression ArrayLiteral (Valid syntax for top level await.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+await [];
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-func-expression.js
new file mode 100644
index 0000000000..b4bee57953
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-func-expression.js
@@ -0,0 +1,51 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-func-expression.case
+// - src/top-level-await/syntax/top-level.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+await function() {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-identifier.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-identifier.js
new file mode 100644
index 0000000000..43f3be5dd8
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-identifier.js
@@ -0,0 +1,46 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-identifier.case
+// - src/top-level-await/syntax/top-level.template
+/*---
+description: AwaitExpression IdentifierReference (Valid syntax for top level await.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+var foo = 1;
+
+
+await foo;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-literal-number.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-literal-number.js
new file mode 100644
index 0000000000..b8f1d86b5a
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-literal-number.js
@@ -0,0 +1,45 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-number.case
+// - src/top-level-await/syntax/top-level.template
+/*---
+description: AwaitExpression NumberLiteral (Valid syntax for top level await.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+await 1;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-literal-string.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-literal-string.js
new file mode 100644
index 0000000000..30b035df5e
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-literal-string.js
@@ -0,0 +1,45 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-string.case
+// - src/top-level-await/syntax/top-level.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+await '';
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-nested.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-nested.js
new file mode 100644
index 0000000000..9cf7cc4f4d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-nested.js
@@ -0,0 +1,41 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-nested.case
+// - src/top-level-await/syntax/top-level.template
+/*---
+description: Nested AwaitExpressions (Valid syntax for top level await.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+---*/
+
+
+await await await await await await await await await await await await await await await 'await';
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-new-expr.js
new file mode 100644
index 0000000000..ab5b9cdd91
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-new-expr.js
@@ -0,0 +1,42 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-new-expr.case
+// - src/top-level-await/syntax/top-level.template
+/*---
+description: AwaitExpression new MemberExpression (Valid syntax for top level await.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+---*/
+
+
+await new Promise(function(res, rej) { res(1); });
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-null.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-null.js
new file mode 100644
index 0000000000..da9bfead7c
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-null.js
@@ -0,0 +1,45 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-null.case
+// - src/top-level-await/syntax/top-level.template
+/*---
+description: AwaitExpression NullLiteral (Valid syntax for top level await.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+await null;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-obj-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-obj-literal.js
new file mode 100644
index 0000000000..dd717e28f1
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-obj-literal.js
@@ -0,0 +1,45 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-obj-literal.case
+// - src/top-level-await/syntax/top-level.template
+/*---
+description: AwaitExpression ObjectLiteral (Valid syntax for top level await.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+await { function() {} };
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-regexp.js
new file mode 100644
index 0000000000..3f25ab4e89
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-regexp.js
@@ -0,0 +1,45 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-regexp.case
+// - src/top-level-await/syntax/top-level.template
+/*---
+description: AwaitExpression RegularExpressionLiteral (Valid syntax for top level await.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+await /1/;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-template-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-template-literal.js
new file mode 100644
index 0000000000..f088992430
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-template-literal.js
@@ -0,0 +1,45 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-template-literal.case
+// - src/top-level-await/syntax/top-level.template
+/*---
+description: AwaitExpression TemplateLiteral (Valid syntax for top level await.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+await ``;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-this.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-this.js
new file mode 100644
index 0000000000..3c0f241571
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-this.js
@@ -0,0 +1,45 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-this.case
+// - src/top-level-await/syntax/top-level.template
+/*---
+description: AwaitExpression this (Valid syntax for top level await.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+await this;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-array-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-array-literal.js
new file mode 100644
index 0000000000..32ae857da4
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-array-literal.js
@@ -0,0 +1,70 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-array-literal.case
+// - src/top-level-await/syntax/try.template
+/*---
+description: AwaitExpression ArrayLiteral (Valid syntax for top level await in try-catch-finally blocks.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+try {
+ await [];
+} catch(e) {
+ await [];
+}
+
+try {
+ await [];
+} finally {
+ await [];
+}
+
+try {
+ await [];
+} catch(e) {
+ await [];
+} finally {
+ await [];
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-func-expression.js
new file mode 100644
index 0000000000..047534c424
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-func-expression.js
@@ -0,0 +1,76 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-func-expression.case
+// - src/top-level-await/syntax/try.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in try-catch-finally blocks.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+try {
+ await function() {};
+} catch(e) {
+ await function() {};
+}
+
+try {
+ await function() {};
+} finally {
+ await function() {};
+}
+
+try {
+ await function() {};
+} catch(e) {
+ await function() {};
+} finally {
+ await function() {};
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-identifier.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-identifier.js
new file mode 100644
index 0000000000..1a543bcd93
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-identifier.js
@@ -0,0 +1,71 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-identifier.case
+// - src/top-level-await/syntax/try.template
+/*---
+description: AwaitExpression IdentifierReference (Valid syntax for top level await in try-catch-finally blocks.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+var foo = 1;
+
+
+try {
+ await foo;
+} catch(e) {
+ await foo;
+}
+
+try {
+ await foo;
+} finally {
+ await foo;
+}
+
+try {
+ await foo;
+} catch(e) {
+ await foo;
+} finally {
+ await foo;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-literal-number.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-literal-number.js
new file mode 100644
index 0000000000..aa0f7f5a1d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-literal-number.js
@@ -0,0 +1,70 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-number.case
+// - src/top-level-await/syntax/try.template
+/*---
+description: AwaitExpression NumberLiteral (Valid syntax for top level await in try-catch-finally blocks.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+try {
+ await 1;
+} catch(e) {
+ await 1;
+}
+
+try {
+ await 1;
+} finally {
+ await 1;
+}
+
+try {
+ await 1;
+} catch(e) {
+ await 1;
+} finally {
+ await 1;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-literal-string.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-literal-string.js
new file mode 100644
index 0000000000..5535856810
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-literal-string.js
@@ -0,0 +1,70 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-string.case
+// - src/top-level-await/syntax/try.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in try-catch-finally blocks.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+try {
+ await '';
+} catch(e) {
+ await '';
+}
+
+try {
+ await '';
+} finally {
+ await '';
+}
+
+try {
+ await '';
+} catch(e) {
+ await '';
+} finally {
+ await '';
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-nested.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-nested.js
new file mode 100644
index 0000000000..85ad388964
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-nested.js
@@ -0,0 +1,66 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-nested.case
+// - src/top-level-await/syntax/try.template
+/*---
+description: Nested AwaitExpressions (Valid syntax for top level await in try-catch-finally blocks.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+---*/
+
+
+try {
+ await await await await await await await await await await await await await await await 'await';
+} catch(e) {
+ await await await await await await await await await await await await await await await 'await';
+}
+
+try {
+ await await await await await await await await await await await await await await await 'await';
+} finally {
+ await await await await await await await await await await await await await await await 'await';
+}
+
+try {
+ await await await await await await await await await await await await await await await 'await';
+} catch(e) {
+ await await await await await await await await await await await await await await await 'await';
+} finally {
+ await await await await await await await await await await await await await await await 'await';
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-new-expr.js
new file mode 100644
index 0000000000..be6167e6d5
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-new-expr.js
@@ -0,0 +1,67 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-new-expr.case
+// - src/top-level-await/syntax/try.template
+/*---
+description: AwaitExpression new MemberExpression (Valid syntax for top level await in try-catch-finally blocks.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+---*/
+
+
+try {
+ await new Promise(function(res, rej) { res(1); });
+} catch(e) {
+ await new Promise(function(res, rej) { res(1); });
+}
+
+try {
+ await new Promise(function(res, rej) { res(1); });
+} finally {
+ await new Promise(function(res, rej) { res(1); });
+}
+
+try {
+ await new Promise(function(res, rej) { res(1); });
+} catch(e) {
+ await new Promise(function(res, rej) { res(1); });
+} finally {
+ await new Promise(function(res, rej) { res(1); });
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-null.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-null.js
new file mode 100644
index 0000000000..68b440d375
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-null.js
@@ -0,0 +1,70 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-null.case
+// - src/top-level-await/syntax/try.template
+/*---
+description: AwaitExpression NullLiteral (Valid syntax for top level await in try-catch-finally blocks.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+try {
+ await null;
+} catch(e) {
+ await null;
+}
+
+try {
+ await null;
+} finally {
+ await null;
+}
+
+try {
+ await null;
+} catch(e) {
+ await null;
+} finally {
+ await null;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-obj-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-obj-literal.js
new file mode 100644
index 0000000000..a6f338923d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-obj-literal.js
@@ -0,0 +1,70 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-obj-literal.case
+// - src/top-level-await/syntax/try.template
+/*---
+description: AwaitExpression ObjectLiteral (Valid syntax for top level await in try-catch-finally blocks.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+try {
+ await { function() {} };
+} catch(e) {
+ await { function() {} };
+}
+
+try {
+ await { function() {} };
+} finally {
+ await { function() {} };
+}
+
+try {
+ await { function() {} };
+} catch(e) {
+ await { function() {} };
+} finally {
+ await { function() {} };
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-regexp.js
new file mode 100644
index 0000000000..4fe7a8d078
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-regexp.js
@@ -0,0 +1,70 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-regexp.case
+// - src/top-level-await/syntax/try.template
+/*---
+description: AwaitExpression RegularExpressionLiteral (Valid syntax for top level await in try-catch-finally blocks.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+try {
+ await /1/;
+} catch(e) {
+ await /1/;
+}
+
+try {
+ await /1/;
+} finally {
+ await /1/;
+}
+
+try {
+ await /1/;
+} catch(e) {
+ await /1/;
+} finally {
+ await /1/;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-template-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-template-literal.js
new file mode 100644
index 0000000000..161b9356fe
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-template-literal.js
@@ -0,0 +1,70 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-template-literal.case
+// - src/top-level-await/syntax/try.template
+/*---
+description: AwaitExpression TemplateLiteral (Valid syntax for top level await in try-catch-finally blocks.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+try {
+ await ``;
+} catch(e) {
+ await ``;
+}
+
+try {
+ await ``;
+} finally {
+ await ``;
+}
+
+try {
+ await ``;
+} catch(e) {
+ await ``;
+} finally {
+ await ``;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-this.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-this.js
new file mode 100644
index 0000000000..ee650e12fa
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-this.js
@@ -0,0 +1,70 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-this.case
+// - src/top-level-await/syntax/try.template
+/*---
+description: AwaitExpression this (Valid syntax for top level await in try-catch-finally blocks.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+try {
+ await this;
+} catch(e) {
+ await this;
+}
+
+try {
+ await this;
+} finally {
+ await this;
+}
+
+try {
+ await this;
+} catch(e) {
+ await this;
+} finally {
+ await this;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-array-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-array-literal.js
new file mode 100644
index 0000000000..b7f1a5080f
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-array-literal.js
@@ -0,0 +1,46 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-array-literal.case
+// - src/top-level-await/syntax/typeof.template
+/*---
+description: AwaitExpression ArrayLiteral (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ typeof UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+typeof await [];
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-func-expression.js
new file mode 100644
index 0000000000..3f616b8124
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-func-expression.js
@@ -0,0 +1,52 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-func-expression.case
+// - src/top-level-await/syntax/typeof.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ typeof UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+typeof await function() {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-identifier.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-identifier.js
new file mode 100644
index 0000000000..3eb7cac029
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-identifier.js
@@ -0,0 +1,47 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-identifier.case
+// - src/top-level-await/syntax/typeof.template
+/*---
+description: AwaitExpression IdentifierReference (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ typeof UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+var foo = 1;
+
+
+typeof await foo;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-literal-number.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-literal-number.js
new file mode 100644
index 0000000000..d0a1de5a7f
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-literal-number.js
@@ -0,0 +1,46 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-number.case
+// - src/top-level-await/syntax/typeof.template
+/*---
+description: AwaitExpression NumberLiteral (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ typeof UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+typeof await 1;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-literal-string.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-literal-string.js
new file mode 100644
index 0000000000..9145fda0f8
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-literal-string.js
@@ -0,0 +1,46 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-string.case
+// - src/top-level-await/syntax/typeof.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ typeof UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+typeof await '';
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-nested.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-nested.js
new file mode 100644
index 0000000000..f2660dbde0
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-nested.js
@@ -0,0 +1,42 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-nested.case
+// - src/top-level-await/syntax/typeof.template
+/*---
+description: Nested AwaitExpressions (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ typeof UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+---*/
+
+
+typeof await await await await await await await await await await await await await await await 'await';
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-new-expr.js
new file mode 100644
index 0000000000..1a332b95b8
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-new-expr.js
@@ -0,0 +1,43 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-new-expr.case
+// - src/top-level-await/syntax/typeof.template
+/*---
+description: AwaitExpression new MemberExpression (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ typeof UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+---*/
+
+
+typeof await new Promise(function(res, rej) { res(1); });
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-null.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-null.js
new file mode 100644
index 0000000000..fcb3fc4d32
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-null.js
@@ -0,0 +1,46 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-null.case
+// - src/top-level-await/syntax/typeof.template
+/*---
+description: AwaitExpression NullLiteral (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ typeof UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+typeof await null;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-obj-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-obj-literal.js
new file mode 100644
index 0000000000..bcd5864cda
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-obj-literal.js
@@ -0,0 +1,46 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-obj-literal.case
+// - src/top-level-await/syntax/typeof.template
+/*---
+description: AwaitExpression ObjectLiteral (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ typeof UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+typeof await { function() {} };
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-regexp.js
new file mode 100644
index 0000000000..5b3d5aee8b
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-regexp.js
@@ -0,0 +1,46 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-regexp.case
+// - src/top-level-await/syntax/typeof.template
+/*---
+description: AwaitExpression RegularExpressionLiteral (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ typeof UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+typeof await /1/;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-template-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-template-literal.js
new file mode 100644
index 0000000000..191b9528cc
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-template-literal.js
@@ -0,0 +1,46 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-template-literal.case
+// - src/top-level-await/syntax/typeof.template
+/*---
+description: AwaitExpression TemplateLiteral (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ typeof UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+typeof await ``;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-this.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-this.js
new file mode 100644
index 0000000000..795966ce9e
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-this.js
@@ -0,0 +1,46 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-this.case
+// - src/top-level-await/syntax/typeof.template
+/*---
+description: AwaitExpression this (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ typeof UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+typeof await this;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-array-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-array-literal.js
new file mode 100644
index 0000000000..983f83b502
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-array-literal.js
@@ -0,0 +1,46 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-array-literal.case
+// - src/top-level-await/syntax/void.template
+/*---
+description: AwaitExpression ArrayLiteral (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ void UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+void await [];
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-func-expression.js
new file mode 100644
index 0000000000..b1c559b88c
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-func-expression.js
@@ -0,0 +1,52 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-func-expression.case
+// - src/top-level-await/syntax/void.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ void UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+void await function() {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-identifier.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-identifier.js
new file mode 100644
index 0000000000..0b5eff7906
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-identifier.js
@@ -0,0 +1,47 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-identifier.case
+// - src/top-level-await/syntax/void.template
+/*---
+description: AwaitExpression IdentifierReference (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ void UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+var foo = 1;
+
+
+void await foo;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-literal-number.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-literal-number.js
new file mode 100644
index 0000000000..8b4da5200e
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-literal-number.js
@@ -0,0 +1,46 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-number.case
+// - src/top-level-await/syntax/void.template
+/*---
+description: AwaitExpression NumberLiteral (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ void UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+void await 1;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-literal-string.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-literal-string.js
new file mode 100644
index 0000000000..21b7cd0d2c
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-literal-string.js
@@ -0,0 +1,46 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-string.case
+// - src/top-level-await/syntax/void.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ void UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+void await '';
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-nested.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-nested.js
new file mode 100644
index 0000000000..0ee366b0fe
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-nested.js
@@ -0,0 +1,42 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-nested.case
+// - src/top-level-await/syntax/void.template
+/*---
+description: Nested AwaitExpressions (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ void UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+---*/
+
+
+void await await await await await await await await await await await await await await await 'await';
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-new-expr.js
new file mode 100644
index 0000000000..d8dd571c96
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-new-expr.js
@@ -0,0 +1,43 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-new-expr.case
+// - src/top-level-await/syntax/void.template
+/*---
+description: AwaitExpression new MemberExpression (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ void UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+---*/
+
+
+void await new Promise(function(res, rej) { res(1); });
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-null.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-null.js
new file mode 100644
index 0000000000..b6d4f8222a
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-null.js
@@ -0,0 +1,46 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-null.case
+// - src/top-level-await/syntax/void.template
+/*---
+description: AwaitExpression NullLiteral (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ void UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+void await null;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-obj-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-obj-literal.js
new file mode 100644
index 0000000000..f96ea26f1a
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-obj-literal.js
@@ -0,0 +1,46 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-obj-literal.case
+// - src/top-level-await/syntax/void.template
+/*---
+description: AwaitExpression ObjectLiteral (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ void UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+void await { function() {} };
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-regexp.js
new file mode 100644
index 0000000000..aa3b1206e2
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-regexp.js
@@ -0,0 +1,46 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-regexp.case
+// - src/top-level-await/syntax/void.template
+/*---
+description: AwaitExpression RegularExpressionLiteral (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ void UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+void await /1/;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-template-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-template-literal.js
new file mode 100644
index 0000000000..6a8e5351c3
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-template-literal.js
@@ -0,0 +1,46 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-template-literal.case
+// - src/top-level-await/syntax/void.template
+/*---
+description: AwaitExpression TemplateLiteral (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ void UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+void await ``;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-this.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-this.js
new file mode 100644
index 0000000000..dde34b5e37
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-this.js
@@ -0,0 +1,46 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-this.case
+// - src/top-level-await/syntax/void.template
+/*---
+description: AwaitExpression this (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ void UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+void await this;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-array-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-array-literal.js
new file mode 100644
index 0000000000..8b127326a1
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-array-literal.js
@@ -0,0 +1,50 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-array-literal.case
+// - src/top-level-await/syntax/while-expr.template
+/*---
+description: AwaitExpression ArrayLiteral (Valid syntax for top level await in an while expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ while ( Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+while (await []) { break; }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-func-expression.js
new file mode 100644
index 0000000000..2bbfbbfad6
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-func-expression.js
@@ -0,0 +1,56 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-func-expression.case
+// - src/top-level-await/syntax/while-expr.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in an while expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ while ( Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+while (await function() {}) { break; }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-identifier.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-identifier.js
new file mode 100644
index 0000000000..6645abb858
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-identifier.js
@@ -0,0 +1,51 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-identifier.case
+// - src/top-level-await/syntax/while-expr.template
+/*---
+description: AwaitExpression IdentifierReference (Valid syntax for top level await in an while expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ while ( Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+var foo = 1;
+
+
+while (await foo) { break; }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-literal-number.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-literal-number.js
new file mode 100644
index 0000000000..9b952da530
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-literal-number.js
@@ -0,0 +1,50 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-number.case
+// - src/top-level-await/syntax/while-expr.template
+/*---
+description: AwaitExpression NumberLiteral (Valid syntax for top level await in an while expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ while ( Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+while (await 1) { break; }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-literal-string.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-literal-string.js
new file mode 100644
index 0000000000..edc2d7f33c
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-literal-string.js
@@ -0,0 +1,50 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-string.case
+// - src/top-level-await/syntax/while-expr.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in an while expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ while ( Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+while (await '') { break; }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-nested.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-nested.js
new file mode 100644
index 0000000000..2cfb9d7a90
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-nested.js
@@ -0,0 +1,46 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-nested.case
+// - src/top-level-await/syntax/while-expr.template
+/*---
+description: Nested AwaitExpressions (Valid syntax for top level await in an while expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ while ( Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+---*/
+
+
+while (await await await await await await await await await await await await await await await 'await') { break; }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-new-expr.js
new file mode 100644
index 0000000000..255e10fbe0
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-new-expr.js
@@ -0,0 +1,47 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-new-expr.case
+// - src/top-level-await/syntax/while-expr.template
+/*---
+description: AwaitExpression new MemberExpression (Valid syntax for top level await in an while expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ while ( Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+---*/
+
+
+while (await new Promise(function(res, rej) { res(1); })) { break; }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-null.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-null.js
new file mode 100644
index 0000000000..8e85861880
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-null.js
@@ -0,0 +1,50 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-null.case
+// - src/top-level-await/syntax/while-expr.template
+/*---
+description: AwaitExpression NullLiteral (Valid syntax for top level await in an while expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ while ( Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+while (await null) { break; }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-obj-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-obj-literal.js
new file mode 100644
index 0000000000..c24f0bdc79
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-obj-literal.js
@@ -0,0 +1,50 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-obj-literal.case
+// - src/top-level-await/syntax/while-expr.template
+/*---
+description: AwaitExpression ObjectLiteral (Valid syntax for top level await in an while expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ while ( Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+while (await { function() {} }) { break; }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-regexp.js
new file mode 100644
index 0000000000..882450fcba
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-regexp.js
@@ -0,0 +1,50 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-regexp.case
+// - src/top-level-await/syntax/while-expr.template
+/*---
+description: AwaitExpression RegularExpressionLiteral (Valid syntax for top level await in an while expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ while ( Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+while (await /1/) { break; }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-template-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-template-literal.js
new file mode 100644
index 0000000000..4832d296d2
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-template-literal.js
@@ -0,0 +1,50 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-template-literal.case
+// - src/top-level-await/syntax/while-expr.template
+/*---
+description: AwaitExpression TemplateLiteral (Valid syntax for top level await in an while expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ while ( Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+while (await ``) { break; }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-this.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-this.js
new file mode 100644
index 0000000000..ef3819c7d4
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-this.js
@@ -0,0 +1,50 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-this.case
+// - src/top-level-await/syntax/while-expr.template
+/*---
+description: AwaitExpression this (Valid syntax for top level await in an while expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ while ( Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+while (await this) { break; }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/top-level-ticks-2.js b/js/src/tests/test262/language/module-code/top-level-await/top-level-ticks-2.js
new file mode 100644
index 0000000000..5cf533e5b1
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/top-level-ticks-2.js
@@ -0,0 +1,47 @@
+// |reftest| module async
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-asyncblockstart
+description: >
+ Evaluation of await ticks order
+info: |
+ AsyncBlockStart ( promiseCapability, asyncBody, asyncContext )
+
+ 1. Assert: promiseCapability is a PromiseCapability Record.
+ 2. Let runningContext be the running execution context.
+ 3. Set the code evaluation state of asyncContext such that when evaluation is resumed for that execution context the following steps will be performed:
+ a. Let result be the result of evaluating asyncBody.
+ ...
+includes: [compareArray.js]
+flags: [module, async]
+features: [top-level-await]
+---*/
+
+var expected = [
+ 'await 1',
+ 'tick 1',
+ 'await 2',
+ 'tick 2',
+ 'await 3',
+ 'tick 3',
+ 'await 4',
+ 'tick 4',
+];
+
+var actual = [];
+
+Promise.resolve(0)
+ .then(() => actual.push('tick 1'))
+ .then(() => actual.push('tick 2'))
+ .then(() => actual.push('tick 3'))
+ .then(() => actual.push('tick 4'))
+ .then(() => {
+ assert.compareArray(actual, expected, 'Ticks for top level await and promises');
+}).then($DONE, $DONE);
+
+await actual.push('await 1');
+await actual.push('await 2');
+await actual.push('await 3');
+await actual.push('await 4');
diff --git a/js/src/tests/test262/language/module-code/top-level-await/top-level-ticks.js b/js/src/tests/test262/language/module-code/top-level-await/top-level-ticks.js
new file mode 100644
index 0000000000..c9851128e7
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/top-level-ticks.js
@@ -0,0 +1,47 @@
+// |reftest| module async
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-asyncblockstart
+description: >
+ Evaluation of await ticks order
+info: |
+ AsyncBlockStart ( promiseCapability, asyncBody, asyncContext )
+
+ 1. Assert: promiseCapability is a PromiseCapability Record.
+ 2. Let runningContext be the running execution context.
+ 3. Set the code evaluation state of asyncContext such that when evaluation is resumed for that execution context the following steps will be performed:
+ a. Let result be the result of evaluating asyncBody.
+ ...
+includes: [compareArray.js]
+flags: [module, async]
+features: [top-level-await]
+---*/
+
+var expected = [
+ 'tick 1',
+ 'await 1',
+ 'tick 2',
+ 'await 2',
+ 'tick 3',
+ 'await 3',
+ 'tick 4',
+ 'await 4',
+];
+
+var actual = [];
+
+Promise.resolve(0)
+ .then(() => actual.push('tick 1'))
+ .then(() => actual.push('tick 2'))
+ .then(() => actual.push('tick 3'))
+ .then(() => actual.push('tick 4'))
+ .then(() => {
+ assert.compareArray(actual, expected, 'Ticks for top level await and promises');
+}).then($DONE, $DONE);
+
+await 1; actual.push('await 1');
+await 2; actual.push('await 2');
+await 3; actual.push('await 3');
+await 4; actual.push('await 4');
diff --git a/js/src/tests/test262/language/module-code/top-level-await/void-await-expr.js b/js/src/tests/test262/language/module-code/top-level-await/void-await-expr.js
new file mode 100644
index 0000000000..b1522ca600
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/void-await-expr.js
@@ -0,0 +1,36 @@
+// |reftest| module async
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ void AwaitExpression is still evaluated
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ void UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+esid: prod-AwaitExpression
+flags: [module, async]
+features: [top-level-await]
+---*/
+
+var got = 0;
+var x = {
+ get y() {
+ got += 1;
+ }
+};
+
+void await x.y;
+
+assert.sameValue(got, 1);
+
+$DONE();
diff --git a/js/src/tests/test262/language/module-code/top-level-await/while-dynamic-evaluation.js b/js/src/tests/test262/language/module-code/top-level-await/while-dynamic-evaluation.js
new file mode 100644
index 0000000000..e9e34ef5a6
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/while-dynamic-evaluation.js
@@ -0,0 +1,49 @@
+// |reftest| module async
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Evaluate Await expression for IfStatement
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+esid: prod-AwaitExpression
+flags: [module, async]
+features: [top-level-await]
+---*/
+
+var values = [];
+var p = Promise.resolve().then(() => {
+ // Replaces p!
+ p = Promise.resolve().then(() => {
+ p = Promise.resolve().then(() => {
+ values.push(3);
+ return false;
+ });
+
+ values.push(2);
+ return true;
+ })
+
+ values.push(1);
+
+ return true;
+});
+
+while (await p) {}
+
+assert.sameValue(values.length, 3);
+assert.sameValue(values[0], 1);
+assert.sameValue(values[1], 2);
+assert.sameValue(values[2], 3);
+
+$DONE();
diff --git a/js/src/tests/test262/language/module-code/verify-dfs-a_FIXTURE.js b/js/src/tests/test262/language/module-code/verify-dfs-a_FIXTURE.js
new file mode 100644
index 0000000000..21f2ace941
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/verify-dfs-a_FIXTURE.js
@@ -0,0 +1,9 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2020 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+import { evaluated, check } from './verify-dfs.js';
+
+check(import('./verify-dfs-b_FIXTURE.js'));
+
+evaluated('A');
diff --git a/js/src/tests/test262/language/module-code/verify-dfs-b_FIXTURE.js b/js/src/tests/test262/language/module-code/verify-dfs-b_FIXTURE.js
new file mode 100644
index 0000000000..2a61ee8f5a
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/verify-dfs-b_FIXTURE.js
@@ -0,0 +1,7 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2020 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+import { evaluated } from './verify-dfs.js';
+
+evaluated('B');
diff --git a/js/src/tests/test262/language/module-code/verify-dfs.js b/js/src/tests/test262/language/module-code/verify-dfs.js
new file mode 100644
index 0000000000..59432db45f
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/verify-dfs.js
@@ -0,0 +1,35 @@
+// |reftest| module async
+// Copyright (C) 2020 Ecma International. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: Dynamic import can't preempt DFS evaluation order
+esid: sec-moduleevaluation
+info: |
+ Evaluate ( ) Concrete Method
+
+ 1. Assert: This call to Evaluate is not happening at the same time as another call to Evaluate within the surrounding agent.
+ [...]
+flags: [module, async]
+features: [dynamic-import]
+---*/
+
+import './verify-dfs-a_FIXTURE.js';
+import './verify-dfs-b_FIXTURE.js';
+
+// rely on function hoisting to create shared array
+export function evaluated(name) {
+ if (!evaluated.order) {
+ evaluated.order = [];
+ }
+ evaluated.order.push(name);
+}
+
+export function check(promise) {
+ promise.then(() => {
+ assert.sameValue(evaluated.order.length, 2);
+ assert.sameValue(evaluated.order[0], 'A');
+ assert.sameValue(evaluated.order[1], 'B');
+ })
+ .then($DONE, $DONE);
+}