summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/module-code/top-level-await
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/tests/test262/language/module-code/top-level-await
parentInitial commit. (diff)
downloadfirefox-esr-upstream.tar.xz
firefox-esr-upstream.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/language/module-code/top-level-await')
-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
257 files changed, 14999 insertions, 0 deletions
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();