summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/module-code/top-level-await/syntax
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
commit2aa4a82499d4becd2284cdb482213d541b8804dd (patch)
treeb80bf8bf13c3766139fbacc530efd0dd9d54394c /js/src/tests/test262/language/module-code/top-level-await/syntax
parentInitial commit. (diff)
downloadfirefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz
firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/language/module-code/top-level-await/syntax')
-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
213 files changed, 13243 insertions, 0 deletions
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..62f31a0ca0
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/await-expr-dyn-import.js
@@ -0,0 +1,44 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..6c6511153d
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..7b1b552d7f
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..457e9e5773
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-identifier.js
@@ -0,0 +1,80 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..9d563d1762
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..b458132790
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..ac738f97e0
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-nested.js
@@ -0,0 +1,75 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..97ab4364b9
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..f7da58eddc
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-null.js
@@ -0,0 +1,79 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..76ba70a084
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..270eb28ef1
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-regexp.js
@@ -0,0 +1,79 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..f14fb16588
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..8b64a84fff
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-this.js
@@ -0,0 +1,79 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..92d0e13026
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/catch-parameter.js
@@ -0,0 +1,47 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..822bdc4765
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) error:SyntaxError module -- requires shell-options
+// 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..2bfe9098db
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) error:SyntaxError module -- requires shell-options
+// 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..8cb5f4601d
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) error:SyntaxError module -- requires shell-options
+// 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..fbef8cfab6
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) error:SyntaxError module -- requires shell-options
+// 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..2caf665303
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/early-no-escaped-await.js
@@ -0,0 +1,26 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) error:SyntaxError module -- requires shell-options
+// 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..77b3bd0e85
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..340721e543
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..e201101947
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..7f114c6d66
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..ccd7de5b1f
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..d78d4a8f0b
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..c58c33fe96
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..85a40119a0
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..a721387d66
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..aaebbf7bb7
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..37617d67d3
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..84023b82a1
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..cf7c4ec24e
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..7d3564eedd
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..82f817e29f
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..d56c3d2eff
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..a8ca01a0ed
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..57d28a0dea
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..623fb4dc8f
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..80e9fc2160
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..fc06dea532
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..6ec034ed40
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..a2467e2845
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..4487c03631
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..29431ace74
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..20c4a661a8
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..97f6b1fdde
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..dc0248f1b4
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..088099355b
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..2ec9a79e4a
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..c67039960e
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..54974f37d5
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..377ab1ba2d
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..6edc947d3c
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..f2bf4a5435
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..72436f9c6d
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..76a2292585
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..406ad58465
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..df7de542fb
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..450b5c1c0f
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..a22a94de52
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..e02d8dfad9
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..72691f22b7
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..8f647d5481
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..5574049b8f
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..26bd84c697
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..f62342d893
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..69cffb98f4
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..12ffdf04f6
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..2955df9eb7
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..57bb65cf80
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..9aaa49dde6
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..b673f52261
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..37fa649545
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..7e57cf4013
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..bb2f761c55
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..a17b1da7e1
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..b1b72ed211
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..ced50dd3de
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..e9f573772e
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..f5c2dd8c74
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..af872a24a1
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..4cd9126f43
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..0107f298e3
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..a5549b9d73
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..5c531b2772
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..7014e990e5
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..93dac4b18d
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..69d90f4484
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..f7cd701168
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..fa4f3f9a8c
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..0d54cebba0
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..61b8350e4b
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..c30f6a27b1
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..bc22d5324a
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-identifier.js
@@ -0,0 +1,77 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..781d148dd3
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..03bc71c088
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..66cf0c82f8
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-nested.js
@@ -0,0 +1,72 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..fbaff486c0
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..ec57788c4c
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-null.js
@@ -0,0 +1,76 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..d8fc5cd55b
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..31a5fd3952
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-regexp.js
@@ -0,0 +1,76 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..e1361db77b
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..dcf11d606a
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-this.js
@@ -0,0 +1,76 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..f51b16477d
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..df63185843
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..c5799bb31b
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..50d0f4567f
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..7ee2ed4ab5
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..023f343516
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..552aef52c3
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..eb94d54533
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..f4dec100e8
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..9bc5bb13bc
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..15551dcf41
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..24560bccc5
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..3340658335
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..d8b3cc9cbb
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..c991fb8240
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..14db1f8679
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..417169c916
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..f7a6f1a6ca
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..fb91fff884
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..63487adcca
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..43d5e4572d
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..1f65846ebd
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..a9aae5c087
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..481f7bd96c
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..97a504d38a
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..2c6f96db00
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..dc3c12d48d
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..e487f1f54b
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..686c80dde0
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..c87aa0a286
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..e1f47bf561
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..1b47c99e77
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..abaf9ada86
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..50a0a7a960
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..2f4b1cdf16
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..a09fc5055c
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..dc0aa89dba
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..e7de1c5239
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..700591be6f
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..5ebd1215bc
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..497b374f47
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..cfc1a15c10
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..c5ad6a455d
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..45458f3d85
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..9195e4f500
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..329ba64716
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..e71e1ec14c
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..aebcf3060f
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..5816ae0ac4
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..f7d250385d
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..c5e5d55a18
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..bad2046a05
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..b028e3d023
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..a3d7c9e61b
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..cf1883c592
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..5d874c23b8
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..f87ce5a6b5
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..de93b53279
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..c64cf2b6d1
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..af1c9a613b
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..4d82f8a135
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..e08ca19bb6
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..072ddbdb08
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-identifier.js
@@ -0,0 +1,71 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..8e1627aebe
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..8a493f05b6
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..0eb8dbd39f
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-nested.js
@@ -0,0 +1,66 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..3f70273d17
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..94fafa6e40
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-null.js
@@ -0,0 +1,70 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..9b88864fd4
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..d6d3d9723d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-regexp.js
@@ -0,0 +1,70 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..c02ace77aa
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..ac4960596d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-this.js
@@ -0,0 +1,70 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..f886a5acdc
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..f9d07dab50
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..8e265a43ae
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-identifier.js
@@ -0,0 +1,47 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..0290f5e9d1
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..2ea0abc6aa
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..21e286cf97
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-nested.js
@@ -0,0 +1,42 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..353589d296
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..9c2b157b38
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-null.js
@@ -0,0 +1,46 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..574cb372d7
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..984e5b26c4
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-regexp.js
@@ -0,0 +1,46 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..125e3fbe12
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..8ae49ab87a
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-this.js
@@ -0,0 +1,46 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..d1125518b9
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..d01d3c4b71
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..dafdda387e
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-identifier.js
@@ -0,0 +1,47 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..9b7fe68681
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..c3d269387f
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..6823745686
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-nested.js
@@ -0,0 +1,42 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..c6017b6eb2
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..849cd76d8d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-null.js
@@ -0,0 +1,46 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..fea62fa5c6
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..540452120d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-regexp.js
@@ -0,0 +1,46 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..1f89fb7210
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..aab82b4198
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-this.js
@@ -0,0 +1,46 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..009672fbfb
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..7c7788b6a5
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..055c9ab664
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-identifier.js
@@ -0,0 +1,51 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..2d2e724f11
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..ff3c25e9e8
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..be70e74db2
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-nested.js
@@ -0,0 +1,46 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..3411b85e43
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..e78a1a967e
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-null.js
@@ -0,0 +1,50 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..aaf318c2d3
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..e628f66b84
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-regexp.js
@@ -0,0 +1,50 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..74080bbbb0
--- /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| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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..71b7679487
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-this.js
@@ -0,0 +1,50 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// 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);