summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/module-code/top-level-await/syntax
diff options
context:
space:
mode:
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..205e568b68
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/await-expr-dyn-import.js
@@ -0,0 +1,44 @@
+// |reftest| module
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Valid syntax for top level await.
+ AwaitExpression ImportCall
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ CallExpression[Yield, Await]:
+ ImportCall[?Yield, ?Await]
+
+ ImportCall[Yield, Await]:
+ import ( AssignmentExpression[+In, ?Yield, ?Await] )
+esid: prod-AwaitExpression
+flags: [module]
+features: [top-level-await, dynamic-import]
+---*/
+
+try {
+ await import('foo');
+} catch (e) {
+ // Ignore errors, we are just checking if the syntax is valid and
+ // we should not worry if a module was loaded.
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-array-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-array-literal.js
new file mode 100644
index 0000000000..9f97b36bbe
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-array-literal.js
@@ -0,0 +1,79 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-array-literal.case
+// - src/top-level-await/syntax/block.template
+/*---
+description: AwaitExpression ArrayLiteral (Valid syntax for top level await in a block.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+{
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ await [];
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-func-expression.js
new file mode 100644
index 0000000000..10ab1da5ba
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-func-expression.js
@@ -0,0 +1,85 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-func-expression.case
+// - src/top-level-await/syntax/block.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in a block.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+{
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ await function() {};
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-identifier.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-identifier.js
new file mode 100644
index 0000000000..ea6697b6c5
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-identifier.js
@@ -0,0 +1,80 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-identifier.case
+// - src/top-level-await/syntax/block.template
+/*---
+description: AwaitExpression IdentifierReference (Valid syntax for top level await in a block.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+var foo = 1;
+
+
+{
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ await foo;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-literal-number.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-literal-number.js
new file mode 100644
index 0000000000..1d008abbfc
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-literal-number.js
@@ -0,0 +1,79 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-number.case
+// - src/top-level-await/syntax/block.template
+/*---
+description: AwaitExpression NumberLiteral (Valid syntax for top level await in a block.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+{
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ await 1;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-literal-string.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-literal-string.js
new file mode 100644
index 0000000000..65afc2e366
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-literal-string.js
@@ -0,0 +1,79 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-string.case
+// - src/top-level-await/syntax/block.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in a block.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+{
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ await '';
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-nested.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-nested.js
new file mode 100644
index 0000000000..6a473db1ce
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-nested.js
@@ -0,0 +1,75 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-nested.case
+// - src/top-level-await/syntax/block.template
+/*---
+description: Nested AwaitExpressions (Valid syntax for top level await in a block.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+---*/
+
+
+{
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ await await await await await await await await await await await await await await await 'await';
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-new-expr.js
new file mode 100644
index 0000000000..b0e07b01c9
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-new-expr.js
@@ -0,0 +1,76 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-new-expr.case
+// - src/top-level-await/syntax/block.template
+/*---
+description: AwaitExpression new MemberExpression (Valid syntax for top level await in a block.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+---*/
+
+
+{
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ await new Promise(function(res, rej) { res(1); });
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-null.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-null.js
new file mode 100644
index 0000000000..4dd72047fa
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-null.js
@@ -0,0 +1,79 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-null.case
+// - src/top-level-await/syntax/block.template
+/*---
+description: AwaitExpression NullLiteral (Valid syntax for top level await in a block.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+{
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ await null;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-obj-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-obj-literal.js
new file mode 100644
index 0000000000..110a42006f
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-obj-literal.js
@@ -0,0 +1,79 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-obj-literal.case
+// - src/top-level-await/syntax/block.template
+/*---
+description: AwaitExpression ObjectLiteral (Valid syntax for top level await in a block.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+{
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ await { function() {} };
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-regexp.js
new file mode 100644
index 0000000000..2fcbeb6ca3
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-regexp.js
@@ -0,0 +1,79 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-regexp.case
+// - src/top-level-await/syntax/block.template
+/*---
+description: AwaitExpression RegularExpressionLiteral (Valid syntax for top level await in a block.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+{
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ await /1/;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-template-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-template-literal.js
new file mode 100644
index 0000000000..1839ea3fe0
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-template-literal.js
@@ -0,0 +1,79 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-template-literal.case
+// - src/top-level-await/syntax/block.template
+/*---
+description: AwaitExpression TemplateLiteral (Valid syntax for top level await in a block.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+{
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ await ``;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-this.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-this.js
new file mode 100644
index 0000000000..2851e707c8
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-this.js
@@ -0,0 +1,79 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-this.case
+// - src/top-level-await/syntax/block.template
+/*---
+description: AwaitExpression this (Valid syntax for top level await in a block.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+{
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ await this;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/browser.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/browser.js
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/catch-parameter.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/catch-parameter.js
new file mode 100644
index 0000000000..855d1199d7
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/catch-parameter.js
@@ -0,0 +1,47 @@
+// |reftest| module
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Valid syntax for top level await.
+ AwaitExpression ImportCall
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ Catch[Yield, Await, Return]:
+ catch(CatchParameter[?Yield, ?Await])Block[?Yield, ?Await, ?Return]
+ catchBlock[?Yield, ?Await, ?Return]
+
+ Finally[Yield, Await, Return]:
+ finallyBlock[?Yield, ?Await, ?Return]
+
+ CatchParameter[Yield, Await]:
+ BindingIdentifier[?Yield, ?Await]
+ BindingPattern[?Yield, ?Await]
+esid: prod-AwaitExpression
+flags: [module]
+features: [top-level-await, dynamic-import]
+---*/
+
+try {} catch ({ x = await 42 }) {} // Initializer
+try {} catch ({ x: y = await 42 }) {} // BindingElement Initializer
+try {} catch ([ x = await 42 ]) {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/early-does-not-propagate-to-fn-declaration-body.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/early-does-not-propagate-to-fn-declaration-body.js
new file mode 100644
index 0000000000..70db9d1ed7
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/early-does-not-propagate-to-fn-declaration-body.js
@@ -0,0 +1,39 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ The Await capability does not propagate to the body of a function declaration
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ StatementListItem[Yield, Await, Return]:
+ Statement[?Yield, ?Await, ?Return]
+ Declaration[?Yield, ?Await]
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ HoistableDeclaration[Yield, Await, Default]:
+ FunctionDeclaration[?Yield, ?Await, ?Default]
+ GeneratorDeclaration[?Yield, ?Await, ?Default]
+ AsyncFunctionDeclaration[?Yield, ?Await, ?Default]
+ AsyncGeneratorDeclaration[?Yield, ?Await, ?Default]
+
+ FunctionDeclaration[Yield, Await, Default]:
+ function BindingIdentifier[?Yield, ?Await] ( FormalParameters[~Yield, ~Await] ) { FunctionBody[~Yield, ~Await] }
+negative:
+ phase: parse
+ type: SyntaxError
+esid: prod-ModuleItem
+flags: [module]
+features: [top-level-await]
+---*/
+
+$DONOTEVALUATE();
+
+function fn() { await 0; }
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/early-does-not-propagate-to-fn-declaration-params.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/early-does-not-propagate-to-fn-declaration-params.js
new file mode 100644
index 0000000000..ed59aabea1
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/early-does-not-propagate-to-fn-declaration-params.js
@@ -0,0 +1,41 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ The Await capability does not propagate to the parameters of a function declaration
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ StatementListItem[Yield, Await, Return]:
+ Statement[?Yield, ?Await, ?Return]
+ Declaration[?Yield, ?Await]
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ HoistableDeclaration[Yield, Await, Default]:
+ FunctionDeclaration[?Yield, ?Await, ?Default]
+ GeneratorDeclaration[?Yield, ?Await, ?Default]
+ AsyncFunctionDeclaration[?Yield, ?Await, ?Default]
+ AsyncGeneratorDeclaration[?Yield, ?Await, ?Default]
+
+ FunctionDeclaration[Yield, Await, Default]:
+ function BindingIdentifier[?Yield, ?Await] ( FormalParameters[~Yield, ~Await] ) { FunctionBody[~Yield, ~Await] }
+negative:
+ phase: parse
+ type: SyntaxError
+esid: prod-ModuleItem
+flags: [module]
+features: [top-level-await]
+---*/
+
+$DONOTEVALUATE();
+
+function fn(x = await 1) {
+ return x;
+}
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/early-does-not-propagate-to-fn-expr-body.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/early-does-not-propagate-to-fn-expr-body.js
new file mode 100644
index 0000000000..fd6d58a99f
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/early-does-not-propagate-to-fn-expr-body.js
@@ -0,0 +1,31 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ The Await capability does not propagate to the body of a function expression
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ StatementListItem[Yield, Await, Return]:
+ Statement[?Yield, ?Await, ?Return]
+ Declaration[?Yield, ?Await]
+
+ FunctionExpression:
+ function BindingIdentifier[~Yield, ~Await]_opt ( FormalParameters[~Yield, ~Await] )
+ { FunctionBody[~Yield, ~Await] }
+negative:
+ phase: parse
+ type: SyntaxError
+esid: prod-ModuleItem
+flags: [module]
+features: [top-level-await]
+---*/
+
+$DONOTEVALUATE();
+
+0, function () {
+ await 1;
+};
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/early-does-not-propagate-to-fn-expr-params.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/early-does-not-propagate-to-fn-expr-params.js
new file mode 100644
index 0000000000..a7b46e3dae
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/early-does-not-propagate-to-fn-expr-params.js
@@ -0,0 +1,31 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ The Await capability does not propagate to the parameters of a function expression
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ StatementListItem[Yield, Await, Return]:
+ Statement[?Yield, ?Await, ?Return]
+ Declaration[?Yield, ?Await]
+
+ FunctionExpression:
+ function BindingIdentifier[~Yield, ~Await]_opt ( FormalParameters[~Yield, ~Await] )
+ { FunctionBody[~Yield, ~Await] }
+negative:
+ phase: parse
+ type: SyntaxError
+esid: prod-ModuleItem
+flags: [module]
+features: [top-level-await]
+---*/
+
+$DONOTEVALUATE();
+
+0, function (x = await 1) {
+ return x;
+};
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/early-no-escaped-await.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/early-no-escaped-await.js
new file mode 100644
index 0000000000..b9a733198b
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/early-no-escaped-await.js
@@ -0,0 +1,26 @@
+// |reftest| error:SyntaxError module
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ The await keyword can't be escaped
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+negative:
+ phase: parse
+ type: SyntaxError
+esid: prod-ModuleItem
+flags: [module]
+features: [top-level-await]
+---*/
+
+$DONOTEVALUATE();
+
+\u0061wait 0;
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-array-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-array-literal.js
new file mode 100644
index 0000000000..0887badb54
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-array-literal.js
@@ -0,0 +1,71 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-array-literal.case
+// - src/top-level-await/syntax/export-class-decl.template
+/*---
+description: AwaitExpression ArrayLiteral (Valid syntax for top level await in export ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export class C extends fn(await []) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-func-expression.js
new file mode 100644
index 0000000000..d537ffeea1
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-func-expression.js
@@ -0,0 +1,77 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-func-expression.case
+// - src/top-level-await/syntax/export-class-decl.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in export ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export class C extends fn(await function() {}) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-identifier.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-identifier.js
new file mode 100644
index 0000000000..3d589f977f
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-identifier.js
@@ -0,0 +1,72 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-identifier.case
+// - src/top-level-await/syntax/export-class-decl.template
+/*---
+description: AwaitExpression IdentifierReference (Valid syntax for top level await in export ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+var foo = 1;
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export class C extends fn(await foo) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-literal-number.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-literal-number.js
new file mode 100644
index 0000000000..1649f423cc
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-literal-number.js
@@ -0,0 +1,71 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-number.case
+// - src/top-level-await/syntax/export-class-decl.template
+/*---
+description: AwaitExpression NumberLiteral (Valid syntax for top level await in export ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export class C extends fn(await 1) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-literal-string.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-literal-string.js
new file mode 100644
index 0000000000..bce09cf412
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-literal-string.js
@@ -0,0 +1,71 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-string.case
+// - src/top-level-await/syntax/export-class-decl.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in export ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export class C extends fn(await '') {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-nested.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-nested.js
new file mode 100644
index 0000000000..3ee6da673e
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-nested.js
@@ -0,0 +1,67 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-nested.case
+// - src/top-level-await/syntax/export-class-decl.template
+/*---
+description: Nested AwaitExpressions (Valid syntax for top level await in export ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export class C extends fn(await await await await await await await await await await await await await await await 'await') {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-new-expr.js
new file mode 100644
index 0000000000..4e35f88d38
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-new-expr.js
@@ -0,0 +1,68 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-new-expr.case
+// - src/top-level-await/syntax/export-class-decl.template
+/*---
+description: AwaitExpression new MemberExpression (Valid syntax for top level await in export ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export class C extends fn(await new Promise(function(res, rej) { res(1); })) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-null.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-null.js
new file mode 100644
index 0000000000..928afce300
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-null.js
@@ -0,0 +1,71 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-null.case
+// - src/top-level-await/syntax/export-class-decl.template
+/*---
+description: AwaitExpression NullLiteral (Valid syntax for top level await in export ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export class C extends fn(await null) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-obj-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-obj-literal.js
new file mode 100644
index 0000000000..90b2ccc6f6
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-obj-literal.js
@@ -0,0 +1,71 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-obj-literal.case
+// - src/top-level-await/syntax/export-class-decl.template
+/*---
+description: AwaitExpression ObjectLiteral (Valid syntax for top level await in export ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export class C extends fn(await { function() {} }) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-regexp.js
new file mode 100644
index 0000000000..af0466bdbc
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-regexp.js
@@ -0,0 +1,71 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-regexp.case
+// - src/top-level-await/syntax/export-class-decl.template
+/*---
+description: AwaitExpression RegularExpressionLiteral (Valid syntax for top level await in export ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export class C extends fn(await /1/) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-template-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-template-literal.js
new file mode 100644
index 0000000000..7b088080fc
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-template-literal.js
@@ -0,0 +1,71 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-template-literal.case
+// - src/top-level-await/syntax/export-class-decl.template
+/*---
+description: AwaitExpression TemplateLiteral (Valid syntax for top level await in export ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export class C extends fn(await ``) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-this.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-this.js
new file mode 100644
index 0000000000..f7608382a9
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-this.js
@@ -0,0 +1,71 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-this.case
+// - src/top-level-await/syntax/export-class-decl.template
+/*---
+description: AwaitExpression this (Valid syntax for top level await in export ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export class C extends fn(await this) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-array-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-array-literal.js
new file mode 100644
index 0000000000..98a8debc1b
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-array-literal.js
@@ -0,0 +1,67 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-array-literal.case
+// - src/top-level-await/syntax/export-dflt-assign-expr.template
+/*---
+description: AwaitExpression ArrayLiteral (Valid syntax for top level await in export default AssignmentExpression)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default [lookahead ∉ { function, async [no LineTerminator here] function, class }] AssignmentExpression [+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export default await [];
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-func-expression.js
new file mode 100644
index 0000000000..ae0939f26d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-func-expression.js
@@ -0,0 +1,73 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-func-expression.case
+// - src/top-level-await/syntax/export-dflt-assign-expr.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in export default AssignmentExpression)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default [lookahead ∉ { function, async [no LineTerminator here] function, class }] AssignmentExpression [+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export default await function() {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-identifier.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-identifier.js
new file mode 100644
index 0000000000..2bbd3c5896
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-identifier.js
@@ -0,0 +1,68 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-identifier.case
+// - src/top-level-await/syntax/export-dflt-assign-expr.template
+/*---
+description: AwaitExpression IdentifierReference (Valid syntax for top level await in export default AssignmentExpression)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default [lookahead ∉ { function, async [no LineTerminator here] function, class }] AssignmentExpression [+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+var foo = 1;
+
+
+export default await foo;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-literal-number.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-literal-number.js
new file mode 100644
index 0000000000..ab222ff08b
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-literal-number.js
@@ -0,0 +1,67 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-number.case
+// - src/top-level-await/syntax/export-dflt-assign-expr.template
+/*---
+description: AwaitExpression NumberLiteral (Valid syntax for top level await in export default AssignmentExpression)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default [lookahead ∉ { function, async [no LineTerminator here] function, class }] AssignmentExpression [+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export default await 1;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-literal-string.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-literal-string.js
new file mode 100644
index 0000000000..3fdbd1af01
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-literal-string.js
@@ -0,0 +1,67 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-string.case
+// - src/top-level-await/syntax/export-dflt-assign-expr.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in export default AssignmentExpression)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default [lookahead ∉ { function, async [no LineTerminator here] function, class }] AssignmentExpression [+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export default await '';
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-nested.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-nested.js
new file mode 100644
index 0000000000..c1153bd3f6
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-nested.js
@@ -0,0 +1,63 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-nested.case
+// - src/top-level-await/syntax/export-dflt-assign-expr.template
+/*---
+description: Nested AwaitExpressions (Valid syntax for top level await in export default AssignmentExpression)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default [lookahead ∉ { function, async [no LineTerminator here] function, class }] AssignmentExpression [+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+---*/
+
+
+export default await await await await await await await await await await await await await await await 'await';
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-new-expr.js
new file mode 100644
index 0000000000..8615527fd0
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-new-expr.js
@@ -0,0 +1,64 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-new-expr.case
+// - src/top-level-await/syntax/export-dflt-assign-expr.template
+/*---
+description: AwaitExpression new MemberExpression (Valid syntax for top level await in export default AssignmentExpression)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default [lookahead ∉ { function, async [no LineTerminator here] function, class }] AssignmentExpression [+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+---*/
+
+
+export default await new Promise(function(res, rej) { res(1); });
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-null.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-null.js
new file mode 100644
index 0000000000..bcbb845782
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-null.js
@@ -0,0 +1,67 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-null.case
+// - src/top-level-await/syntax/export-dflt-assign-expr.template
+/*---
+description: AwaitExpression NullLiteral (Valid syntax for top level await in export default AssignmentExpression)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default [lookahead ∉ { function, async [no LineTerminator here] function, class }] AssignmentExpression [+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export default await null;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-obj-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-obj-literal.js
new file mode 100644
index 0000000000..1095d8591f
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-obj-literal.js
@@ -0,0 +1,67 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-obj-literal.case
+// - src/top-level-await/syntax/export-dflt-assign-expr.template
+/*---
+description: AwaitExpression ObjectLiteral (Valid syntax for top level await in export default AssignmentExpression)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default [lookahead ∉ { function, async [no LineTerminator here] function, class }] AssignmentExpression [+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export default await { function() {} };
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-regexp.js
new file mode 100644
index 0000000000..3a1c490565
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-regexp.js
@@ -0,0 +1,67 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-regexp.case
+// - src/top-level-await/syntax/export-dflt-assign-expr.template
+/*---
+description: AwaitExpression RegularExpressionLiteral (Valid syntax for top level await in export default AssignmentExpression)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default [lookahead ∉ { function, async [no LineTerminator here] function, class }] AssignmentExpression [+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export default await /1/;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-template-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-template-literal.js
new file mode 100644
index 0000000000..dbd25378cb
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-template-literal.js
@@ -0,0 +1,67 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-template-literal.case
+// - src/top-level-await/syntax/export-dflt-assign-expr.template
+/*---
+description: AwaitExpression TemplateLiteral (Valid syntax for top level await in export default AssignmentExpression)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default [lookahead ∉ { function, async [no LineTerminator here] function, class }] AssignmentExpression [+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export default await ``;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-this.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-this.js
new file mode 100644
index 0000000000..6213f8352c
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-this.js
@@ -0,0 +1,67 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-this.case
+// - src/top-level-await/syntax/export-dflt-assign-expr.template
+/*---
+description: AwaitExpression this (Valid syntax for top level await in export default AssignmentExpression)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default [lookahead ∉ { function, async [no LineTerminator here] function, class }] AssignmentExpression [+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export default await this;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-array-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-array-literal.js
new file mode 100644
index 0000000000..f96d40f644
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-array-literal.js
@@ -0,0 +1,71 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-array-literal.case
+// - src/top-level-await/syntax/export-dflt-class-decl.template
+/*---
+description: AwaitExpression ArrayLiteral (Valid syntax for top level await in export default ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export default class extends fn(await []) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-func-expression.js
new file mode 100644
index 0000000000..7fa06f4c42
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-func-expression.js
@@ -0,0 +1,77 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-func-expression.case
+// - src/top-level-await/syntax/export-dflt-class-decl.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in export default ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export default class extends fn(await function() {}) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-identifier.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-identifier.js
new file mode 100644
index 0000000000..0c6291a762
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-identifier.js
@@ -0,0 +1,72 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-identifier.case
+// - src/top-level-await/syntax/export-dflt-class-decl.template
+/*---
+description: AwaitExpression IdentifierReference (Valid syntax for top level await in export default ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+var foo = 1;
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export default class extends fn(await foo) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-literal-number.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-literal-number.js
new file mode 100644
index 0000000000..e44240b3f5
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-literal-number.js
@@ -0,0 +1,71 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-number.case
+// - src/top-level-await/syntax/export-dflt-class-decl.template
+/*---
+description: AwaitExpression NumberLiteral (Valid syntax for top level await in export default ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export default class extends fn(await 1) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-literal-string.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-literal-string.js
new file mode 100644
index 0000000000..47c0ed7119
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-literal-string.js
@@ -0,0 +1,71 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-string.case
+// - src/top-level-await/syntax/export-dflt-class-decl.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in export default ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export default class extends fn(await '') {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-nested.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-nested.js
new file mode 100644
index 0000000000..9177084508
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-nested.js
@@ -0,0 +1,67 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-nested.case
+// - src/top-level-await/syntax/export-dflt-class-decl.template
+/*---
+description: Nested AwaitExpressions (Valid syntax for top level await in export default ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export default class extends fn(await await await await await await await await await await await await await await await 'await') {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-new-expr.js
new file mode 100644
index 0000000000..b1c185140f
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-new-expr.js
@@ -0,0 +1,68 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-new-expr.case
+// - src/top-level-await/syntax/export-dflt-class-decl.template
+/*---
+description: AwaitExpression new MemberExpression (Valid syntax for top level await in export default ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export default class extends fn(await new Promise(function(res, rej) { res(1); })) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-null.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-null.js
new file mode 100644
index 0000000000..1238b239ae
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-null.js
@@ -0,0 +1,71 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-null.case
+// - src/top-level-await/syntax/export-dflt-class-decl.template
+/*---
+description: AwaitExpression NullLiteral (Valid syntax for top level await in export default ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export default class extends fn(await null) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-obj-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-obj-literal.js
new file mode 100644
index 0000000000..a150838ec3
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-obj-literal.js
@@ -0,0 +1,71 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-obj-literal.case
+// - src/top-level-await/syntax/export-dflt-class-decl.template
+/*---
+description: AwaitExpression ObjectLiteral (Valid syntax for top level await in export default ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export default class extends fn(await { function() {} }) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-regexp.js
new file mode 100644
index 0000000000..e55bf5eb1a
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-regexp.js
@@ -0,0 +1,71 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-regexp.case
+// - src/top-level-await/syntax/export-dflt-class-decl.template
+/*---
+description: AwaitExpression RegularExpressionLiteral (Valid syntax for top level await in export default ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export default class extends fn(await /1/) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-template-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-template-literal.js
new file mode 100644
index 0000000000..b5e2fdc2bf
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-template-literal.js
@@ -0,0 +1,71 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-template-literal.case
+// - src/top-level-await/syntax/export-dflt-class-decl.template
+/*---
+description: AwaitExpression TemplateLiteral (Valid syntax for top level await in export default ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export default class extends fn(await ``) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-this.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-this.js
new file mode 100644
index 0000000000..48bad9a85b
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-this.js
@@ -0,0 +1,71 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-this.case
+// - src/top-level-await/syntax/export-dflt-class-decl.template
+/*---
+description: AwaitExpression this (Valid syntax for top level await in export default ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export default class extends fn(await this) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-array-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-array-literal.js
new file mode 100644
index 0000000000..c40d5836a9
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-array-literal.js
@@ -0,0 +1,64 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-array-literal.case
+// - src/top-level-await/syntax/export-lex-declaration.template
+/*---
+description: AwaitExpression ArrayLiteral (Valid syntax for top level await in export LexicalDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ LexicalDeclaration[In, Yield, Await]:
+ LetOrConstBindingList[?In, ?Yield, ?Await];
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export let x = await [];
+export const y = await [];
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-func-expression.js
new file mode 100644
index 0000000000..0840230395
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-func-expression.js
@@ -0,0 +1,70 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-func-expression.case
+// - src/top-level-await/syntax/export-lex-declaration.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in export LexicalDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ LexicalDeclaration[In, Yield, Await]:
+ LetOrConstBindingList[?In, ?Yield, ?Await];
+
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export let x = await function() {};
+export const y = await function() {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-identifier.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-identifier.js
new file mode 100644
index 0000000000..f0a13b6a02
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-identifier.js
@@ -0,0 +1,65 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-identifier.case
+// - src/top-level-await/syntax/export-lex-declaration.template
+/*---
+description: AwaitExpression IdentifierReference (Valid syntax for top level await in export LexicalDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ LexicalDeclaration[In, Yield, Await]:
+ LetOrConstBindingList[?In, ?Yield, ?Await];
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+var foo = 1;
+
+
+export let x = await foo;
+export const y = await foo;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-literal-number.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-literal-number.js
new file mode 100644
index 0000000000..3f2bc85b30
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-literal-number.js
@@ -0,0 +1,64 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-number.case
+// - src/top-level-await/syntax/export-lex-declaration.template
+/*---
+description: AwaitExpression NumberLiteral (Valid syntax for top level await in export LexicalDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ LexicalDeclaration[In, Yield, Await]:
+ LetOrConstBindingList[?In, ?Yield, ?Await];
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export let x = await 1;
+export const y = await 1;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-literal-string.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-literal-string.js
new file mode 100644
index 0000000000..ad68d4fef4
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-literal-string.js
@@ -0,0 +1,64 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-string.case
+// - src/top-level-await/syntax/export-lex-declaration.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in export LexicalDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ LexicalDeclaration[In, Yield, Await]:
+ LetOrConstBindingList[?In, ?Yield, ?Await];
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export let x = await '';
+export const y = await '';
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-nested.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-nested.js
new file mode 100644
index 0000000000..40cef7606e
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-nested.js
@@ -0,0 +1,60 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-nested.case
+// - src/top-level-await/syntax/export-lex-declaration.template
+/*---
+description: Nested AwaitExpressions (Valid syntax for top level await in export LexicalDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ LexicalDeclaration[In, Yield, Await]:
+ LetOrConstBindingList[?In, ?Yield, ?Await];
+
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+---*/
+
+
+export let x = await await await await await await await await await await await await await await await 'await';
+export const y = await await await await await await await await await await await await await await await 'await';
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-new-expr.js
new file mode 100644
index 0000000000..8e541d3ecd
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-new-expr.js
@@ -0,0 +1,61 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-new-expr.case
+// - src/top-level-await/syntax/export-lex-declaration.template
+/*---
+description: AwaitExpression new MemberExpression (Valid syntax for top level await in export LexicalDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ LexicalDeclaration[In, Yield, Await]:
+ LetOrConstBindingList[?In, ?Yield, ?Await];
+
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+---*/
+
+
+export let x = await new Promise(function(res, rej) { res(1); });
+export const y = await new Promise(function(res, rej) { res(1); });
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-null.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-null.js
new file mode 100644
index 0000000000..d3f2721cf6
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-null.js
@@ -0,0 +1,64 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-null.case
+// - src/top-level-await/syntax/export-lex-declaration.template
+/*---
+description: AwaitExpression NullLiteral (Valid syntax for top level await in export LexicalDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ LexicalDeclaration[In, Yield, Await]:
+ LetOrConstBindingList[?In, ?Yield, ?Await];
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export let x = await null;
+export const y = await null;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-obj-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-obj-literal.js
new file mode 100644
index 0000000000..85f992cb82
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-obj-literal.js
@@ -0,0 +1,64 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-obj-literal.case
+// - src/top-level-await/syntax/export-lex-declaration.template
+/*---
+description: AwaitExpression ObjectLiteral (Valid syntax for top level await in export LexicalDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ LexicalDeclaration[In, Yield, Await]:
+ LetOrConstBindingList[?In, ?Yield, ?Await];
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export let x = await { function() {} };
+export const y = await { function() {} };
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-regexp.js
new file mode 100644
index 0000000000..bfa7acd2f9
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-regexp.js
@@ -0,0 +1,64 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-regexp.case
+// - src/top-level-await/syntax/export-lex-declaration.template
+/*---
+description: AwaitExpression RegularExpressionLiteral (Valid syntax for top level await in export LexicalDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ LexicalDeclaration[In, Yield, Await]:
+ LetOrConstBindingList[?In, ?Yield, ?Await];
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export let x = await /1/;
+export const y = await /1/;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-template-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-template-literal.js
new file mode 100644
index 0000000000..9f0e217c10
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-template-literal.js
@@ -0,0 +1,64 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-template-literal.case
+// - src/top-level-await/syntax/export-lex-declaration.template
+/*---
+description: AwaitExpression TemplateLiteral (Valid syntax for top level await in export LexicalDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ LexicalDeclaration[In, Yield, Await]:
+ LetOrConstBindingList[?In, ?Yield, ?Await];
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export let x = await ``;
+export const y = await ``;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-this.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-this.js
new file mode 100644
index 0000000000..b0da185029
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-this.js
@@ -0,0 +1,64 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-this.case
+// - src/top-level-await/syntax/export-lex-declaration.template
+/*---
+description: AwaitExpression this (Valid syntax for top level await in export LexicalDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ LexicalDeclaration[In, Yield, Await]:
+ LetOrConstBindingList[?In, ?Yield, ?Await];
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export let x = await this;
+export const y = await this;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-array-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-array-literal.js
new file mode 100644
index 0000000000..ced0f70e5f
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-array-literal.js
@@ -0,0 +1,67 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-array-literal.case
+// - src/top-level-await/syntax/export-var-init.template
+/*---
+description: AwaitExpression ArrayLiteral (Valid syntax for top level await in export var BindingIdentifier Await_initializer)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ VariableStatement[Yield, Await]:
+ var VariableDeclarationList[+In, ?Yield, ?Await];
+
+ VariableDeclarationList[In, Yield, Await]:
+ VariableDeclaration[?In, ?Yield, ?Await]
+ VariableDeclarationList[?In, ?Yield, ?Await] , VariableDeclaration[?In, ?Yield, ?Await]
+
+ VariableDeclaration[In, Yield, Await]:
+ BindingIdentifier[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]opt
+ BindingPattern[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export var name1 = await [];
+export var { x = await [] } = {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-func-expression.js
new file mode 100644
index 0000000000..571b357815
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-func-expression.js
@@ -0,0 +1,73 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-func-expression.case
+// - src/top-level-await/syntax/export-var-init.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in export var BindingIdentifier Await_initializer)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ VariableStatement[Yield, Await]:
+ var VariableDeclarationList[+In, ?Yield, ?Await];
+
+ VariableDeclarationList[In, Yield, Await]:
+ VariableDeclaration[?In, ?Yield, ?Await]
+ VariableDeclarationList[?In, ?Yield, ?Await] , VariableDeclaration[?In, ?Yield, ?Await]
+
+ VariableDeclaration[In, Yield, Await]:
+ BindingIdentifier[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]opt
+ BindingPattern[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]
+
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export var name1 = await function() {};
+export var { x = await function() {} } = {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-identifier.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-identifier.js
new file mode 100644
index 0000000000..98c5c87f43
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-identifier.js
@@ -0,0 +1,68 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-identifier.case
+// - src/top-level-await/syntax/export-var-init.template
+/*---
+description: AwaitExpression IdentifierReference (Valid syntax for top level await in export var BindingIdentifier Await_initializer)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ VariableStatement[Yield, Await]:
+ var VariableDeclarationList[+In, ?Yield, ?Await];
+
+ VariableDeclarationList[In, Yield, Await]:
+ VariableDeclaration[?In, ?Yield, ?Await]
+ VariableDeclarationList[?In, ?Yield, ?Await] , VariableDeclaration[?In, ?Yield, ?Await]
+
+ VariableDeclaration[In, Yield, Await]:
+ BindingIdentifier[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]opt
+ BindingPattern[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+var foo = 1;
+
+
+export var name1 = await foo;
+export var { x = await foo } = {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-literal-number.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-literal-number.js
new file mode 100644
index 0000000000..2e8a4d28f1
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-literal-number.js
@@ -0,0 +1,67 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-number.case
+// - src/top-level-await/syntax/export-var-init.template
+/*---
+description: AwaitExpression NumberLiteral (Valid syntax for top level await in export var BindingIdentifier Await_initializer)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ VariableStatement[Yield, Await]:
+ var VariableDeclarationList[+In, ?Yield, ?Await];
+
+ VariableDeclarationList[In, Yield, Await]:
+ VariableDeclaration[?In, ?Yield, ?Await]
+ VariableDeclarationList[?In, ?Yield, ?Await] , VariableDeclaration[?In, ?Yield, ?Await]
+
+ VariableDeclaration[In, Yield, Await]:
+ BindingIdentifier[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]opt
+ BindingPattern[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export var name1 = await 1;
+export var { x = await 1 } = {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-literal-string.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-literal-string.js
new file mode 100644
index 0000000000..ae48211128
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-literal-string.js
@@ -0,0 +1,67 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-string.case
+// - src/top-level-await/syntax/export-var-init.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in export var BindingIdentifier Await_initializer)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ VariableStatement[Yield, Await]:
+ var VariableDeclarationList[+In, ?Yield, ?Await];
+
+ VariableDeclarationList[In, Yield, Await]:
+ VariableDeclaration[?In, ?Yield, ?Await]
+ VariableDeclarationList[?In, ?Yield, ?Await] , VariableDeclaration[?In, ?Yield, ?Await]
+
+ VariableDeclaration[In, Yield, Await]:
+ BindingIdentifier[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]opt
+ BindingPattern[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export var name1 = await '';
+export var { x = await '' } = {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-nested.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-nested.js
new file mode 100644
index 0000000000..144d8314c5
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-nested.js
@@ -0,0 +1,63 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-nested.case
+// - src/top-level-await/syntax/export-var-init.template
+/*---
+description: Nested AwaitExpressions (Valid syntax for top level await in export var BindingIdentifier Await_initializer)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ VariableStatement[Yield, Await]:
+ var VariableDeclarationList[+In, ?Yield, ?Await];
+
+ VariableDeclarationList[In, Yield, Await]:
+ VariableDeclaration[?In, ?Yield, ?Await]
+ VariableDeclarationList[?In, ?Yield, ?Await] , VariableDeclaration[?In, ?Yield, ?Await]
+
+ VariableDeclaration[In, Yield, Await]:
+ BindingIdentifier[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]opt
+ BindingPattern[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]
+
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+---*/
+
+
+export var name1 = await await await await await await await await await await await await await await await 'await';
+export var { x = await await await await await await await await await await await await await await await 'await' } = {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-new-expr.js
new file mode 100644
index 0000000000..25d007addb
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-new-expr.js
@@ -0,0 +1,64 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-new-expr.case
+// - src/top-level-await/syntax/export-var-init.template
+/*---
+description: AwaitExpression new MemberExpression (Valid syntax for top level await in export var BindingIdentifier Await_initializer)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ VariableStatement[Yield, Await]:
+ var VariableDeclarationList[+In, ?Yield, ?Await];
+
+ VariableDeclarationList[In, Yield, Await]:
+ VariableDeclaration[?In, ?Yield, ?Await]
+ VariableDeclarationList[?In, ?Yield, ?Await] , VariableDeclaration[?In, ?Yield, ?Await]
+
+ VariableDeclaration[In, Yield, Await]:
+ BindingIdentifier[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]opt
+ BindingPattern[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]
+
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+---*/
+
+
+export var name1 = await new Promise(function(res, rej) { res(1); });
+export var { x = await new Promise(function(res, rej) { res(1); }) } = {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-null.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-null.js
new file mode 100644
index 0000000000..5b250b9f7a
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-null.js
@@ -0,0 +1,67 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-null.case
+// - src/top-level-await/syntax/export-var-init.template
+/*---
+description: AwaitExpression NullLiteral (Valid syntax for top level await in export var BindingIdentifier Await_initializer)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ VariableStatement[Yield, Await]:
+ var VariableDeclarationList[+In, ?Yield, ?Await];
+
+ VariableDeclarationList[In, Yield, Await]:
+ VariableDeclaration[?In, ?Yield, ?Await]
+ VariableDeclarationList[?In, ?Yield, ?Await] , VariableDeclaration[?In, ?Yield, ?Await]
+
+ VariableDeclaration[In, Yield, Await]:
+ BindingIdentifier[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]opt
+ BindingPattern[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export var name1 = await null;
+export var { x = await null } = {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-obj-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-obj-literal.js
new file mode 100644
index 0000000000..7ec7d4925b
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-obj-literal.js
@@ -0,0 +1,67 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-obj-literal.case
+// - src/top-level-await/syntax/export-var-init.template
+/*---
+description: AwaitExpression ObjectLiteral (Valid syntax for top level await in export var BindingIdentifier Await_initializer)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ VariableStatement[Yield, Await]:
+ var VariableDeclarationList[+In, ?Yield, ?Await];
+
+ VariableDeclarationList[In, Yield, Await]:
+ VariableDeclaration[?In, ?Yield, ?Await]
+ VariableDeclarationList[?In, ?Yield, ?Await] , VariableDeclaration[?In, ?Yield, ?Await]
+
+ VariableDeclaration[In, Yield, Await]:
+ BindingIdentifier[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]opt
+ BindingPattern[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export var name1 = await { function() {} };
+export var { x = await { function() {} } } = {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-regexp.js
new file mode 100644
index 0000000000..6ff3d71587
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-regexp.js
@@ -0,0 +1,67 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-regexp.case
+// - src/top-level-await/syntax/export-var-init.template
+/*---
+description: AwaitExpression RegularExpressionLiteral (Valid syntax for top level await in export var BindingIdentifier Await_initializer)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ VariableStatement[Yield, Await]:
+ var VariableDeclarationList[+In, ?Yield, ?Await];
+
+ VariableDeclarationList[In, Yield, Await]:
+ VariableDeclaration[?In, ?Yield, ?Await]
+ VariableDeclarationList[?In, ?Yield, ?Await] , VariableDeclaration[?In, ?Yield, ?Await]
+
+ VariableDeclaration[In, Yield, Await]:
+ BindingIdentifier[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]opt
+ BindingPattern[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export var name1 = await /1/;
+export var { x = await /1/ } = {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-template-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-template-literal.js
new file mode 100644
index 0000000000..62a8ce6c16
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-template-literal.js
@@ -0,0 +1,67 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-template-literal.case
+// - src/top-level-await/syntax/export-var-init.template
+/*---
+description: AwaitExpression TemplateLiteral (Valid syntax for top level await in export var BindingIdentifier Await_initializer)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ VariableStatement[Yield, Await]:
+ var VariableDeclarationList[+In, ?Yield, ?Await];
+
+ VariableDeclarationList[In, Yield, Await]:
+ VariableDeclaration[?In, ?Yield, ?Await]
+ VariableDeclarationList[?In, ?Yield, ?Await] , VariableDeclaration[?In, ?Yield, ?Await]
+
+ VariableDeclaration[In, Yield, Await]:
+ BindingIdentifier[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]opt
+ BindingPattern[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export var name1 = await ``;
+export var { x = await `` } = {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-this.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-this.js
new file mode 100644
index 0000000000..3ba66281f9
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-this.js
@@ -0,0 +1,67 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-this.case
+// - src/top-level-await/syntax/export-var-init.template
+/*---
+description: AwaitExpression this (Valid syntax for top level await in export var BindingIdentifier Await_initializer)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ VariableStatement[Yield, Await]:
+ var VariableDeclarationList[+In, ?Yield, ?Await];
+
+ VariableDeclarationList[In, Yield, Await]:
+ VariableDeclaration[?In, ?Yield, ?Await]
+ VariableDeclarationList[?In, ?Yield, ?Await] , VariableDeclaration[?In, ?Yield, ?Await]
+
+ VariableDeclaration[In, Yield, Await]:
+ BindingIdentifier[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]opt
+ BindingPattern[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export var name1 = await this;
+export var { x = await this } = {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-array-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-array-literal.js
new file mode 100644
index 0000000000..4bec9be34a
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-array-literal.js
@@ -0,0 +1,70 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-array-literal.case
+// - src/top-level-await/syntax/for-await-expr.template
+/*---
+description: AwaitExpression ArrayLiteral (Valid syntax for top level await in for await statements.)
+esid: prod-AwaitExpression
+features: [top-level-await, async-iteration]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (binding of [await []]) {
+ await [];
+ break;
+}
+
+// [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (var binding of [await []]) {
+ await [];
+ break;
+}
+
+// [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (let binding of [await []]) {
+ await [];
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-func-expression.js
new file mode 100644
index 0000000000..69b81d8eb7
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-func-expression.js
@@ -0,0 +1,76 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-func-expression.case
+// - src/top-level-await/syntax/for-await-expr.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in for await statements.)
+esid: prod-AwaitExpression
+features: [top-level-await, async-iteration]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (binding of [await function() {}]) {
+ await function() {};
+ break;
+}
+
+// [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (var binding of [await function() {}]) {
+ await function() {};
+ break;
+}
+
+// [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (let binding of [await function() {}]) {
+ await function() {};
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-identifier.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-identifier.js
new file mode 100644
index 0000000000..f0e22cedb6
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-identifier.js
@@ -0,0 +1,71 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-identifier.case
+// - src/top-level-await/syntax/for-await-expr.template
+/*---
+description: AwaitExpression IdentifierReference (Valid syntax for top level await in for await statements.)
+esid: prod-AwaitExpression
+features: [top-level-await, async-iteration]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+var foo = 1;
+
+
+var binding;
+
+// [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (binding of [await foo]) {
+ await foo;
+ break;
+}
+
+// [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (var binding of [await foo]) {
+ await foo;
+ break;
+}
+
+// [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (let binding of [await foo]) {
+ await foo;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-literal-number.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-literal-number.js
new file mode 100644
index 0000000000..2939e3bfe3
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-literal-number.js
@@ -0,0 +1,70 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-number.case
+// - src/top-level-await/syntax/for-await-expr.template
+/*---
+description: AwaitExpression NumberLiteral (Valid syntax for top level await in for await statements.)
+esid: prod-AwaitExpression
+features: [top-level-await, async-iteration]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (binding of [await 1]) {
+ await 1;
+ break;
+}
+
+// [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (var binding of [await 1]) {
+ await 1;
+ break;
+}
+
+// [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (let binding of [await 1]) {
+ await 1;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-literal-string.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-literal-string.js
new file mode 100644
index 0000000000..0867b427a7
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-literal-string.js
@@ -0,0 +1,70 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-string.case
+// - src/top-level-await/syntax/for-await-expr.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in for await statements.)
+esid: prod-AwaitExpression
+features: [top-level-await, async-iteration]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (binding of [await '']) {
+ await '';
+ break;
+}
+
+// [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (var binding of [await '']) {
+ await '';
+ break;
+}
+
+// [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (let binding of [await '']) {
+ await '';
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-nested.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-nested.js
new file mode 100644
index 0000000000..e0efd8f313
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-nested.js
@@ -0,0 +1,66 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-nested.case
+// - src/top-level-await/syntax/for-await-expr.template
+/*---
+description: Nested AwaitExpressions (Valid syntax for top level await in for await statements.)
+esid: prod-AwaitExpression
+features: [top-level-await, async-iteration]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+---*/
+
+
+var binding;
+
+// [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (binding of [await await await await await await await await await await await await await await await 'await']) {
+ await await await await await await await await await await await await await await await 'await';
+ break;
+}
+
+// [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (var binding of [await await await await await await await await await await await await await await await 'await']) {
+ await await await await await await await await await await await await await await await 'await';
+ break;
+}
+
+// [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (let binding of [await await await await await await await await await await await await await await await 'await']) {
+ await await await await await await await await await await await await await await await 'await';
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-new-expr.js
new file mode 100644
index 0000000000..906ef0c09d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-new-expr.js
@@ -0,0 +1,67 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-new-expr.case
+// - src/top-level-await/syntax/for-await-expr.template
+/*---
+description: AwaitExpression new MemberExpression (Valid syntax for top level await in for await statements.)
+esid: prod-AwaitExpression
+features: [top-level-await, async-iteration]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (binding of [await new Promise(function(res, rej) { res(1); })]) {
+ await new Promise(function(res, rej) { res(1); });
+ break;
+}
+
+// [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (var binding of [await new Promise(function(res, rej) { res(1); })]) {
+ await new Promise(function(res, rej) { res(1); });
+ break;
+}
+
+// [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (let binding of [await new Promise(function(res, rej) { res(1); })]) {
+ await new Promise(function(res, rej) { res(1); });
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-null.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-null.js
new file mode 100644
index 0000000000..4e3aa5654c
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-null.js
@@ -0,0 +1,70 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-null.case
+// - src/top-level-await/syntax/for-await-expr.template
+/*---
+description: AwaitExpression NullLiteral (Valid syntax for top level await in for await statements.)
+esid: prod-AwaitExpression
+features: [top-level-await, async-iteration]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (binding of [await null]) {
+ await null;
+ break;
+}
+
+// [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (var binding of [await null]) {
+ await null;
+ break;
+}
+
+// [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (let binding of [await null]) {
+ await null;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-obj-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-obj-literal.js
new file mode 100644
index 0000000000..fccfcb3445
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-obj-literal.js
@@ -0,0 +1,70 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-obj-literal.case
+// - src/top-level-await/syntax/for-await-expr.template
+/*---
+description: AwaitExpression ObjectLiteral (Valid syntax for top level await in for await statements.)
+esid: prod-AwaitExpression
+features: [top-level-await, async-iteration]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (binding of [await { function() {} }]) {
+ await { function() {} };
+ break;
+}
+
+// [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (var binding of [await { function() {} }]) {
+ await { function() {} };
+ break;
+}
+
+// [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (let binding of [await { function() {} }]) {
+ await { function() {} };
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-regexp.js
new file mode 100644
index 0000000000..5addcb3efb
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-regexp.js
@@ -0,0 +1,70 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-regexp.case
+// - src/top-level-await/syntax/for-await-expr.template
+/*---
+description: AwaitExpression RegularExpressionLiteral (Valid syntax for top level await in for await statements.)
+esid: prod-AwaitExpression
+features: [top-level-await, async-iteration]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (binding of [await /1/]) {
+ await /1/;
+ break;
+}
+
+// [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (var binding of [await /1/]) {
+ await /1/;
+ break;
+}
+
+// [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (let binding of [await /1/]) {
+ await /1/;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-template-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-template-literal.js
new file mode 100644
index 0000000000..aa6420f831
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-template-literal.js
@@ -0,0 +1,70 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-template-literal.case
+// - src/top-level-await/syntax/for-await-expr.template
+/*---
+description: AwaitExpression TemplateLiteral (Valid syntax for top level await in for await statements.)
+esid: prod-AwaitExpression
+features: [top-level-await, async-iteration]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (binding of [await ``]) {
+ await ``;
+ break;
+}
+
+// [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (var binding of [await ``]) {
+ await ``;
+ break;
+}
+
+// [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (let binding of [await ``]) {
+ await ``;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-this.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-this.js
new file mode 100644
index 0000000000..f6e28cc1c1
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-this.js
@@ -0,0 +1,70 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-this.case
+// - src/top-level-await/syntax/for-await-expr.template
+/*---
+description: AwaitExpression this (Valid syntax for top level await in for await statements.)
+esid: prod-AwaitExpression
+features: [top-level-await, async-iteration]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (binding of [await this]) {
+ await this;
+ break;
+}
+
+// [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (var binding of [await this]) {
+ await this;
+ break;
+}
+
+// [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (let binding of [await this]) {
+ await this;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-array-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-array-literal.js
new file mode 100644
index 0000000000..52c77f4e21
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-array-literal.js
@@ -0,0 +1,76 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-array-literal.case
+// - src/top-level-await/syntax/for-expr.template
+/*---
+description: AwaitExpression ArrayLiteral (Valid syntax for top level await in for statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+// for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( await [] ; await []; await [] ) {
+ await [];
+ break;
+}
+
+// for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( var binding; await []; await [] ) {
+ await [];
+ break;
+}
+
+// for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( let binding; await []; await [] ) {
+ await [];
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-func-expression.js
new file mode 100644
index 0000000000..b503c3b400
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-func-expression.js
@@ -0,0 +1,82 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-func-expression.case
+// - src/top-level-await/syntax/for-expr.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in for statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+// for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( await function() {} ; await function() {}; await function() {} ) {
+ await function() {};
+ break;
+}
+
+// for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( var binding; await function() {}; await function() {} ) {
+ await function() {};
+ break;
+}
+
+// for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( let binding; await function() {}; await function() {} ) {
+ await function() {};
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-identifier.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-identifier.js
new file mode 100644
index 0000000000..38a74ee54f
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-identifier.js
@@ -0,0 +1,77 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-identifier.case
+// - src/top-level-await/syntax/for-expr.template
+/*---
+description: AwaitExpression IdentifierReference (Valid syntax for top level await in for statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+var foo = 1;
+
+
+// for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( await foo ; await foo; await foo ) {
+ await foo;
+ break;
+}
+
+// for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( var binding; await foo; await foo ) {
+ await foo;
+ break;
+}
+
+// for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( let binding; await foo; await foo ) {
+ await foo;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-literal-number.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-literal-number.js
new file mode 100644
index 0000000000..75c6379260
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-literal-number.js
@@ -0,0 +1,76 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-number.case
+// - src/top-level-await/syntax/for-expr.template
+/*---
+description: AwaitExpression NumberLiteral (Valid syntax for top level await in for statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+// for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( await 1 ; await 1; await 1 ) {
+ await 1;
+ break;
+}
+
+// for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( var binding; await 1; await 1 ) {
+ await 1;
+ break;
+}
+
+// for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( let binding; await 1; await 1 ) {
+ await 1;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-literal-string.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-literal-string.js
new file mode 100644
index 0000000000..305d58852d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-literal-string.js
@@ -0,0 +1,76 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-string.case
+// - src/top-level-await/syntax/for-expr.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in for statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+// for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( await '' ; await ''; await '' ) {
+ await '';
+ break;
+}
+
+// for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( var binding; await ''; await '' ) {
+ await '';
+ break;
+}
+
+// for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( let binding; await ''; await '' ) {
+ await '';
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-nested.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-nested.js
new file mode 100644
index 0000000000..4a97e72792
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-nested.js
@@ -0,0 +1,72 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-nested.case
+// - src/top-level-await/syntax/for-expr.template
+/*---
+description: Nested AwaitExpressions (Valid syntax for top level await in for statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+---*/
+
+
+// for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( await await await await await await await await await await await await await await await 'await' ; await await await await await await await await await await await await await await await 'await'; await await await await await await await await await await await await await await await 'await' ) {
+ await await await await await await await await await await await await await await await 'await';
+ break;
+}
+
+// for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( var binding; await await await await await await await await await await await await await await await 'await'; await await await await await await await await await await await await await await await 'await' ) {
+ await await await await await await await await await await await await await await await 'await';
+ break;
+}
+
+// for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( let binding; await await await await await await await await await await await await await await await 'await'; await await await await await await await await await await await await await await await 'await' ) {
+ await await await await await await await await await await await await await await await 'await';
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-new-expr.js
new file mode 100644
index 0000000000..95c6053b62
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-new-expr.js
@@ -0,0 +1,73 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-new-expr.case
+// - src/top-level-await/syntax/for-expr.template
+/*---
+description: AwaitExpression new MemberExpression (Valid syntax for top level await in for statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+---*/
+
+
+// for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( await new Promise(function(res, rej) { res(1); }) ; await new Promise(function(res, rej) { res(1); }); await new Promise(function(res, rej) { res(1); }) ) {
+ await new Promise(function(res, rej) { res(1); });
+ break;
+}
+
+// for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( var binding; await new Promise(function(res, rej) { res(1); }); await new Promise(function(res, rej) { res(1); }) ) {
+ await new Promise(function(res, rej) { res(1); });
+ break;
+}
+
+// for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( let binding; await new Promise(function(res, rej) { res(1); }); await new Promise(function(res, rej) { res(1); }) ) {
+ await new Promise(function(res, rej) { res(1); });
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-null.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-null.js
new file mode 100644
index 0000000000..335d701269
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-null.js
@@ -0,0 +1,76 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-null.case
+// - src/top-level-await/syntax/for-expr.template
+/*---
+description: AwaitExpression NullLiteral (Valid syntax for top level await in for statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+// for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( await null ; await null; await null ) {
+ await null;
+ break;
+}
+
+// for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( var binding; await null; await null ) {
+ await null;
+ break;
+}
+
+// for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( let binding; await null; await null ) {
+ await null;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-obj-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-obj-literal.js
new file mode 100644
index 0000000000..a2dcfef5a6
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-obj-literal.js
@@ -0,0 +1,76 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-obj-literal.case
+// - src/top-level-await/syntax/for-expr.template
+/*---
+description: AwaitExpression ObjectLiteral (Valid syntax for top level await in for statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+// for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( await { function() {} } ; await { function() {} }; await { function() {} } ) {
+ await { function() {} };
+ break;
+}
+
+// for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( var binding; await { function() {} }; await { function() {} } ) {
+ await { function() {} };
+ break;
+}
+
+// for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( let binding; await { function() {} }; await { function() {} } ) {
+ await { function() {} };
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-regexp.js
new file mode 100644
index 0000000000..7e2c50c486
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-regexp.js
@@ -0,0 +1,76 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-regexp.case
+// - src/top-level-await/syntax/for-expr.template
+/*---
+description: AwaitExpression RegularExpressionLiteral (Valid syntax for top level await in for statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+// for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( await /1/ ; await /1/; await /1/ ) {
+ await /1/;
+ break;
+}
+
+// for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( var binding; await /1/; await /1/ ) {
+ await /1/;
+ break;
+}
+
+// for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( let binding; await /1/; await /1/ ) {
+ await /1/;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-template-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-template-literal.js
new file mode 100644
index 0000000000..9e5c396340
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-template-literal.js
@@ -0,0 +1,76 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-template-literal.case
+// - src/top-level-await/syntax/for-expr.template
+/*---
+description: AwaitExpression TemplateLiteral (Valid syntax for top level await in for statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+// for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( await `` ; await ``; await `` ) {
+ await ``;
+ break;
+}
+
+// for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( var binding; await ``; await `` ) {
+ await ``;
+ break;
+}
+
+// for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( let binding; await ``; await `` ) {
+ await ``;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-this.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-this.js
new file mode 100644
index 0000000000..d9e1454940
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-this.js
@@ -0,0 +1,76 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-this.case
+// - src/top-level-await/syntax/for-expr.template
+/*---
+description: AwaitExpression this (Valid syntax for top level await in for statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+// for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( await this ; await this; await this ) {
+ await this;
+ break;
+}
+
+// for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( var binding; await this; await this ) {
+ await this;
+ break;
+}
+
+// for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( let binding; await this; await this ) {
+ await this;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-array-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-array-literal.js
new file mode 100644
index 0000000000..1a7c09f7a0
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-array-literal.js
@@ -0,0 +1,78 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-array-literal.case
+// - src/top-level-await/syntax/for-in-expr.template
+/*---
+description: AwaitExpression ArrayLiteral (Valid syntax for top level await in for-in statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding in [await []]) {
+ await [];
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding in [await []]) {
+ await [];
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding in [await []]) {
+ await [];
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-func-expression.js
new file mode 100644
index 0000000000..df5ee5b75b
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-func-expression.js
@@ -0,0 +1,84 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-func-expression.case
+// - src/top-level-await/syntax/for-in-expr.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in for-in statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding in [await function() {}]) {
+ await function() {};
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding in [await function() {}]) {
+ await function() {};
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding in [await function() {}]) {
+ await function() {};
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-identifier.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-identifier.js
new file mode 100644
index 0000000000..8e70be07ab
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-identifier.js
@@ -0,0 +1,79 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-identifier.case
+// - src/top-level-await/syntax/for-in-expr.template
+/*---
+description: AwaitExpression IdentifierReference (Valid syntax for top level await in for-in statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+var foo = 1;
+
+
+var binding;
+
+// for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding in [await foo]) {
+ await foo;
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding in [await foo]) {
+ await foo;
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding in [await foo]) {
+ await foo;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-literal-number.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-literal-number.js
new file mode 100644
index 0000000000..37ef5586a0
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-literal-number.js
@@ -0,0 +1,78 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-number.case
+// - src/top-level-await/syntax/for-in-expr.template
+/*---
+description: AwaitExpression NumberLiteral (Valid syntax for top level await in for-in statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding in [await 1]) {
+ await 1;
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding in [await 1]) {
+ await 1;
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding in [await 1]) {
+ await 1;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-literal-string.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-literal-string.js
new file mode 100644
index 0000000000..9526966399
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-literal-string.js
@@ -0,0 +1,78 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-string.case
+// - src/top-level-await/syntax/for-in-expr.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in for-in statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding in [await '']) {
+ await '';
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding in [await '']) {
+ await '';
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding in [await '']) {
+ await '';
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-nested.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-nested.js
new file mode 100644
index 0000000000..126eaf6698
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-nested.js
@@ -0,0 +1,74 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-nested.case
+// - src/top-level-await/syntax/for-in-expr.template
+/*---
+description: Nested AwaitExpressions (Valid syntax for top level await in for-in statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding in [await await await await await await await await await await await await await await await 'await']) {
+ await await await await await await await await await await await await await await await 'await';
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding in [await await await await await await await await await await await await await await await 'await']) {
+ await await await await await await await await await await await await await await await 'await';
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding in [await await await await await await await await await await await await await await await 'await']) {
+ await await await await await await await await await await await await await await await 'await';
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-new-expr.js
new file mode 100644
index 0000000000..ae47d48012
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-new-expr.js
@@ -0,0 +1,75 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-new-expr.case
+// - src/top-level-await/syntax/for-in-expr.template
+/*---
+description: AwaitExpression new MemberExpression (Valid syntax for top level await in for-in statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding in [await new Promise(function(res, rej) { res(1); })]) {
+ await new Promise(function(res, rej) { res(1); });
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding in [await new Promise(function(res, rej) { res(1); })]) {
+ await new Promise(function(res, rej) { res(1); });
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding in [await new Promise(function(res, rej) { res(1); })]) {
+ await new Promise(function(res, rej) { res(1); });
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-null.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-null.js
new file mode 100644
index 0000000000..5e24dc89cc
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-null.js
@@ -0,0 +1,78 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-null.case
+// - src/top-level-await/syntax/for-in-expr.template
+/*---
+description: AwaitExpression NullLiteral (Valid syntax for top level await in for-in statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding in [await null]) {
+ await null;
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding in [await null]) {
+ await null;
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding in [await null]) {
+ await null;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-obj-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-obj-literal.js
new file mode 100644
index 0000000000..049a3711f3
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-obj-literal.js
@@ -0,0 +1,78 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-obj-literal.case
+// - src/top-level-await/syntax/for-in-expr.template
+/*---
+description: AwaitExpression ObjectLiteral (Valid syntax for top level await in for-in statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding in [await { function() {} }]) {
+ await { function() {} };
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding in [await { function() {} }]) {
+ await { function() {} };
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding in [await { function() {} }]) {
+ await { function() {} };
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-regexp.js
new file mode 100644
index 0000000000..e3469e0182
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-regexp.js
@@ -0,0 +1,78 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-regexp.case
+// - src/top-level-await/syntax/for-in-expr.template
+/*---
+description: AwaitExpression RegularExpressionLiteral (Valid syntax for top level await in for-in statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding in [await /1/]) {
+ await /1/;
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding in [await /1/]) {
+ await /1/;
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding in [await /1/]) {
+ await /1/;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-template-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-template-literal.js
new file mode 100644
index 0000000000..f6e75ceaba
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-template-literal.js
@@ -0,0 +1,78 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-template-literal.case
+// - src/top-level-await/syntax/for-in-expr.template
+/*---
+description: AwaitExpression TemplateLiteral (Valid syntax for top level await in for-in statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding in [await ``]) {
+ await ``;
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding in [await ``]) {
+ await ``;
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding in [await ``]) {
+ await ``;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-this.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-this.js
new file mode 100644
index 0000000000..70d7337cfa
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-this.js
@@ -0,0 +1,78 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-this.case
+// - src/top-level-await/syntax/for-in-expr.template
+/*---
+description: AwaitExpression this (Valid syntax for top level await in for-in statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding in [await this]) {
+ await this;
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding in [await this]) {
+ await this;
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding in [await this]) {
+ await this;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-array-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-array-literal.js
new file mode 100644
index 0000000000..28ee2d2cce
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-array-literal.js
@@ -0,0 +1,78 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-array-literal.case
+// - src/top-level-await/syntax/for-of-expr.template
+/*---
+description: AwaitExpression ArrayLiteral (Valid syntax for top level await in for-of statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding of [await []]) {
+ await [];
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding of [await []]) {
+ await [];
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding of [await []]) {
+ await [];
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-func-expression.js
new file mode 100644
index 0000000000..5ce9d79b0b
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-func-expression.js
@@ -0,0 +1,84 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-func-expression.case
+// - src/top-level-await/syntax/for-of-expr.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in for-of statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding of [await function() {}]) {
+ await function() {};
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding of [await function() {}]) {
+ await function() {};
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding of [await function() {}]) {
+ await function() {};
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-identifier.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-identifier.js
new file mode 100644
index 0000000000..ca583c1c4a
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-identifier.js
@@ -0,0 +1,79 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-identifier.case
+// - src/top-level-await/syntax/for-of-expr.template
+/*---
+description: AwaitExpression IdentifierReference (Valid syntax for top level await in for-of statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+var foo = 1;
+
+
+var binding;
+
+// for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding of [await foo]) {
+ await foo;
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding of [await foo]) {
+ await foo;
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding of [await foo]) {
+ await foo;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-literal-number.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-literal-number.js
new file mode 100644
index 0000000000..75255ded9b
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-literal-number.js
@@ -0,0 +1,78 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-number.case
+// - src/top-level-await/syntax/for-of-expr.template
+/*---
+description: AwaitExpression NumberLiteral (Valid syntax for top level await in for-of statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding of [await 1]) {
+ await 1;
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding of [await 1]) {
+ await 1;
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding of [await 1]) {
+ await 1;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-literal-string.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-literal-string.js
new file mode 100644
index 0000000000..266e7a0249
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-literal-string.js
@@ -0,0 +1,78 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-string.case
+// - src/top-level-await/syntax/for-of-expr.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in for-of statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding of [await '']) {
+ await '';
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding of [await '']) {
+ await '';
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding of [await '']) {
+ await '';
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-nested.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-nested.js
new file mode 100644
index 0000000000..0b34729eed
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-nested.js
@@ -0,0 +1,74 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-nested.case
+// - src/top-level-await/syntax/for-of-expr.template
+/*---
+description: Nested AwaitExpressions (Valid syntax for top level await in for-of statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding of [await await await await await await await await await await await await await await await 'await']) {
+ await await await await await await await await await await await await await await await 'await';
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding of [await await await await await await await await await await await await await await await 'await']) {
+ await await await await await await await await await await await await await await await 'await';
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding of [await await await await await await await await await await await await await await await 'await']) {
+ await await await await await await await await await await await await await await await 'await';
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-new-expr.js
new file mode 100644
index 0000000000..983736207d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-new-expr.js
@@ -0,0 +1,75 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-new-expr.case
+// - src/top-level-await/syntax/for-of-expr.template
+/*---
+description: AwaitExpression new MemberExpression (Valid syntax for top level await in for-of statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding of [await new Promise(function(res, rej) { res(1); })]) {
+ await new Promise(function(res, rej) { res(1); });
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding of [await new Promise(function(res, rej) { res(1); })]) {
+ await new Promise(function(res, rej) { res(1); });
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding of [await new Promise(function(res, rej) { res(1); })]) {
+ await new Promise(function(res, rej) { res(1); });
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-null.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-null.js
new file mode 100644
index 0000000000..2bb8e9e670
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-null.js
@@ -0,0 +1,78 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-null.case
+// - src/top-level-await/syntax/for-of-expr.template
+/*---
+description: AwaitExpression NullLiteral (Valid syntax for top level await in for-of statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding of [await null]) {
+ await null;
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding of [await null]) {
+ await null;
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding of [await null]) {
+ await null;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-obj-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-obj-literal.js
new file mode 100644
index 0000000000..6943cc6629
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-obj-literal.js
@@ -0,0 +1,78 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-obj-literal.case
+// - src/top-level-await/syntax/for-of-expr.template
+/*---
+description: AwaitExpression ObjectLiteral (Valid syntax for top level await in for-of statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding of [await { function() {} }]) {
+ await { function() {} };
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding of [await { function() {} }]) {
+ await { function() {} };
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding of [await { function() {} }]) {
+ await { function() {} };
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-regexp.js
new file mode 100644
index 0000000000..bfbbb74879
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-regexp.js
@@ -0,0 +1,78 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-regexp.case
+// - src/top-level-await/syntax/for-of-expr.template
+/*---
+description: AwaitExpression RegularExpressionLiteral (Valid syntax for top level await in for-of statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding of [await /1/]) {
+ await /1/;
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding of [await /1/]) {
+ await /1/;
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding of [await /1/]) {
+ await /1/;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-template-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-template-literal.js
new file mode 100644
index 0000000000..3346869b0c
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-template-literal.js
@@ -0,0 +1,78 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-template-literal.case
+// - src/top-level-await/syntax/for-of-expr.template
+/*---
+description: AwaitExpression TemplateLiteral (Valid syntax for top level await in for-of statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding of [await ``]) {
+ await ``;
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding of [await ``]) {
+ await ``;
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding of [await ``]) {
+ await ``;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-this.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-this.js
new file mode 100644
index 0000000000..7f6ea27cac
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-this.js
@@ -0,0 +1,78 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-this.case
+// - src/top-level-await/syntax/for-of-expr.template
+/*---
+description: AwaitExpression this (Valid syntax for top level await in for-of statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding of [await this]) {
+ await this;
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding of [await this]) {
+ await this;
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding of [await this]) {
+ await this;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-array-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-array-literal.js
new file mode 100644
index 0000000000..279e7e9ba7
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-array-literal.js
@@ -0,0 +1,53 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-array-literal.case
+// - src/top-level-await/syntax/if-block.template
+/*---
+description: AwaitExpression ArrayLiteral (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (true) {
+ await [];
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-func-expression.js
new file mode 100644
index 0000000000..2905605ba3
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-func-expression.js
@@ -0,0 +1,59 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-func-expression.case
+// - src/top-level-await/syntax/if-block.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (true) {
+ await function() {};
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-identifier.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-identifier.js
new file mode 100644
index 0000000000..967c1e830c
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-identifier.js
@@ -0,0 +1,54 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-identifier.case
+// - src/top-level-await/syntax/if-block.template
+/*---
+description: AwaitExpression IdentifierReference (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+var foo = 1;
+
+
+if (true) {
+ await foo;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-literal-number.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-literal-number.js
new file mode 100644
index 0000000000..2ca464a245
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-literal-number.js
@@ -0,0 +1,53 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-number.case
+// - src/top-level-await/syntax/if-block.template
+/*---
+description: AwaitExpression NumberLiteral (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (true) {
+ await 1;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-literal-string.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-literal-string.js
new file mode 100644
index 0000000000..f73ab8443f
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-literal-string.js
@@ -0,0 +1,53 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-string.case
+// - src/top-level-await/syntax/if-block.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (true) {
+ await '';
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-nested.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-nested.js
new file mode 100644
index 0000000000..452b331138
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-nested.js
@@ -0,0 +1,49 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-nested.case
+// - src/top-level-await/syntax/if-block.template
+/*---
+description: Nested AwaitExpressions (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+---*/
+
+
+if (true) {
+ await await await await await await await await await await await await await await await 'await';
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-new-expr.js
new file mode 100644
index 0000000000..c3e1eb1918
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-new-expr.js
@@ -0,0 +1,50 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-new-expr.case
+// - src/top-level-await/syntax/if-block.template
+/*---
+description: AwaitExpression new MemberExpression (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+---*/
+
+
+if (true) {
+ await new Promise(function(res, rej) { res(1); });
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-null.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-null.js
new file mode 100644
index 0000000000..b7bb69a4d4
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-null.js
@@ -0,0 +1,53 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-null.case
+// - src/top-level-await/syntax/if-block.template
+/*---
+description: AwaitExpression NullLiteral (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (true) {
+ await null;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-obj-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-obj-literal.js
new file mode 100644
index 0000000000..c0647493b9
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-obj-literal.js
@@ -0,0 +1,53 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-obj-literal.case
+// - src/top-level-await/syntax/if-block.template
+/*---
+description: AwaitExpression ObjectLiteral (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (true) {
+ await { function() {} };
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-regexp.js
new file mode 100644
index 0000000000..6c2edebf92
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-regexp.js
@@ -0,0 +1,53 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-regexp.case
+// - src/top-level-await/syntax/if-block.template
+/*---
+description: AwaitExpression RegularExpressionLiteral (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (true) {
+ await /1/;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-template-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-template-literal.js
new file mode 100644
index 0000000000..aae9410ad1
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-template-literal.js
@@ -0,0 +1,53 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-template-literal.case
+// - src/top-level-await/syntax/if-block.template
+/*---
+description: AwaitExpression TemplateLiteral (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (true) {
+ await ``;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-this.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-this.js
new file mode 100644
index 0000000000..a2ddcd2e13
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-this.js
@@ -0,0 +1,53 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-this.case
+// - src/top-level-await/syntax/if-block.template
+/*---
+description: AwaitExpression this (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (true) {
+ await this;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-array-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-array-literal.js
new file mode 100644
index 0000000000..cd3219b3c7
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-array-literal.js
@@ -0,0 +1,51 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-array-literal.case
+// - src/top-level-await/syntax/if-expr.template
+/*---
+description: AwaitExpression ArrayLiteral (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (await []) {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-func-expression.js
new file mode 100644
index 0000000000..b51c7e59e5
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-func-expression.js
@@ -0,0 +1,57 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-func-expression.case
+// - src/top-level-await/syntax/if-expr.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (await function() {}) {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-identifier.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-identifier.js
new file mode 100644
index 0000000000..57e171135d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-identifier.js
@@ -0,0 +1,52 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-identifier.case
+// - src/top-level-await/syntax/if-expr.template
+/*---
+description: AwaitExpression IdentifierReference (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+var foo = 1;
+
+
+if (await foo) {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-literal-number.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-literal-number.js
new file mode 100644
index 0000000000..5e7671b8c3
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-literal-number.js
@@ -0,0 +1,51 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-number.case
+// - src/top-level-await/syntax/if-expr.template
+/*---
+description: AwaitExpression NumberLiteral (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (await 1) {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-literal-string.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-literal-string.js
new file mode 100644
index 0000000000..5f245e111e
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-literal-string.js
@@ -0,0 +1,51 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-string.case
+// - src/top-level-await/syntax/if-expr.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (await '') {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-nested.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-nested.js
new file mode 100644
index 0000000000..e94e55bbee
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-nested.js
@@ -0,0 +1,47 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-nested.case
+// - src/top-level-await/syntax/if-expr.template
+/*---
+description: Nested AwaitExpressions (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+---*/
+
+
+if (await await await await await await await await await await await await await await await 'await') {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-new-expr.js
new file mode 100644
index 0000000000..9119c235e1
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-new-expr.js
@@ -0,0 +1,48 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-new-expr.case
+// - src/top-level-await/syntax/if-expr.template
+/*---
+description: AwaitExpression new MemberExpression (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+---*/
+
+
+if (await new Promise(function(res, rej) { res(1); })) {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-null.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-null.js
new file mode 100644
index 0000000000..ef14ac687d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-null.js
@@ -0,0 +1,51 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-null.case
+// - src/top-level-await/syntax/if-expr.template
+/*---
+description: AwaitExpression NullLiteral (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (await null) {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-obj-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-obj-literal.js
new file mode 100644
index 0000000000..7ebd37cb55
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-obj-literal.js
@@ -0,0 +1,51 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-obj-literal.case
+// - src/top-level-await/syntax/if-expr.template
+/*---
+description: AwaitExpression ObjectLiteral (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (await { function() {} }) {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-regexp.js
new file mode 100644
index 0000000000..e7c958bea2
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-regexp.js
@@ -0,0 +1,51 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-regexp.case
+// - src/top-level-await/syntax/if-expr.template
+/*---
+description: AwaitExpression RegularExpressionLiteral (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (await /1/) {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-template-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-template-literal.js
new file mode 100644
index 0000000000..0a2d306d6c
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-template-literal.js
@@ -0,0 +1,51 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-template-literal.case
+// - src/top-level-await/syntax/if-expr.template
+/*---
+description: AwaitExpression TemplateLiteral (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (await ``) {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-this.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-this.js
new file mode 100644
index 0000000000..2d27d027cf
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-this.js
@@ -0,0 +1,51 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-this.case
+// - src/top-level-await/syntax/if-expr.template
+/*---
+description: AwaitExpression this (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (await this) {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/shell.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/shell.js
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-array-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-array-literal.js
new file mode 100644
index 0000000000..12c4789327
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-array-literal.js
@@ -0,0 +1,45 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-array-literal.case
+// - src/top-level-await/syntax/top-level.template
+/*---
+description: AwaitExpression ArrayLiteral (Valid syntax for top level await.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+await [];
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-func-expression.js
new file mode 100644
index 0000000000..b4bee57953
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-func-expression.js
@@ -0,0 +1,51 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-func-expression.case
+// - src/top-level-await/syntax/top-level.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+await function() {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-identifier.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-identifier.js
new file mode 100644
index 0000000000..43f3be5dd8
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-identifier.js
@@ -0,0 +1,46 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-identifier.case
+// - src/top-level-await/syntax/top-level.template
+/*---
+description: AwaitExpression IdentifierReference (Valid syntax for top level await.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+var foo = 1;
+
+
+await foo;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-literal-number.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-literal-number.js
new file mode 100644
index 0000000000..b8f1d86b5a
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-literal-number.js
@@ -0,0 +1,45 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-number.case
+// - src/top-level-await/syntax/top-level.template
+/*---
+description: AwaitExpression NumberLiteral (Valid syntax for top level await.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+await 1;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-literal-string.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-literal-string.js
new file mode 100644
index 0000000000..30b035df5e
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-literal-string.js
@@ -0,0 +1,45 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-string.case
+// - src/top-level-await/syntax/top-level.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+await '';
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-nested.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-nested.js
new file mode 100644
index 0000000000..9cf7cc4f4d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-nested.js
@@ -0,0 +1,41 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-nested.case
+// - src/top-level-await/syntax/top-level.template
+/*---
+description: Nested AwaitExpressions (Valid syntax for top level await.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+---*/
+
+
+await await await await await await await await await await await await await await await 'await';
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-new-expr.js
new file mode 100644
index 0000000000..ab5b9cdd91
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-new-expr.js
@@ -0,0 +1,42 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-new-expr.case
+// - src/top-level-await/syntax/top-level.template
+/*---
+description: AwaitExpression new MemberExpression (Valid syntax for top level await.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+---*/
+
+
+await new Promise(function(res, rej) { res(1); });
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-null.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-null.js
new file mode 100644
index 0000000000..da9bfead7c
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-null.js
@@ -0,0 +1,45 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-null.case
+// - src/top-level-await/syntax/top-level.template
+/*---
+description: AwaitExpression NullLiteral (Valid syntax for top level await.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+await null;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-obj-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-obj-literal.js
new file mode 100644
index 0000000000..dd717e28f1
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-obj-literal.js
@@ -0,0 +1,45 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-obj-literal.case
+// - src/top-level-await/syntax/top-level.template
+/*---
+description: AwaitExpression ObjectLiteral (Valid syntax for top level await.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+await { function() {} };
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-regexp.js
new file mode 100644
index 0000000000..3f25ab4e89
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-regexp.js
@@ -0,0 +1,45 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-regexp.case
+// - src/top-level-await/syntax/top-level.template
+/*---
+description: AwaitExpression RegularExpressionLiteral (Valid syntax for top level await.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+await /1/;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-template-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-template-literal.js
new file mode 100644
index 0000000000..f088992430
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-template-literal.js
@@ -0,0 +1,45 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-template-literal.case
+// - src/top-level-await/syntax/top-level.template
+/*---
+description: AwaitExpression TemplateLiteral (Valid syntax for top level await.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+await ``;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-this.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-this.js
new file mode 100644
index 0000000000..3c0f241571
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-this.js
@@ -0,0 +1,45 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-this.case
+// - src/top-level-await/syntax/top-level.template
+/*---
+description: AwaitExpression this (Valid syntax for top level await.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+await this;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-array-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-array-literal.js
new file mode 100644
index 0000000000..32ae857da4
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-array-literal.js
@@ -0,0 +1,70 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-array-literal.case
+// - src/top-level-await/syntax/try.template
+/*---
+description: AwaitExpression ArrayLiteral (Valid syntax for top level await in try-catch-finally blocks.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+try {
+ await [];
+} catch(e) {
+ await [];
+}
+
+try {
+ await [];
+} finally {
+ await [];
+}
+
+try {
+ await [];
+} catch(e) {
+ await [];
+} finally {
+ await [];
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-func-expression.js
new file mode 100644
index 0000000000..047534c424
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-func-expression.js
@@ -0,0 +1,76 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-func-expression.case
+// - src/top-level-await/syntax/try.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in try-catch-finally blocks.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+try {
+ await function() {};
+} catch(e) {
+ await function() {};
+}
+
+try {
+ await function() {};
+} finally {
+ await function() {};
+}
+
+try {
+ await function() {};
+} catch(e) {
+ await function() {};
+} finally {
+ await function() {};
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-identifier.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-identifier.js
new file mode 100644
index 0000000000..1a543bcd93
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-identifier.js
@@ -0,0 +1,71 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-identifier.case
+// - src/top-level-await/syntax/try.template
+/*---
+description: AwaitExpression IdentifierReference (Valid syntax for top level await in try-catch-finally blocks.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+var foo = 1;
+
+
+try {
+ await foo;
+} catch(e) {
+ await foo;
+}
+
+try {
+ await foo;
+} finally {
+ await foo;
+}
+
+try {
+ await foo;
+} catch(e) {
+ await foo;
+} finally {
+ await foo;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-literal-number.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-literal-number.js
new file mode 100644
index 0000000000..aa0f7f5a1d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-literal-number.js
@@ -0,0 +1,70 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-number.case
+// - src/top-level-await/syntax/try.template
+/*---
+description: AwaitExpression NumberLiteral (Valid syntax for top level await in try-catch-finally blocks.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+try {
+ await 1;
+} catch(e) {
+ await 1;
+}
+
+try {
+ await 1;
+} finally {
+ await 1;
+}
+
+try {
+ await 1;
+} catch(e) {
+ await 1;
+} finally {
+ await 1;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-literal-string.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-literal-string.js
new file mode 100644
index 0000000000..5535856810
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-literal-string.js
@@ -0,0 +1,70 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-string.case
+// - src/top-level-await/syntax/try.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in try-catch-finally blocks.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+try {
+ await '';
+} catch(e) {
+ await '';
+}
+
+try {
+ await '';
+} finally {
+ await '';
+}
+
+try {
+ await '';
+} catch(e) {
+ await '';
+} finally {
+ await '';
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-nested.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-nested.js
new file mode 100644
index 0000000000..85ad388964
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-nested.js
@@ -0,0 +1,66 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-nested.case
+// - src/top-level-await/syntax/try.template
+/*---
+description: Nested AwaitExpressions (Valid syntax for top level await in try-catch-finally blocks.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+---*/
+
+
+try {
+ await await await await await await await await await await await await await await await 'await';
+} catch(e) {
+ await await await await await await await await await await await await await await await 'await';
+}
+
+try {
+ await await await await await await await await await await await await await await await 'await';
+} finally {
+ await await await await await await await await await await await await await await await 'await';
+}
+
+try {
+ await await await await await await await await await await await await await await await 'await';
+} catch(e) {
+ await await await await await await await await await await await await await await await 'await';
+} finally {
+ await await await await await await await await await await await await await await await 'await';
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-new-expr.js
new file mode 100644
index 0000000000..be6167e6d5
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-new-expr.js
@@ -0,0 +1,67 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-new-expr.case
+// - src/top-level-await/syntax/try.template
+/*---
+description: AwaitExpression new MemberExpression (Valid syntax for top level await in try-catch-finally blocks.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+---*/
+
+
+try {
+ await new Promise(function(res, rej) { res(1); });
+} catch(e) {
+ await new Promise(function(res, rej) { res(1); });
+}
+
+try {
+ await new Promise(function(res, rej) { res(1); });
+} finally {
+ await new Promise(function(res, rej) { res(1); });
+}
+
+try {
+ await new Promise(function(res, rej) { res(1); });
+} catch(e) {
+ await new Promise(function(res, rej) { res(1); });
+} finally {
+ await new Promise(function(res, rej) { res(1); });
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-null.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-null.js
new file mode 100644
index 0000000000..68b440d375
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-null.js
@@ -0,0 +1,70 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-null.case
+// - src/top-level-await/syntax/try.template
+/*---
+description: AwaitExpression NullLiteral (Valid syntax for top level await in try-catch-finally blocks.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+try {
+ await null;
+} catch(e) {
+ await null;
+}
+
+try {
+ await null;
+} finally {
+ await null;
+}
+
+try {
+ await null;
+} catch(e) {
+ await null;
+} finally {
+ await null;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-obj-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-obj-literal.js
new file mode 100644
index 0000000000..a6f338923d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-obj-literal.js
@@ -0,0 +1,70 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-obj-literal.case
+// - src/top-level-await/syntax/try.template
+/*---
+description: AwaitExpression ObjectLiteral (Valid syntax for top level await in try-catch-finally blocks.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+try {
+ await { function() {} };
+} catch(e) {
+ await { function() {} };
+}
+
+try {
+ await { function() {} };
+} finally {
+ await { function() {} };
+}
+
+try {
+ await { function() {} };
+} catch(e) {
+ await { function() {} };
+} finally {
+ await { function() {} };
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-regexp.js
new file mode 100644
index 0000000000..4fe7a8d078
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-regexp.js
@@ -0,0 +1,70 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-regexp.case
+// - src/top-level-await/syntax/try.template
+/*---
+description: AwaitExpression RegularExpressionLiteral (Valid syntax for top level await in try-catch-finally blocks.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+try {
+ await /1/;
+} catch(e) {
+ await /1/;
+}
+
+try {
+ await /1/;
+} finally {
+ await /1/;
+}
+
+try {
+ await /1/;
+} catch(e) {
+ await /1/;
+} finally {
+ await /1/;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-template-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-template-literal.js
new file mode 100644
index 0000000000..161b9356fe
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-template-literal.js
@@ -0,0 +1,70 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-template-literal.case
+// - src/top-level-await/syntax/try.template
+/*---
+description: AwaitExpression TemplateLiteral (Valid syntax for top level await in try-catch-finally blocks.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+try {
+ await ``;
+} catch(e) {
+ await ``;
+}
+
+try {
+ await ``;
+} finally {
+ await ``;
+}
+
+try {
+ await ``;
+} catch(e) {
+ await ``;
+} finally {
+ await ``;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-this.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-this.js
new file mode 100644
index 0000000000..ee650e12fa
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-this.js
@@ -0,0 +1,70 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-this.case
+// - src/top-level-await/syntax/try.template
+/*---
+description: AwaitExpression this (Valid syntax for top level await in try-catch-finally blocks.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+try {
+ await this;
+} catch(e) {
+ await this;
+}
+
+try {
+ await this;
+} finally {
+ await this;
+}
+
+try {
+ await this;
+} catch(e) {
+ await this;
+} finally {
+ await this;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-array-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-array-literal.js
new file mode 100644
index 0000000000..b7f1a5080f
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-array-literal.js
@@ -0,0 +1,46 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-array-literal.case
+// - src/top-level-await/syntax/typeof.template
+/*---
+description: AwaitExpression ArrayLiteral (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ typeof UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+typeof await [];
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-func-expression.js
new file mode 100644
index 0000000000..3f616b8124
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-func-expression.js
@@ -0,0 +1,52 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-func-expression.case
+// - src/top-level-await/syntax/typeof.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ typeof UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+typeof await function() {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-identifier.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-identifier.js
new file mode 100644
index 0000000000..3eb7cac029
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-identifier.js
@@ -0,0 +1,47 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-identifier.case
+// - src/top-level-await/syntax/typeof.template
+/*---
+description: AwaitExpression IdentifierReference (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ typeof UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+var foo = 1;
+
+
+typeof await foo;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-literal-number.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-literal-number.js
new file mode 100644
index 0000000000..d0a1de5a7f
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-literal-number.js
@@ -0,0 +1,46 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-number.case
+// - src/top-level-await/syntax/typeof.template
+/*---
+description: AwaitExpression NumberLiteral (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ typeof UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+typeof await 1;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-literal-string.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-literal-string.js
new file mode 100644
index 0000000000..9145fda0f8
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-literal-string.js
@@ -0,0 +1,46 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-string.case
+// - src/top-level-await/syntax/typeof.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ typeof UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+typeof await '';
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-nested.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-nested.js
new file mode 100644
index 0000000000..f2660dbde0
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-nested.js
@@ -0,0 +1,42 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-nested.case
+// - src/top-level-await/syntax/typeof.template
+/*---
+description: Nested AwaitExpressions (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ typeof UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+---*/
+
+
+typeof await await await await await await await await await await await await await await await 'await';
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-new-expr.js
new file mode 100644
index 0000000000..1a332b95b8
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-new-expr.js
@@ -0,0 +1,43 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-new-expr.case
+// - src/top-level-await/syntax/typeof.template
+/*---
+description: AwaitExpression new MemberExpression (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ typeof UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+---*/
+
+
+typeof await new Promise(function(res, rej) { res(1); });
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-null.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-null.js
new file mode 100644
index 0000000000..fcb3fc4d32
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-null.js
@@ -0,0 +1,46 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-null.case
+// - src/top-level-await/syntax/typeof.template
+/*---
+description: AwaitExpression NullLiteral (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ typeof UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+typeof await null;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-obj-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-obj-literal.js
new file mode 100644
index 0000000000..bcd5864cda
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-obj-literal.js
@@ -0,0 +1,46 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-obj-literal.case
+// - src/top-level-await/syntax/typeof.template
+/*---
+description: AwaitExpression ObjectLiteral (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ typeof UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+typeof await { function() {} };
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-regexp.js
new file mode 100644
index 0000000000..5b3d5aee8b
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-regexp.js
@@ -0,0 +1,46 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-regexp.case
+// - src/top-level-await/syntax/typeof.template
+/*---
+description: AwaitExpression RegularExpressionLiteral (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ typeof UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+typeof await /1/;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-template-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-template-literal.js
new file mode 100644
index 0000000000..191b9528cc
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-template-literal.js
@@ -0,0 +1,46 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-template-literal.case
+// - src/top-level-await/syntax/typeof.template
+/*---
+description: AwaitExpression TemplateLiteral (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ typeof UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+typeof await ``;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-this.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-this.js
new file mode 100644
index 0000000000..795966ce9e
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-this.js
@@ -0,0 +1,46 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-this.case
+// - src/top-level-await/syntax/typeof.template
+/*---
+description: AwaitExpression this (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ typeof UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+typeof await this;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-array-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-array-literal.js
new file mode 100644
index 0000000000..983f83b502
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-array-literal.js
@@ -0,0 +1,46 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-array-literal.case
+// - src/top-level-await/syntax/void.template
+/*---
+description: AwaitExpression ArrayLiteral (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ void UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+void await [];
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-func-expression.js
new file mode 100644
index 0000000000..b1c559b88c
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-func-expression.js
@@ -0,0 +1,52 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-func-expression.case
+// - src/top-level-await/syntax/void.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ void UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+void await function() {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-identifier.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-identifier.js
new file mode 100644
index 0000000000..0b5eff7906
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-identifier.js
@@ -0,0 +1,47 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-identifier.case
+// - src/top-level-await/syntax/void.template
+/*---
+description: AwaitExpression IdentifierReference (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ void UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+var foo = 1;
+
+
+void await foo;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-literal-number.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-literal-number.js
new file mode 100644
index 0000000000..8b4da5200e
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-literal-number.js
@@ -0,0 +1,46 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-number.case
+// - src/top-level-await/syntax/void.template
+/*---
+description: AwaitExpression NumberLiteral (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ void UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+void await 1;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-literal-string.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-literal-string.js
new file mode 100644
index 0000000000..21b7cd0d2c
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-literal-string.js
@@ -0,0 +1,46 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-string.case
+// - src/top-level-await/syntax/void.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ void UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+void await '';
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-nested.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-nested.js
new file mode 100644
index 0000000000..0ee366b0fe
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-nested.js
@@ -0,0 +1,42 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-nested.case
+// - src/top-level-await/syntax/void.template
+/*---
+description: Nested AwaitExpressions (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ void UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+---*/
+
+
+void await await await await await await await await await await await await await await await 'await';
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-new-expr.js
new file mode 100644
index 0000000000..d8dd571c96
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-new-expr.js
@@ -0,0 +1,43 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-new-expr.case
+// - src/top-level-await/syntax/void.template
+/*---
+description: AwaitExpression new MemberExpression (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ void UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+---*/
+
+
+void await new Promise(function(res, rej) { res(1); });
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-null.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-null.js
new file mode 100644
index 0000000000..b6d4f8222a
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-null.js
@@ -0,0 +1,46 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-null.case
+// - src/top-level-await/syntax/void.template
+/*---
+description: AwaitExpression NullLiteral (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ void UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+void await null;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-obj-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-obj-literal.js
new file mode 100644
index 0000000000..f96ea26f1a
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-obj-literal.js
@@ -0,0 +1,46 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-obj-literal.case
+// - src/top-level-await/syntax/void.template
+/*---
+description: AwaitExpression ObjectLiteral (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ void UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+void await { function() {} };
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-regexp.js
new file mode 100644
index 0000000000..aa3b1206e2
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-regexp.js
@@ -0,0 +1,46 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-regexp.case
+// - src/top-level-await/syntax/void.template
+/*---
+description: AwaitExpression RegularExpressionLiteral (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ void UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+void await /1/;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-template-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-template-literal.js
new file mode 100644
index 0000000000..6a8e5351c3
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-template-literal.js
@@ -0,0 +1,46 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-template-literal.case
+// - src/top-level-await/syntax/void.template
+/*---
+description: AwaitExpression TemplateLiteral (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ void UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+void await ``;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-this.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-this.js
new file mode 100644
index 0000000000..dde34b5e37
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-this.js
@@ -0,0 +1,46 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-this.case
+// - src/top-level-await/syntax/void.template
+/*---
+description: AwaitExpression this (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ void UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+void await this;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-array-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-array-literal.js
new file mode 100644
index 0000000000..8b127326a1
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-array-literal.js
@@ -0,0 +1,50 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-array-literal.case
+// - src/top-level-await/syntax/while-expr.template
+/*---
+description: AwaitExpression ArrayLiteral (Valid syntax for top level await in an while expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ while ( Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+while (await []) { break; }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-func-expression.js
new file mode 100644
index 0000000000..2bbfbbfad6
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-func-expression.js
@@ -0,0 +1,56 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-func-expression.case
+// - src/top-level-await/syntax/while-expr.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in an while expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ while ( Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+while (await function() {}) { break; }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-identifier.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-identifier.js
new file mode 100644
index 0000000000..6645abb858
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-identifier.js
@@ -0,0 +1,51 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-identifier.case
+// - src/top-level-await/syntax/while-expr.template
+/*---
+description: AwaitExpression IdentifierReference (Valid syntax for top level await in an while expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ while ( Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+var foo = 1;
+
+
+while (await foo) { break; }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-literal-number.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-literal-number.js
new file mode 100644
index 0000000000..9b952da530
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-literal-number.js
@@ -0,0 +1,50 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-number.case
+// - src/top-level-await/syntax/while-expr.template
+/*---
+description: AwaitExpression NumberLiteral (Valid syntax for top level await in an while expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ while ( Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+while (await 1) { break; }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-literal-string.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-literal-string.js
new file mode 100644
index 0000000000..edc2d7f33c
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-literal-string.js
@@ -0,0 +1,50 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-string.case
+// - src/top-level-await/syntax/while-expr.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in an while expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ while ( Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+while (await '') { break; }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-nested.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-nested.js
new file mode 100644
index 0000000000..2cfb9d7a90
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-nested.js
@@ -0,0 +1,46 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-nested.case
+// - src/top-level-await/syntax/while-expr.template
+/*---
+description: Nested AwaitExpressions (Valid syntax for top level await in an while expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ while ( Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+---*/
+
+
+while (await await await await await await await await await await await await await await await 'await') { break; }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-new-expr.js
new file mode 100644
index 0000000000..255e10fbe0
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-new-expr.js
@@ -0,0 +1,47 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-new-expr.case
+// - src/top-level-await/syntax/while-expr.template
+/*---
+description: AwaitExpression new MemberExpression (Valid syntax for top level await in an while expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ while ( Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+---*/
+
+
+while (await new Promise(function(res, rej) { res(1); })) { break; }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-null.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-null.js
new file mode 100644
index 0000000000..8e85861880
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-null.js
@@ -0,0 +1,50 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-null.case
+// - src/top-level-await/syntax/while-expr.template
+/*---
+description: AwaitExpression NullLiteral (Valid syntax for top level await in an while expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ while ( Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+while (await null) { break; }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-obj-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-obj-literal.js
new file mode 100644
index 0000000000..c24f0bdc79
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-obj-literal.js
@@ -0,0 +1,50 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-obj-literal.case
+// - src/top-level-await/syntax/while-expr.template
+/*---
+description: AwaitExpression ObjectLiteral (Valid syntax for top level await in an while expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ while ( Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+while (await { function() {} }) { break; }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-regexp.js
new file mode 100644
index 0000000000..882450fcba
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-regexp.js
@@ -0,0 +1,50 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-regexp.case
+// - src/top-level-await/syntax/while-expr.template
+/*---
+description: AwaitExpression RegularExpressionLiteral (Valid syntax for top level await in an while expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ while ( Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+while (await /1/) { break; }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-template-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-template-literal.js
new file mode 100644
index 0000000000..4832d296d2
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-template-literal.js
@@ -0,0 +1,50 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-template-literal.case
+// - src/top-level-await/syntax/while-expr.template
+/*---
+description: AwaitExpression TemplateLiteral (Valid syntax for top level await in an while expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ while ( Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+while (await ``) { break; }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-this.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-this.js
new file mode 100644
index 0000000000..ef3819c7d4
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-this.js
@@ -0,0 +1,50 @@
+// |reftest| module
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-this.case
+// - src/top-level-await/syntax/while-expr.template
+/*---
+description: AwaitExpression this (Valid syntax for top level await in an while expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ while ( Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+while (await this) { break; }
+
+reportCompare(0, 0);