summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/module-code/top-level-await
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/tests/test262/language/module-code/top-level-await')
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/await-awaits-thenable-not-callable.js19
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/await-awaits-thenables-that-throw.js30
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/await-awaits-thenables.js21
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/await-dynamic-import-rejection.js54
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/await-dynamic-import-resolution.js55
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/await-expr-func-expression.js50
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/await-expr-new-expr-reject.js47
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/await-expr-new-expr.js44
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/await-expr-regexp.js57
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/await-expr-reject-throws.js92
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/await-expr-resolution.js59
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/await-void-expr.js29
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/browser.js0
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/dynamic-import-rejection.js55
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/dynamic-import-resolution.js53
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/early-errors-await-not-simple-assignment-target.js18
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/if-await-expr.js33
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/module-async-import-async-resolution-ticks.js87
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/module-import-rejection-body.js77
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/module-import-rejection-body_FIXTURE.js10
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/module-import-rejection-tick.js77
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/module-import-rejection-tick_FIXTURE.js13
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/module-import-rejection.js77
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/module-import-rejection_FIXTURE.js12
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/module-import-resolution.js82
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/module-import-resolution_FIXTURE.js15
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/module-import-unwrapped.js96
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/module-import-unwrapped_FIXTURE.js10
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/module-self-import-async-resolution-ticks.js89
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/module-sync-import-async-resolution-ticks.js82
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/new-await-parens.js20
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/new-await-script-code.js16
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/new-await.js18
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/no-operand.js18
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/shell.js0
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/await-expr-dyn-import.js44
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-array-literal.js79
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-func-expression.js85
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-identifier.js80
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-literal-number.js79
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-literal-string.js79
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-nested.js75
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-new-expr.js76
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-null.js79
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-obj-literal.js79
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-regexp.js79
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-template-literal.js79
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-this.js79
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/browser.js0
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/catch-parameter.js47
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/early-does-not-propagate-to-fn-declaration-body.js39
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/early-does-not-propagate-to-fn-declaration-params.js41
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/early-does-not-propagate-to-fn-expr-body.js31
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/early-does-not-propagate-to-fn-expr-params.js31
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/early-no-escaped-await.js26
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-array-literal.js71
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-func-expression.js77
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-identifier.js72
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-literal-number.js71
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-literal-string.js71
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-nested.js67
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-new-expr.js68
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-null.js71
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-obj-literal.js71
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-regexp.js71
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-template-literal.js71
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-this.js71
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-array-literal.js67
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-func-expression.js73
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-identifier.js68
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-literal-number.js67
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-literal-string.js67
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-nested.js63
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-new-expr.js64
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-null.js67
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-obj-literal.js67
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-regexp.js67
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-template-literal.js67
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-this.js67
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-array-literal.js71
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-func-expression.js77
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-identifier.js72
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-literal-number.js71
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-literal-string.js71
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-nested.js67
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-new-expr.js68
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-null.js71
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-obj-literal.js71
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-regexp.js71
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-template-literal.js71
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-this.js71
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-array-literal.js64
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-func-expression.js70
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-identifier.js65
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-literal-number.js64
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-literal-string.js64
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-nested.js60
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-new-expr.js61
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-null.js64
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-obj-literal.js64
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-regexp.js64
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-template-literal.js64
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-this.js64
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-array-literal.js67
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-func-expression.js73
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-identifier.js68
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-literal-number.js67
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-literal-string.js67
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-nested.js63
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-new-expr.js64
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-null.js67
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-obj-literal.js67
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-regexp.js67
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-template-literal.js67
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-this.js67
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-array-literal.js70
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-func-expression.js76
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-identifier.js71
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-literal-number.js70
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-literal-string.js70
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-nested.js66
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-new-expr.js67
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-null.js70
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-obj-literal.js70
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-regexp.js70
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-template-literal.js70
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-this.js70
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-array-literal.js76
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-func-expression.js82
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-identifier.js77
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-literal-number.js76
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-literal-string.js76
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-nested.js72
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-new-expr.js73
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-null.js76
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-obj-literal.js76
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-regexp.js76
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-template-literal.js76
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-this.js76
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-array-literal.js78
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-func-expression.js84
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-identifier.js79
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-literal-number.js78
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-literal-string.js78
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-nested.js74
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-new-expr.js75
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-null.js78
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-obj-literal.js78
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-regexp.js78
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-template-literal.js78
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-this.js78
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-array-literal.js78
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-func-expression.js84
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-identifier.js79
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-literal-number.js78
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-literal-string.js78
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-nested.js74
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-new-expr.js75
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-null.js78
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-obj-literal.js78
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-regexp.js78
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-template-literal.js78
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-this.js78
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-array-literal.js53
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-func-expression.js59
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-identifier.js54
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-literal-number.js53
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-literal-string.js53
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-nested.js49
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-new-expr.js50
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-null.js53
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-obj-literal.js53
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-regexp.js53
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-template-literal.js53
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-this.js53
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-array-literal.js51
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-func-expression.js57
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-identifier.js52
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-literal-number.js51
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-literal-string.js51
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-nested.js47
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-new-expr.js48
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-null.js51
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-obj-literal.js51
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-regexp.js51
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-template-literal.js51
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-this.js51
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/shell.js0
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-array-literal.js45
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-func-expression.js51
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-identifier.js46
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-literal-number.js45
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-literal-string.js45
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-nested.js41
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-new-expr.js42
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-null.js45
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-obj-literal.js45
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-regexp.js45
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-template-literal.js45
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-this.js45
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-array-literal.js70
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-func-expression.js76
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-identifier.js71
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-literal-number.js70
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-literal-string.js70
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-nested.js66
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-new-expr.js67
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-null.js70
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-obj-literal.js70
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-regexp.js70
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-template-literal.js70
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-this.js70
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-array-literal.js46
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-func-expression.js52
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-identifier.js47
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-literal-number.js46
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-literal-string.js46
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-nested.js42
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-new-expr.js43
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-null.js46
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-obj-literal.js46
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-regexp.js46
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-template-literal.js46
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-this.js46
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-array-literal.js46
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-func-expression.js52
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-identifier.js47
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-literal-number.js46
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-literal-string.js46
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-nested.js42
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-new-expr.js43
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-null.js46
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-obj-literal.js46
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-regexp.js46
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-template-literal.js46
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-this.js46
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-array-literal.js50
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-func-expression.js56
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-identifier.js51
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-literal-number.js50
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-literal-string.js50
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-nested.js46
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-new-expr.js47
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-null.js50
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-obj-literal.js50
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-regexp.js50
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-template-literal.js50
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-this.js50
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/top-level-ticks-2.js47
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/top-level-ticks.js47
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/void-await-expr.js36
-rw-r--r--js/src/tests/test262/language/module-code/top-level-await/while-dynamic-evaluation.js49
252 files changed, 14937 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/module-code/top-level-await/await-awaits-thenable-not-callable.js b/js/src/tests/test262/language/module-code/top-level-await/await-awaits-thenable-not-callable.js
new file mode 100644
index 0000000000..d29a3ee6ad
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/await-awaits-thenable-not-callable.js
@@ -0,0 +1,19 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module async -- requires shell-options
+// Copyright 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: prod-AwaitExpression
+description: >
+ Await can await any thenable. If the thenable's then is not callable,
+ await evaluates to the thenable
+flags: [module, async]
+features: [top-level-await]
+---*/
+
+var thenable = { then: 42 };
+var res = await thenable;
+assert.sameValue(res, thenable);
+
+$DONE();
+
diff --git a/js/src/tests/test262/language/module-code/top-level-await/await-awaits-thenables-that-throw.js b/js/src/tests/test262/language/module-code/top-level-await/await-awaits-thenables-that-throw.js
new file mode 100644
index 0000000000..a30a57201c
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/await-awaits-thenables-that-throw.js
@@ -0,0 +1,30 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module async -- requires shell-options
+// Copyright 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: prod-AwaitExpression
+description: >
+ Await can await any thenable.
+flags: [module, async]
+features: [top-level-await]
+---*/
+
+var error = {};
+var thenable = {
+ then: function (resolve, reject) {
+ throw error;
+ }
+}
+
+var caught = false;
+try {
+ await thenable;
+} catch(e) {
+ caught = e;
+
+}
+
+assert.sameValue(caught, error);
+
+$DONE();
diff --git a/js/src/tests/test262/language/module-code/top-level-await/await-awaits-thenables.js b/js/src/tests/test262/language/module-code/top-level-await/await-awaits-thenables.js
new file mode 100644
index 0000000000..6a0c91475b
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/await-awaits-thenables.js
@@ -0,0 +1,21 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module async -- requires shell-options
+// Copyright 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: prod-AwaitExpression
+description: >
+ Await can await any thenable.
+flags: [module, async]
+features: [top-level-await]
+---*/
+
+var thenable = {
+ then: function (resolve, reject) {
+ resolve(42);
+ }
+}
+
+assert.sameValue(await thenable, 42);
+
+$DONE();
diff --git a/js/src/tests/test262/language/module-code/top-level-await/await-dynamic-import-rejection.js b/js/src/tests/test262/language/module-code/top-level-await/await-dynamic-import-rejection.js
new file mode 100644
index 0000000000..24b17a21df
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/await-dynamic-import-rejection.js
@@ -0,0 +1,54 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) error:TypeError module -- requires shell-options
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-moduleevaluation
+description: >
+ Top Level Await on a Dynamic import
+info: |
+ InnerModuleEvaluation( module, stack, index )
+
+ ...
+ 14. If module.[[PendingAsyncDependencies]] is > 0, set module.[[AsyncEvaluating]] to true.
+ 15. Otherwise, if module.[[Async]] is true, perform ! ExecuteAsyncModule(module).
+ 16. Otherwise, perform ? module.ExecuteModule().
+
+ ExecuteAsyncModule ( module )
+
+ 1. Assert: module.[[Status]] is "evaluating" or "evaluated".
+ 2. Assert: module.[[Async]] is true.
+ 3. Set module.[[AsyncEvaluating]] to true.
+ 4. Let capability be ! NewPromiseCapability(%Promise%).
+ 5. Let stepsFulfilled be the steps of a CallAsyncModuleFulfilled function as specified below.
+ ...
+ 8. Let stepsRejected be the steps of a CallAsyncModuleRejected function as specified below.
+ ...
+ 11. Perform ! PerformPromiseThen(capability.[[Promise]], onFulfilled, onRejected).
+ 12. Perform ! module.ExecuteModule(capability).
+ 13. Return.
+
+ ExecuteModule ( [ capability ] )
+
+ ...
+ 11. If module.[[Async]] is false, then
+ a. Assert: capability was not provided.
+ b. Push moduleCxt on to the execution context stack; moduleCxt is now the running execution context.
+ c. Let result be the result of evaluating module.[[ECMAScriptCode]].
+ d. Suspend moduleCxt and remove it from the execution context stack.
+ e. Resume the context that is now on the top of the execution context stack as the running execution context.
+ f. Return Completion(result).
+ 12. Otherwise,
+ a. Assert: capability is a PromiseCapability Record.
+ b. Perform ! AsyncBlockStart(capability, module.[[ECMAScriptCode]], moduleCxt).
+ c. Return.
+flags: [module]
+features: [top-level-await, dynamic-import]
+negative:
+ phase: runtime
+ type: TypeError
+---*/
+
+await import('./module-import-rejection-body_FIXTURE.js');
+
+throw new Test262Error('this should be unreachable');
diff --git a/js/src/tests/test262/language/module-code/top-level-await/await-dynamic-import-resolution.js b/js/src/tests/test262/language/module-code/top-level-await/await-dynamic-import-resolution.js
new file mode 100644
index 0000000000..d5c07bd8cc
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/await-dynamic-import-resolution.js
@@ -0,0 +1,55 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module async -- requires shell-options
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-moduleevaluation
+description: >
+ Top Level Await on a Dynamic import
+info: |
+ InnerModuleEvaluation( module, stack, index )
+
+ ...
+ 14. If module.[[PendingAsyncDependencies]] is > 0, set module.[[AsyncEvaluating]] to true.
+ 15. Otherwise, if module.[[Async]] is true, perform ! ExecuteAsyncModule(module).
+ 16. Otherwise, perform ? module.ExecuteModule().
+
+ ExecuteAsyncModule ( module )
+
+ 1. Assert: module.[[Status]] is "evaluating" or "evaluated".
+ 2. Assert: module.[[Async]] is true.
+ 3. Set module.[[AsyncEvaluating]] to true.
+ 4. Let capability be ! NewPromiseCapability(%Promise%).
+ 5. Let stepsFulfilled be the steps of a CallAsyncModuleFulfilled function as specified below.
+ ...
+ 8. Let stepsRejected be the steps of a CallAsyncModuleRejected function as specified below.
+ ...
+ 11. Perform ! PerformPromiseThen(capability.[[Promise]], onFulfilled, onRejected).
+ 12. Perform ! module.ExecuteModule(capability).
+ 13. Return.
+
+ ExecuteModule ( [ capability ] )
+
+ ...
+ 11. If module.[[Async]] is false, then
+ a. Assert: capability was not provided.
+ b. Push moduleCxt on to the execution context stack; moduleCxt is now the running execution context.
+ c. Let result be the result of evaluating module.[[ECMAScriptCode]].
+ d. Suspend moduleCxt and remove it from the execution context stack.
+ e. Resume the context that is now on the top of the execution context stack as the running execution context.
+ f. Return Completion(result).
+ 12. Otherwise,
+ a. Assert: capability is a PromiseCapability Record.
+ b. Perform ! AsyncBlockStart(capability, module.[[ECMAScriptCode]], moduleCxt).
+ c. Return.
+flags: [module, async]
+features: [top-level-await, dynamic-import]
+---*/
+
+var ns = await import('./module-import-resolution_FIXTURE.js');
+
+assert.sameValue(ns.default, 42);
+assert.sameValue(ns.x, 'named');
+assert.sameValue(ns.y, 39);
+
+$DONE();
diff --git a/js/src/tests/test262/language/module-code/top-level-await/await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/await-expr-func-expression.js
new file mode 100644
index 0000000000..4e67f579bf
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/await-expr-func-expression.js
@@ -0,0 +1,50 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module async -- requires shell-options
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ A function after top level await is an expression and not a hoistable declaration
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+esid: prod-AwaitExpression
+flags: [module, async]
+features: [top-level-await]
+---*/
+
+function fn() { return 42; }
+await function fn() { return 111; };
+
+assert.sameValue(fn(), 42);
+
+$DONE();
diff --git a/js/src/tests/test262/language/module-code/top-level-await/await-expr-new-expr-reject.js b/js/src/tests/test262/language/module-code/top-level-await/await-expr-new-expr-reject.js
new file mode 100644
index 0000000000..b8e3559bb5
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/await-expr-new-expr-reject.js
@@ -0,0 +1,47 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module async -- requires shell-options
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Evaluation of a rejected promise
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+esid: prod-AwaitExpression
+flags: [module, async]
+features: [top-level-await]
+---*/
+
+var obj = new Test262Error();
+
+try {
+ await Promise.reject(obj);
+} catch (e) {
+ assert.sameValue(e, obj);
+ $DONE();
+}
+
+// Can't use assert.throws here as it relies in a nested function.
diff --git a/js/src/tests/test262/language/module-code/top-level-await/await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/await-expr-new-expr.js
new file mode 100644
index 0000000000..351d0de020
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/await-expr-new-expr.js
@@ -0,0 +1,44 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module async -- requires shell-options
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Evaluation of await before a NewExpression
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+esid: prod-AwaitExpression
+flags: [module, async]
+features: [top-level-await]
+---*/
+
+var value = await new Promise(function(res, rej) {
+ res(42);
+});
+
+assert.sameValue(value, 42);
+
+$DONE();
diff --git a/js/src/tests/test262/language/module-code/top-level-await/await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/await-expr-regexp.js
new file mode 100644
index 0000000000..9b865aa5b2
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/await-expr-regexp.js
@@ -0,0 +1,57 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module async -- requires shell-options
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Verify a RegularExpressionLiteral following an AwaitExpression is
+ not ambiguous to an Division
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+esid: prod-AwaitExpression
+flags: [module, async]
+features: [top-level-await]
+---*/
+
+var lol = false;
+var x = {
+ get y() {
+ lol = true;
+ }
+};
+
+var g = 42;
+
+await /x.y/g;
+
+if (lol) {
+ $DONE('It should be a RegExp');
+} else {
+ $DONE();
+}
diff --git a/js/src/tests/test262/language/module-code/top-level-await/await-expr-reject-throws.js b/js/src/tests/test262/language/module-code/top-level-await/await-expr-reject-throws.js
new file mode 100644
index 0000000000..aae2d2f69d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/await-expr-reject-throws.js
@@ -0,0 +1,92 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module async -- requires shell-options
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ AwaitExpression evaluates to abrupt completions in promise rejections
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ void UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+esid: prod-AwaitExpression
+flags: [module, async]
+features: [top-level-await]
+---*/
+
+var x;
+
+try {
+ await Promise.reject(42);
+} catch (e) {
+ x = e;
+}
+assert.sameValue(x, 42, 'number');
+
+try {
+ await Promise.reject('');
+} catch (e) {
+ x = e;
+}
+assert.sameValue(x, '', 'string');
+
+try {
+ var s = Symbol();
+ await Promise.reject(s);
+} catch (e) {
+ x = e;
+}
+assert.sameValue(x, s, 'symbol');
+
+try {
+ await Promise.reject(false);
+} catch (e) {
+ x = e;
+}
+assert.sameValue(x, false, 'false');
+
+try {
+ await Promise.reject(true);
+} catch (e) {
+ x = e;
+}
+assert.sameValue(x, true, 'true');
+
+try {
+ await Promise.reject(NaN);
+} catch (e) {
+ x = e;
+}
+assert.sameValue(x, NaN, 'NaN');
+
+try {
+ await Promise.reject(null);
+} catch (e) {
+ x = e;
+}
+assert.sameValue(x, null, 'null');
+
+try {
+ await Promise.reject(undefined);
+} catch (e) {
+ x = e;
+}
+assert.sameValue(x, undefined, 'undefined');
+
+try {
+ var obj = {};
+ await Promise.reject(obj);
+} catch (e) {
+ x = e;
+}
+assert.sameValue(x, obj, 'object');
+
+$DONE();
diff --git a/js/src/tests/test262/language/module-code/top-level-await/await-expr-resolution.js b/js/src/tests/test262/language/module-code/top-level-await/await-expr-resolution.js
new file mode 100644
index 0000000000..55b0768053
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/await-expr-resolution.js
@@ -0,0 +1,59 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module async -- requires shell-options
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ AwaitExpression Resolutions
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ void UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+esid: prod-AwaitExpression
+flags: [module, async]
+features: [top-level-await]
+---*/
+
+var x;
+
+x = await 42;
+assert.sameValue(x, 42, 'number');
+
+x = await '';
+assert.sameValue(x, '', 'string');
+
+var s = Symbol();
+x = await s;
+assert.sameValue(x, s, 'symbol');
+
+x = await false;
+assert.sameValue(x, false, 'false');
+
+x = await true;
+assert.sameValue(x, true, 'true');
+
+x = await NaN;
+assert.sameValue(x, NaN, 'NaN');
+
+x = await null;
+assert.sameValue(x, null, 'null');
+
+x = await undefined;
+assert.sameValue(x, undefined, 'undefined');
+
+var obj = {};
+x = await obj;
+assert.sameValue(x, obj, 'object');
+
+x = await Promise.resolve(1).then(v => v * 2).then(v => v * 3);
+assert.sameValue(x, 6, 'promise');
+
+$DONE();
diff --git a/js/src/tests/test262/language/module-code/top-level-await/await-void-expr.js b/js/src/tests/test262/language/module-code/top-level-await/await-void-expr.js
new file mode 100644
index 0000000000..dd2ae22174
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/await-void-expr.js
@@ -0,0 +1,29 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module async -- requires shell-options
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ AwaitExpression void resolves into undefined
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ void UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+esid: prod-AwaitExpression
+flags: [module, async]
+features: [top-level-await]
+---*/
+
+var x = await void 1;
+
+assert.sameValue(x, undefined);
+
+$DONE();
diff --git a/js/src/tests/test262/language/module-code/top-level-await/browser.js b/js/src/tests/test262/language/module-code/top-level-await/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/browser.js
diff --git a/js/src/tests/test262/language/module-code/top-level-await/dynamic-import-rejection.js b/js/src/tests/test262/language/module-code/top-level-await/dynamic-import-rejection.js
new file mode 100644
index 0000000000..6d10bf42a0
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/dynamic-import-rejection.js
@@ -0,0 +1,55 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module async -- requires shell-options
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-moduleevaluation
+description: >
+ Dynamic imported module with async exports
+info: |
+ InnerModuleEvaluation( module, stack, index )
+
+ ...
+ 14. If module.[[PendingAsyncDependencies]] is > 0, set module.[[AsyncEvaluating]] to true.
+ 15. Otherwise, if module.[[Async]] is true, perform ! ExecuteAsyncModule(module).
+ 16. Otherwise, perform ? module.ExecuteModule().
+
+ ExecuteAsyncModule ( module )
+
+ 1. Assert: module.[[Status]] is "evaluating" or "evaluated".
+ 2. Assert: module.[[Async]] is true.
+ 3. Set module.[[AsyncEvaluating]] to true.
+ 4. Let capability be ! NewPromiseCapability(%Promise%).
+ 5. Let stepsFulfilled be the steps of a CallAsyncModuleFulfilled function as specified below.
+ ...
+ 8. Let stepsRejected be the steps of a CallAsyncModuleRejected function as specified below.
+ ...
+ 11. Perform ! PerformPromiseThen(capability.[[Promise]], onFulfilled, onRejected).
+ 12. Perform ! module.ExecuteModule(capability).
+ 13. Return.
+
+ ExecuteModule ( [ capability ] )
+
+ ...
+ 11. If module.[[Async]] is false, then
+ a. Assert: capability was not provided.
+ b. Push moduleCxt on to the execution context stack; moduleCxt is now the running execution context.
+ c. Let result be the result of evaluating module.[[ECMAScriptCode]].
+ d. Suspend moduleCxt and remove it from the execution context stack.
+ e. Resume the context that is now on the top of the execution context stack as the running execution context.
+ f. Return Completion(result).
+ 12. Otherwise,
+ a. Assert: capability is a PromiseCapability Record.
+ b. Perform ! AsyncBlockStart(capability, module.[[ECMAScriptCode]], moduleCxt).
+ c. Return.
+flags: [module, async]
+features: [top-level-await, dynamic-import]
+---*/
+
+import('./module-import-rejection_FIXTURE.js').then(() => {
+ throw new Test262Error('Should not be fulfilled');
+}, (err) => {
+ assert(err instanceof TypeError);
+ assert.sameValue(err.constructor, TypeError);
+ assert.sameValue(err.message, 'error in the default export line');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/dynamic-import-resolution.js b/js/src/tests/test262/language/module-code/top-level-await/dynamic-import-resolution.js
new file mode 100644
index 0000000000..873d5cff82
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/dynamic-import-resolution.js
@@ -0,0 +1,53 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module async -- requires shell-options
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-moduleevaluation
+description: >
+ Dynamic imported module with async exports
+info: |
+ InnerModuleEvaluation( module, stack, index )
+
+ ...
+ 14. If module.[[PendingAsyncDependencies]] is > 0, set module.[[AsyncEvaluating]] to true.
+ 15. Otherwise, if module.[[Async]] is true, perform ! ExecuteAsyncModule(module).
+ 16. Otherwise, perform ? module.ExecuteModule().
+
+ ExecuteAsyncModule ( module )
+
+ 1. Assert: module.[[Status]] is "evaluating" or "evaluated".
+ 2. Assert: module.[[Async]] is true.
+ 3. Set module.[[AsyncEvaluating]] to true.
+ 4. Let capability be ! NewPromiseCapability(%Promise%).
+ 5. Let stepsFulfilled be the steps of a CallAsyncModuleFulfilled function as specified below.
+ ...
+ 8. Let stepsRejected be the steps of a CallAsyncModuleRejected function as specified below.
+ ...
+ 11. Perform ! PerformPromiseThen(capability.[[Promise]], onFulfilled, onRejected).
+ 12. Perform ! module.ExecuteModule(capability).
+ 13. Return.
+
+ ExecuteModule ( [ capability ] )
+
+ ...
+ 11. If module.[[Async]] is false, then
+ a. Assert: capability was not provided.
+ b. Push moduleCxt on to the execution context stack; moduleCxt is now the running execution context.
+ c. Let result be the result of evaluating module.[[ECMAScriptCode]].
+ d. Suspend moduleCxt and remove it from the execution context stack.
+ e. Resume the context that is now on the top of the execution context stack as the running execution context.
+ f. Return Completion(result).
+ 12. Otherwise,
+ a. Assert: capability is a PromiseCapability Record.
+ b. Perform ! AsyncBlockStart(capability, module.[[ECMAScriptCode]], moduleCxt).
+ c. Return.
+flags: [module, async]
+features: [top-level-await, dynamic-import]
+---*/
+
+import('./module-import-resolution_FIXTURE.js').then(ns => {
+ assert.sameValue(ns.default, 42);
+ assert.sameValue(ns.x, 'named');
+ assert.sameValue(ns.y, 39);
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/early-errors-await-not-simple-assignment-target.js b/js/src/tests/test262/language/module-code/top-level-await/early-errors-await-not-simple-assignment-target.js
new file mode 100644
index 0000000000..dcb617d6a6
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/early-errors-await-not-simple-assignment-target.js
@@ -0,0 +1,18 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) error:SyntaxError module -- requires shell-options
+// Copyright 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: prod-AwaitExpression
+description: >
+ await is not a simple assignment target and cannot be assigned to.
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+features: [top-level-await]
+---*/
+
+$DONOTEVALUATE();
+
+(await 1) = 1;
diff --git a/js/src/tests/test262/language/module-code/top-level-await/if-await-expr.js b/js/src/tests/test262/language/module-code/top-level-await/if-await-expr.js
new file mode 100644
index 0000000000..a1484ff35b
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/if-await-expr.js
@@ -0,0 +1,33 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module async -- requires shell-options
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Evaluate Await expression for IfStatement
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+esid: prod-AwaitExpression
+flags: [module, async]
+features: [top-level-await]
+---*/
+
+var completed = 0;
+var p = Promise.resolve(true);
+
+if (await p) {
+ completed += 1;
+}
+
+assert.sameValue(completed, 1);
+
+$DONE();
diff --git a/js/src/tests/test262/language/module-code/top-level-await/module-async-import-async-resolution-ticks.js b/js/src/tests/test262/language/module-code/top-level-await/module-async-import-async-resolution-ticks.js
new file mode 100644
index 0000000000..4657c9af32
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/module-async-import-async-resolution-ticks.js
@@ -0,0 +1,87 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module async -- requires shell-options
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-moduleevaluation
+description: >
+ Ticks from async module (w/ TLA) won't change loading async module
+info: |
+ Table 3: Additional Fields of Cyclic Module Records
+
+ [[Async]]
+
+ ...
+ Having an asynchronous dependency does not make the module asynchronous. This field must not change after the module is parsed.
+
+ Evaluate ( ) Concrete Method
+
+ ...
+ 6. Let capability be ! NewPromiseCapability(%Promise%).
+ 7. Set module.[[TopLevelCapability]] to capability.
+ 8. Let result be InnerModuleEvaluation(module, stack, 0).
+ 9. If result is an abrupt completion, then
+ ...
+ d. Perform ! Call(capability.[[Reject]], undefined, «result.[[Value]]»).
+ 10. Otherwise,
+ ...
+ b. If module.[[AsyncEvaluating]] is false, then
+ i. Perform ! Call(capability.[[Resolve]], undefined, «undefined»).
+ ...
+ 11. Return undefinedcapability.[[Promise]].
+
+ InnerModuleEvaluation( module, stack, index )
+
+ ...
+ 14. If module.[[PendingAsyncDependencies]] is > 0, set module.[[AsyncEvaluating]] to true.
+ 15. Otherwise, if module.[[Async]] is true, perform ! ExecuteAsyncModule(module).
+ 16. Otherwise, perform ? module.ExecuteModule().
+
+ ExecuteAsyncModule ( module )
+
+ 1. Assert: module.[[Status]] is "evaluating" or "evaluated".
+ 2. Assert: module.[[Async]] is true.
+ 3. Set module.[[AsyncEvaluating]] to true.
+ 4. Let capability be ! NewPromiseCapability(%Promise%).
+ 5. Let stepsFulfilled be the steps of a CallAsyncModuleFulfilled function as specified below.
+ ...
+ 8. Let stepsRejected be the steps of a CallAsyncModuleRejected function as specified below.
+ ...
+ 11. Perform ! PerformPromiseThen(capability.[[Promise]], onFulfilled, onRejected).
+ 12. Perform ! module.ExecuteModule(capability).
+ 13. Return.
+
+ ExecuteModule ( [ capability ] )
+
+ ...
+ 11. If module.[[Async]] is false, then
+ a. Assert: capability was not provided.
+ b. Push moduleCxt on to the execution context stack; moduleCxt is now the running execution context.
+ c. Let result be the result of evaluating module.[[ECMAScriptCode]].
+ d. Suspend moduleCxt and remove it from the execution context stack.
+ e. Resume the context that is now on the top of the execution context stack as the running execution context.
+ f. Return Completion(result).
+ 12. Otherwise,
+ a. Assert: capability is a PromiseCapability Record.
+ b. Perform ! AsyncBlockStart(capability, module.[[ECMAScriptCode]], moduleCxt).
+ c. Return.
+flags: [module, async]
+features: [top-level-await]
+---*/
+
+var x = 'synchronous evaluation';
+
+Promise.resolve().then(() => x = 'tick in the async evaluation');
+
+// module 'foo' won't tick here
+import foo from './module-import-resolution_FIXTURE.js';
+
+assert.sameValue(foo, 42);
+assert.sameValue(x, 'synchronous evaluation');
+
+// Enforce [[Async]] to true, and tick
+await 1;
+
+assert.sameValue(x, 'tick in the async evaluation');
+
+$DONE();
diff --git a/js/src/tests/test262/language/module-code/top-level-await/module-import-rejection-body.js b/js/src/tests/test262/language/module-code/top-level-await/module-import-rejection-body.js
new file mode 100644
index 0000000000..060e302d01
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/module-import-rejection-body.js
@@ -0,0 +1,77 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) error:TypeError module -- requires shell-options
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-moduleevaluation
+description: >
+ Evaluate imported rejected module
+info: |
+ Table 3: Additional Fields of Cyclic Module Records
+
+ [[Async]]
+
+ ...
+ Having an asynchronous dependency does not make the module asynchronous. This field must not change after the module is parsed.
+
+ Evaluate ( ) Concrete Method
+
+ ...
+ 6. Let capability be ! NewPromiseCapability(%Promise%).
+ 7. Set module.[[TopLevelCapability]] to capability.
+ 8. Let result be InnerModuleEvaluation(module, stack, 0).
+ 9. If result is an abrupt completion, then
+ ...
+ d. Perform ! Call(capability.[[Reject]], undefined, «result.[[Value]]»).
+ 10. Otherwise,
+ ...
+ b. If module.[[AsyncEvaluating]] is false, then
+ i. Perform ! Call(capability.[[Resolve]], undefined, «undefined»).
+ ...
+ 11. Return undefinedcapability.[[Promise]].
+
+ InnerModuleEvaluation( module, stack, index )
+
+ ...
+ 14. If module.[[PendingAsyncDependencies]] is > 0, set module.[[AsyncEvaluating]] to true.
+ 15. Otherwise, if module.[[Async]] is true, perform ! ExecuteAsyncModule(module).
+ 16. Otherwise, perform ? module.ExecuteModule().
+
+ ExecuteAsyncModule ( module )
+
+ 1. Assert: module.[[Status]] is "evaluating" or "evaluated".
+ 2. Assert: module.[[Async]] is true.
+ 3. Set module.[[AsyncEvaluating]] to true.
+ 4. Let capability be ! NewPromiseCapability(%Promise%).
+ 5. Let stepsFulfilled be the steps of a CallAsyncModuleFulfilled function as specified below.
+ ...
+ 8. Let stepsRejected be the steps of a CallAsyncModuleRejected function as specified below.
+ ...
+ 11. Perform ! PerformPromiseThen(capability.[[Promise]], onFulfilled, onRejected).
+ 12. Perform ! module.ExecuteModule(capability).
+ 13. Return.
+
+ ExecuteModule ( [ capability ] )
+
+ ...
+ 11. If module.[[Async]] is false, then
+ a. Assert: capability was not provided.
+ b. Push moduleCxt on to the execution context stack; moduleCxt is now the running execution context.
+ c. Let result be the result of evaluating module.[[ECMAScriptCode]].
+ d. Suspend moduleCxt and remove it from the execution context stack.
+ e. Resume the context that is now on the top of the execution context stack as the running execution context.
+ f. Return Completion(result).
+ 12. Otherwise,
+ a. Assert: capability is a PromiseCapability Record.
+ b. Perform ! AsyncBlockStart(capability, module.[[ECMAScriptCode]], moduleCxt).
+ c. Return.
+flags: [module]
+features: [top-level-await]
+negative:
+ phase: runtime
+ type: TypeError
+---*/
+
+import foo from './module-import-rejection-body_FIXTURE.js';
+
+throw new Test262Error('this should be unreachable');
diff --git a/js/src/tests/test262/language/module-code/top-level-await/module-import-rejection-body_FIXTURE.js b/js/src/tests/test262/language/module-code/top-level-await/module-import-rejection-body_FIXTURE.js
new file mode 100644
index 0000000000..8d8173db71
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/module-import-rejection-body_FIXTURE.js
@@ -0,0 +1,10 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export default 42;
+
+export const named = 'named';
+
+var rejection = Promise.reject(new TypeError('I reject this!'));
+await rejection;
diff --git a/js/src/tests/test262/language/module-code/top-level-await/module-import-rejection-tick.js b/js/src/tests/test262/language/module-code/top-level-await/module-import-rejection-tick.js
new file mode 100644
index 0000000000..9ed3bd2ce7
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/module-import-rejection-tick.js
@@ -0,0 +1,77 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) error:RangeError module -- requires shell-options
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-moduleevaluation
+description: >
+ Evaluate imported rejected module
+info: |
+ Table 3: Additional Fields of Cyclic Module Records
+
+ [[Async]]
+
+ ...
+ Having an asynchronous dependency does not make the module asynchronous. This field must not change after the module is parsed.
+
+ Evaluate ( ) Concrete Method
+
+ ...
+ 6. Let capability be ! NewPromiseCapability(%Promise%).
+ 7. Set module.[[TopLevelCapability]] to capability.
+ 8. Let result be InnerModuleEvaluation(module, stack, 0).
+ 9. If result is an abrupt completion, then
+ ...
+ d. Perform ! Call(capability.[[Reject]], undefined, «result.[[Value]]»).
+ 10. Otherwise,
+ ...
+ b. If module.[[AsyncEvaluating]] is false, then
+ i. Perform ! Call(capability.[[Resolve]], undefined, «undefined»).
+ ...
+ 11. Return undefinedcapability.[[Promise]].
+
+ InnerModuleEvaluation( module, stack, index )
+
+ ...
+ 14. If module.[[PendingAsyncDependencies]] is > 0, set module.[[AsyncEvaluating]] to true.
+ 15. Otherwise, if module.[[Async]] is true, perform ! ExecuteAsyncModule(module).
+ 16. Otherwise, perform ? module.ExecuteModule().
+
+ ExecuteAsyncModule ( module )
+
+ 1. Assert: module.[[Status]] is "evaluating" or "evaluated".
+ 2. Assert: module.[[Async]] is true.
+ 3. Set module.[[AsyncEvaluating]] to true.
+ 4. Let capability be ! NewPromiseCapability(%Promise%).
+ 5. Let stepsFulfilled be the steps of a CallAsyncModuleFulfilled function as specified below.
+ ...
+ 8. Let stepsRejected be the steps of a CallAsyncModuleRejected function as specified below.
+ ...
+ 11. Perform ! PerformPromiseThen(capability.[[Promise]], onFulfilled, onRejected).
+ 12. Perform ! module.ExecuteModule(capability).
+ 13. Return.
+
+ ExecuteModule ( [ capability ] )
+
+ ...
+ 11. If module.[[Async]] is false, then
+ a. Assert: capability was not provided.
+ b. Push moduleCxt on to the execution context stack; moduleCxt is now the running execution context.
+ c. Let result be the result of evaluating module.[[ECMAScriptCode]].
+ d. Suspend moduleCxt and remove it from the execution context stack.
+ e. Resume the context that is now on the top of the execution context stack as the running execution context.
+ f. Return Completion(result).
+ 12. Otherwise,
+ a. Assert: capability is a PromiseCapability Record.
+ b. Perform ! AsyncBlockStart(capability, module.[[ECMAScriptCode]], moduleCxt).
+ c. Return.
+flags: [module]
+features: [top-level-await]
+negative:
+ phase: runtime
+ type: RangeError
+---*/
+
+import foo from './module-import-rejection-tick_FIXTURE.js';
+
+throw new Test262Error('this should be unreachable');
diff --git a/js/src/tests/test262/language/module-code/top-level-await/module-import-rejection-tick_FIXTURE.js b/js/src/tests/test262/language/module-code/top-level-await/module-import-rejection-tick_FIXTURE.js
new file mode 100644
index 0000000000..4fedc13aa4
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/module-import-rejection-tick_FIXTURE.js
@@ -0,0 +1,13 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export default 42;
+
+await Promise.resolve().then(() => {
+ // This rejection will tick first unwrapping all the promises first
+ return Promise.reject(new RangeError());
+});
+
+var rejection = Promise.reject(new TypeError());
+await rejection;
diff --git a/js/src/tests/test262/language/module-code/top-level-await/module-import-rejection.js b/js/src/tests/test262/language/module-code/top-level-await/module-import-rejection.js
new file mode 100644
index 0000000000..5791989cab
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/module-import-rejection.js
@@ -0,0 +1,77 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) error:TypeError module -- requires shell-options
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-moduleevaluation
+description: >
+ Evaluate imported rejected module
+info: |
+ Table 3: Additional Fields of Cyclic Module Records
+
+ [[Async]]
+
+ ...
+ Having an asynchronous dependency does not make the module asynchronous. This field must not change after the module is parsed.
+
+ Evaluate ( ) Concrete Method
+
+ ...
+ 6. Let capability be ! NewPromiseCapability(%Promise%).
+ 7. Set module.[[TopLevelCapability]] to capability.
+ 8. Let result be InnerModuleEvaluation(module, stack, 0).
+ 9. If result is an abrupt completion, then
+ ...
+ d. Perform ! Call(capability.[[Reject]], undefined, «result.[[Value]]»).
+ 10. Otherwise,
+ ...
+ b. If module.[[AsyncEvaluating]] is false, then
+ i. Perform ! Call(capability.[[Resolve]], undefined, «undefined»).
+ ...
+ 11. Return undefinedcapability.[[Promise]].
+
+ InnerModuleEvaluation( module, stack, index )
+
+ ...
+ 14. If module.[[PendingAsyncDependencies]] is > 0, set module.[[AsyncEvaluating]] to true.
+ 15. Otherwise, if module.[[Async]] is true, perform ! ExecuteAsyncModule(module).
+ 16. Otherwise, perform ? module.ExecuteModule().
+
+ ExecuteAsyncModule ( module )
+
+ 1. Assert: module.[[Status]] is "evaluating" or "evaluated".
+ 2. Assert: module.[[Async]] is true.
+ 3. Set module.[[AsyncEvaluating]] to true.
+ 4. Let capability be ! NewPromiseCapability(%Promise%).
+ 5. Let stepsFulfilled be the steps of a CallAsyncModuleFulfilled function as specified below.
+ ...
+ 8. Let stepsRejected be the steps of a CallAsyncModuleRejected function as specified below.
+ ...
+ 11. Perform ! PerformPromiseThen(capability.[[Promise]], onFulfilled, onRejected).
+ 12. Perform ! module.ExecuteModule(capability).
+ 13. Return.
+
+ ExecuteModule ( [ capability ] )
+
+ ...
+ 11. If module.[[Async]] is false, then
+ a. Assert: capability was not provided.
+ b. Push moduleCxt on to the execution context stack; moduleCxt is now the running execution context.
+ c. Let result be the result of evaluating module.[[ECMAScriptCode]].
+ d. Suspend moduleCxt and remove it from the execution context stack.
+ e. Resume the context that is now on the top of the execution context stack as the running execution context.
+ f. Return Completion(result).
+ 12. Otherwise,
+ a. Assert: capability is a PromiseCapability Record.
+ b. Perform ! AsyncBlockStart(capability, module.[[ECMAScriptCode]], moduleCxt).
+ c. Return.
+flags: [module]
+features: [top-level-await]
+negative:
+ phase: runtime
+ type: TypeError
+---*/
+
+import { resolved } from './module-import-rejection_FIXTURE.js';
+
+throw new Test262Error('this should be unreachable');
diff --git a/js/src/tests/test262/language/module-code/top-level-await/module-import-rejection_FIXTURE.js b/js/src/tests/test262/language/module-code/top-level-await/module-import-rejection_FIXTURE.js
new file mode 100644
index 0000000000..3a5d4d024e
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/module-import-rejection_FIXTURE.js
@@ -0,0 +1,12 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+export const resolved = await 42;
+
+// Can't use Test262Error in this file because it's not referenced here
+export default await Promise.reject(new TypeError('error in the default export line'));
+
+// Use RangeError to differentiate from initial error
+export const x = await Promise.reject(new RangeError('named x rejection'));
+export const y = await Promise.reject(new RangeError('named y rejection'));
diff --git a/js/src/tests/test262/language/module-code/top-level-await/module-import-resolution.js b/js/src/tests/test262/language/module-code/top-level-await/module-import-resolution.js
new file mode 100644
index 0000000000..d981a8d28a
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/module-import-resolution.js
@@ -0,0 +1,82 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module async -- requires shell-options
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-moduleevaluation
+description: >
+ Evaluate imported module with async exports
+info: |
+ Table 3: Additional Fields of Cyclic Module Records
+
+ [[Async]]
+
+ ...
+ Having an asynchronous dependency does not make the module asynchronous. This field must not change after the module is parsed.
+
+ Evaluate ( ) Concrete Method
+
+ ...
+ 6. Let capability be ! NewPromiseCapability(%Promise%).
+ 7. Set module.[[TopLevelCapability]] to capability.
+ 8. Let result be InnerModuleEvaluation(module, stack, 0).
+ 9. If result is an abrupt completion, then
+ ...
+ d. Perform ! Call(capability.[[Reject]], undefined, «result.[[Value]]»).
+ 10. Otherwise,
+ ...
+ b. If module.[[AsyncEvaluating]] is false, then
+ i. Perform ! Call(capability.[[Resolve]], undefined, «undefined»).
+ ...
+ 11. Return undefinedcapability.[[Promise]].
+
+ InnerModuleEvaluation( module, stack, index )
+
+ ...
+ 14. If module.[[PendingAsyncDependencies]] is > 0, set module.[[AsyncEvaluating]] to true.
+ 15. Otherwise, if module.[[Async]] is true, perform ! ExecuteAsyncModule(module).
+ 16. Otherwise, perform ? module.ExecuteModule().
+
+ ExecuteAsyncModule ( module )
+
+ 1. Assert: module.[[Status]] is "evaluating" or "evaluated".
+ 2. Assert: module.[[Async]] is true.
+ 3. Set module.[[AsyncEvaluating]] to true.
+ 4. Let capability be ! NewPromiseCapability(%Promise%).
+ 5. Let stepsFulfilled be the steps of a CallAsyncModuleFulfilled function as specified below.
+ ...
+ 8. Let stepsRejected be the steps of a CallAsyncModuleRejected function as specified below.
+ ...
+ 11. Perform ! PerformPromiseThen(capability.[[Promise]], onFulfilled, onRejected).
+ 12. Perform ! module.ExecuteModule(capability).
+ 13. Return.
+
+ ExecuteModule ( [ capability ] )
+
+ ...
+ 11. If module.[[Async]] is false, then
+ a. Assert: capability was not provided.
+ b. Push moduleCxt on to the execution context stack; moduleCxt is now the running execution context.
+ c. Let result be the result of evaluating module.[[ECMAScriptCode]].
+ d. Suspend moduleCxt and remove it from the execution context stack.
+ e. Resume the context that is now on the top of the execution context stack as the running execution context.
+ f. Return Completion(result).
+ 12. Otherwise,
+ a. Assert: capability is a PromiseCapability Record.
+ b. Perform ! AsyncBlockStart(capability, module.[[ECMAScriptCode]], moduleCxt).
+ c. Return.
+flags: [module, async]
+features: [top-level-await]
+---*/
+
+import foo from './module-import-resolution_FIXTURE.js';
+
+assert.sameValue(foo, 42);
+
+import { x, y } from './module-import-resolution_FIXTURE.js';
+
+assert.sameValue(x, 'named');
+assert.sameValue(y, 39);
+
+// $DONE is set at the end to reflect the async operations from the imported module
+$DONE();
diff --git a/js/src/tests/test262/language/module-code/top-level-await/module-import-resolution_FIXTURE.js b/js/src/tests/test262/language/module-code/top-level-await/module-import-resolution_FIXTURE.js
new file mode 100644
index 0000000000..eeafdef3cd
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/module-import-resolution_FIXTURE.js
@@ -0,0 +1,15 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+await 1;
+await 2;
+export default await Promise.resolve(42);
+
+export const y = await 39;
+export const x = await 'named';
+
+// Bonus: this rejection is not unwrapped
+if (false) {
+ await Promise.reject(42);
+}
diff --git a/js/src/tests/test262/language/module-code/top-level-await/module-import-unwrapped.js b/js/src/tests/test262/language/module-code/top-level-await/module-import-unwrapped.js
new file mode 100644
index 0000000000..1c3a57a955
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/module-import-unwrapped.js
@@ -0,0 +1,96 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module async -- requires shell-options
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-moduleevaluation
+description: >
+ Evaluate imported module with unwrapped imported promises
+info: |
+ Table 3: Additional Fields of Cyclic Module Records
+
+ [[Async]]
+
+ ...
+ Having an asynchronous dependency does not make the module asynchronous. This field must not change after the module is parsed.
+
+ Evaluate ( ) Concrete Method
+
+ ...
+ 6. Let capability be ! NewPromiseCapability(%Promise%).
+ 7. Set module.[[TopLevelCapability]] to capability.
+ 8. Let result be InnerModuleEvaluation(module, stack, 0).
+ 9. If result is an abrupt completion, then
+ ...
+ d. Perform ! Call(capability.[[Reject]], undefined, «result.[[Value]]»).
+ 10. Otherwise,
+ ...
+ b. If module.[[AsyncEvaluating]] is false, then
+ i. Perform ! Call(capability.[[Resolve]], undefined, «undefined»).
+ ...
+ 11. Return undefinedcapability.[[Promise]].
+
+ InnerModuleEvaluation( module, stack, index )
+
+ ...
+ 14. If module.[[PendingAsyncDependencies]] is > 0, set module.[[AsyncEvaluating]] to true.
+ 15. Otherwise, if module.[[Async]] is true, perform ! ExecuteAsyncModule(module).
+ 16. Otherwise, perform ? module.ExecuteModule().
+
+ ExecuteAsyncModule ( module )
+
+ 1. Assert: module.[[Status]] is "evaluating" or "evaluated".
+ 2. Assert: module.[[Async]] is true.
+ 3. Set module.[[AsyncEvaluating]] to true.
+ 4. Let capability be ! NewPromiseCapability(%Promise%).
+ 5. Let stepsFulfilled be the steps of a CallAsyncModuleFulfilled function as specified below.
+ ...
+ 8. Let stepsRejected be the steps of a CallAsyncModuleRejected function as specified below.
+ ...
+ 11. Perform ! PerformPromiseThen(capability.[[Promise]], onFulfilled, onRejected).
+ 12. Perform ! module.ExecuteModule(capability).
+ 13. Return.
+
+ ExecuteModule ( [ capability ] )
+
+ ...
+ 11. If module.[[Async]] is false, then
+ a. Assert: capability was not provided.
+ b. Push moduleCxt on to the execution context stack; moduleCxt is now the running execution context.
+ c. Let result be the result of evaluating module.[[ECMAScriptCode]].
+ d. Suspend moduleCxt and remove it from the execution context stack.
+ e. Resume the context that is now on the top of the execution context stack as the running execution context.
+ f. Return Completion(result).
+ 12. Otherwise,
+ a. Assert: capability is a PromiseCapability Record.
+ b. Perform ! AsyncBlockStart(capability, module.[[ECMAScriptCode]], moduleCxt).
+ c. Return.
+flags: [module, async]
+features: [top-level-await]
+---*/
+
+import mod from './module-import-unwrapped_FIXTURE.js';
+import { x, y } from './module-import-unwrapped_FIXTURE.js';
+
+assert(mod instanceof Promise, 'mod is an instance of Promise');
+assert(x instanceof Promise, 'x is an instance of Promise');
+assert(y instanceof Promise, 'y is an instance of Promise');
+
+assert.sameValue(Object.getPrototypeOf(mod), Promise.prototype, 'Proto of mod');
+assert.sameValue(Object.getPrototypeOf(x), Promise.prototype, 'Proto of x');
+assert.sameValue(Object.getPrototypeOf(y), Promise.prototype, 'Proto of y');
+
+assert.sameValue(await mod, 'default');
+assert.sameValue(await y, 'unwrapped resolution');
+
+var err;
+try {
+ await x;
+} catch (e) {
+ err = e;
+}
+
+assert.sameValue(err, 'unwrapped rejection');
+
+// $DONE is set at the end to reflect the async operations from the imported module
+$DONE();
diff --git a/js/src/tests/test262/language/module-code/top-level-await/module-import-unwrapped_FIXTURE.js b/js/src/tests/test262/language/module-code/top-level-await/module-import-unwrapped_FIXTURE.js
new file mode 100644
index 0000000000..51417c7c5a
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/module-import-unwrapped_FIXTURE.js
@@ -0,0 +1,10 @@
+// |reftest| skip -- not a test file
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+await 1;
+
+export default Promise.resolve('default');
+
+export const x = Promise.reject('unwrapped rejection');
+export const y = Promise.resolve('unwrapped resolution');
diff --git a/js/src/tests/test262/language/module-code/top-level-await/module-self-import-async-resolution-ticks.js b/js/src/tests/test262/language/module-code/top-level-await/module-self-import-async-resolution-ticks.js
new file mode 100644
index 0000000000..a4cb2406cc
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/module-self-import-async-resolution-ticks.js
@@ -0,0 +1,89 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module async -- requires shell-options
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-moduleevaluation
+description: >
+ Ticks from async module (w/ TLA) self importing
+info: |
+ Table 3: Additional Fields of Cyclic Module Records
+
+ [[Async]]
+
+ ...
+ Having an asynchronous dependency does not make the module asynchronous. This field must not change after the module is parsed.
+
+ Evaluate ( ) Concrete Method
+
+ ...
+ 6. Let capability be ! NewPromiseCapability(%Promise%).
+ 7. Set module.[[TopLevelCapability]] to capability.
+ 8. Let result be InnerModuleEvaluation(module, stack, 0).
+ 9. If result is an abrupt completion, then
+ ...
+ d. Perform ! Call(capability.[[Reject]], undefined, «result.[[Value]]»).
+ 10. Otherwise,
+ ...
+ b. If module.[[AsyncEvaluating]] is false, then
+ i. Perform ! Call(capability.[[Resolve]], undefined, «undefined»).
+ ...
+ 11. Return undefinedcapability.[[Promise]].
+
+ InnerModuleEvaluation( module, stack, index )
+
+ ...
+ 14. If module.[[PendingAsyncDependencies]] is > 0, set module.[[AsyncEvaluating]] to true.
+ 15. Otherwise, if module.[[Async]] is true, perform ! ExecuteAsyncModule(module).
+ 16. Otherwise, perform ? module.ExecuteModule().
+
+ ExecuteAsyncModule ( module )
+
+ 1. Assert: module.[[Status]] is "evaluating" or "evaluated".
+ 2. Assert: module.[[Async]] is true.
+ 3. Set module.[[AsyncEvaluating]] to true.
+ 4. Let capability be ! NewPromiseCapability(%Promise%).
+ 5. Let stepsFulfilled be the steps of a CallAsyncModuleFulfilled function as specified below.
+ ...
+ 8. Let stepsRejected be the steps of a CallAsyncModuleRejected function as specified below.
+ ...
+ 11. Perform ! PerformPromiseThen(capability.[[Promise]], onFulfilled, onRejected).
+ 12. Perform ! module.ExecuteModule(capability).
+ 13. Return.
+
+ ExecuteModule ( [ capability ] )
+
+ ...
+ 11. If module.[[Async]] is false, then
+ a. Assert: capability was not provided.
+ b. Push moduleCxt on to the execution context stack; moduleCxt is now the running execution context.
+ c. Let result be the result of evaluating module.[[ECMAScriptCode]].
+ d. Suspend moduleCxt and remove it from the execution context stack.
+ e. Resume the context that is now on the top of the execution context stack as the running execution context.
+ f. Return Completion(result).
+ 12. Otherwise,
+ a. Assert: capability is a PromiseCapability Record.
+ b. Perform ! AsyncBlockStart(capability, module.[[ECMAScriptCode]], moduleCxt).
+ c. Return.
+flags: [module, async]
+features: [top-level-await]
+---*/
+
+var x = 'synchronous evaluation';
+
+Promise.resolve().then(() => x = 'tick in the async evaluation');
+
+import self from './module-self-import-async-resolution-ticks.js';
+
+assert.sameValue(x, 'synchronous evaluation');
+
+assert.throws(ReferenceError, function() {
+ self;
+}, 'self is not initialized yet');
+
+export default await Promise.resolve(42);
+
+assert.sameValue(x, 'tick in the async evaluation');
+assert.sameValue(self, 42), 'self is initialized after export';
+
+$DONE();
diff --git a/js/src/tests/test262/language/module-code/top-level-await/module-sync-import-async-resolution-ticks.js b/js/src/tests/test262/language/module-code/top-level-await/module-sync-import-async-resolution-ticks.js
new file mode 100644
index 0000000000..41aec2b044
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/module-sync-import-async-resolution-ticks.js
@@ -0,0 +1,82 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module async -- requires shell-options
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-moduleevaluation
+description: >
+ Ticks from sync module (no TLA) loading async module
+info: |
+ Table 3: Additional Fields of Cyclic Module Records
+
+ [[Async]]
+
+ ...
+ Having an asynchronous dependency does not make the module asynchronous. This field must not change after the module is parsed.
+
+ Evaluate ( ) Concrete Method
+
+ ...
+ 6. Let capability be ! NewPromiseCapability(%Promise%).
+ 7. Set module.[[TopLevelCapability]] to capability.
+ 8. Let result be InnerModuleEvaluation(module, stack, 0).
+ 9. If result is an abrupt completion, then
+ ...
+ d. Perform ! Call(capability.[[Reject]], undefined, «result.[[Value]]»).
+ 10. Otherwise,
+ ...
+ b. If module.[[AsyncEvaluating]] is false, then
+ i. Perform ! Call(capability.[[Resolve]], undefined, «undefined»).
+ ...
+ 11. Return undefinedcapability.[[Promise]].
+
+ InnerModuleEvaluation( module, stack, index )
+
+ ...
+ 14. If module.[[PendingAsyncDependencies]] is > 0, set module.[[AsyncEvaluating]] to true.
+ 15. Otherwise, if module.[[Async]] is true, perform ! ExecuteAsyncModule(module).
+ 16. Otherwise, perform ? module.ExecuteModule().
+
+ ExecuteAsyncModule ( module )
+
+ 1. Assert: module.[[Status]] is "evaluating" or "evaluated".
+ 2. Assert: module.[[Async]] is true.
+ 3. Set module.[[AsyncEvaluating]] to true.
+ 4. Let capability be ! NewPromiseCapability(%Promise%).
+ 5. Let stepsFulfilled be the steps of a CallAsyncModuleFulfilled function as specified below.
+ ...
+ 8. Let stepsRejected be the steps of a CallAsyncModuleRejected function as specified below.
+ ...
+ 11. Perform ! PerformPromiseThen(capability.[[Promise]], onFulfilled, onRejected).
+ 12. Perform ! module.ExecuteModule(capability).
+ 13. Return.
+
+ ExecuteModule ( [ capability ] )
+
+ ...
+ 11. If module.[[Async]] is false, then
+ a. Assert: capability was not provided.
+ b. Push moduleCxt on to the execution context stack; moduleCxt is now the running execution context.
+ c. Let result be the result of evaluating module.[[ECMAScriptCode]].
+ d. Suspend moduleCxt and remove it from the execution context stack.
+ e. Resume the context that is now on the top of the execution context stack as the running execution context.
+ f. Return Completion(result).
+ 12. Otherwise,
+ a. Assert: capability is a PromiseCapability Record.
+ b. Perform ! AsyncBlockStart(capability, module.[[ECMAScriptCode]], moduleCxt).
+ c. Return.
+flags: [module, async]
+features: [top-level-await]
+---*/
+
+var x = 'synchronous evaluation';
+
+Promise.resolve().then(() => x = 'tick in the async evaluation');
+
+import foo from './module-import-resolution_FIXTURE.js';
+assert.sameValue(foo, 42);
+assert.sameValue(x, 'synchronous evaluation');
+
+Promise.resolve().then(() => {
+ assert.sameValue(x, 'tick in the async evaluation');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/new-await-parens.js b/js/src/tests/test262/language/module-code/top-level-await/new-await-parens.js
new file mode 100644
index 0000000000..555dc89e1a
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/new-await-parens.js
@@ -0,0 +1,20 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module async -- requires shell-options
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: prod-AwaitExpression
+description: >
+ `new (await Constructor)` returns instance of Constructor
+flags: [module, async]
+features: [top-level-await]
+---*/
+
+assert.sameValue((new (await Number)).valueOf(), 0);
+assert.sameValue((new (await String)).valueOf(), '');
+assert.sameValue((new (await Boolean)).valueOf(), false);
+assert.sameValue((new (await Array)).length, 0);
+assert.sameValue((new (await Map)).size, 0);
+assert.sameValue((new (await Set)).size, 0);
+
+$DONE();
diff --git a/js/src/tests/test262/language/module-code/top-level-await/new-await-script-code.js b/js/src/tests/test262/language/module-code/top-level-await/new-await-script-code.js
new file mode 100644
index 0000000000..25774c2a30
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/new-await-script-code.js
@@ -0,0 +1,16 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) -- requires shell-options
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: prod-AwaitExpression
+description: >
+ await is not a keyword in script code
+features: [top-level-await]
+---*/
+
+class await {}
+
+assert.sameValue(new await instanceof await, true);
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/new-await.js b/js/src/tests/test262/language/module-code/top-level-await/new-await.js
new file mode 100644
index 0000000000..88adab1446
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/new-await.js
@@ -0,0 +1,18 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) error:SyntaxError module -- requires shell-options
+// Copyright (C) 2020 Rick Waldron. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: prod-AwaitExpression
+description: >
+ await cannot immediately follow new in module code
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+features: [top-level-await]
+---*/
+
+$DONOTEVALUATE();
+
+new await;
diff --git a/js/src/tests/test262/language/module-code/top-level-await/no-operand.js b/js/src/tests/test262/language/module-code/top-level-await/no-operand.js
new file mode 100644
index 0000000000..1cbc9450d2
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/no-operand.js
@@ -0,0 +1,18 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) error:SyntaxError module -- requires shell-options
+// Copyright 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: prod-AwaitExpression
+description: >
+ await requries an operand.
+negative:
+ phase: parse
+ type: SyntaxError
+flags: [module]
+features: [top-level-await]
+---*/
+
+$DONOTEVALUATE();
+
+await;
diff --git a/js/src/tests/test262/language/module-code/top-level-await/shell.js b/js/src/tests/test262/language/module-code/top-level-await/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/shell.js
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/await-expr-dyn-import.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/await-expr-dyn-import.js
new file mode 100644
index 0000000000..62f31a0ca0
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/await-expr-dyn-import.js
@@ -0,0 +1,44 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Valid syntax for top level await.
+ AwaitExpression ImportCall
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ CallExpression[Yield, Await]:
+ ImportCall[?Yield, ?Await]
+
+ ImportCall[Yield, Await]:
+ import ( AssignmentExpression[+In, ?Yield, ?Await] )
+esid: prod-AwaitExpression
+flags: [module]
+features: [top-level-await, dynamic-import]
+---*/
+
+try {
+ await import('foo');
+} catch (e) {
+ // Ignore errors, we are just checking if the syntax is valid and
+ // we should not worry if a module was loaded.
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-array-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-array-literal.js
new file mode 100644
index 0000000000..6c6511153d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-array-literal.js
@@ -0,0 +1,79 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-array-literal.case
+// - src/top-level-await/syntax/block.template
+/*---
+description: AwaitExpression ArrayLiteral (Valid syntax for top level await in a block.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+{
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ await [];
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-func-expression.js
new file mode 100644
index 0000000000..7b1b552d7f
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-func-expression.js
@@ -0,0 +1,85 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-func-expression.case
+// - src/top-level-await/syntax/block.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in a block.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+{
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ await function() {};
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-identifier.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-identifier.js
new file mode 100644
index 0000000000..457e9e5773
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-identifier.js
@@ -0,0 +1,80 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-identifier.case
+// - src/top-level-await/syntax/block.template
+/*---
+description: AwaitExpression IdentifierReference (Valid syntax for top level await in a block.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+var foo = 1;
+
+
+{
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ await foo;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-literal-number.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-literal-number.js
new file mode 100644
index 0000000000..9d563d1762
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-literal-number.js
@@ -0,0 +1,79 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-number.case
+// - src/top-level-await/syntax/block.template
+/*---
+description: AwaitExpression NumberLiteral (Valid syntax for top level await in a block.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+{
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ await 1;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-literal-string.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-literal-string.js
new file mode 100644
index 0000000000..b458132790
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-literal-string.js
@@ -0,0 +1,79 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-string.case
+// - src/top-level-await/syntax/block.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in a block.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+{
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ await '';
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-nested.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-nested.js
new file mode 100644
index 0000000000..ac738f97e0
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-nested.js
@@ -0,0 +1,75 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-nested.case
+// - src/top-level-await/syntax/block.template
+/*---
+description: Nested AwaitExpressions (Valid syntax for top level await in a block.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+---*/
+
+
+{
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ await await await await await await await await await await await await await await await 'await';
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-new-expr.js
new file mode 100644
index 0000000000..97ab4364b9
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-new-expr.js
@@ -0,0 +1,76 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-new-expr.case
+// - src/top-level-await/syntax/block.template
+/*---
+description: AwaitExpression new MemberExpression (Valid syntax for top level await in a block.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+---*/
+
+
+{
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ await new Promise(function(res, rej) { res(1); });
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-null.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-null.js
new file mode 100644
index 0000000000..f7da58eddc
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-null.js
@@ -0,0 +1,79 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-null.case
+// - src/top-level-await/syntax/block.template
+/*---
+description: AwaitExpression NullLiteral (Valid syntax for top level await in a block.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+{
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ await null;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-obj-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-obj-literal.js
new file mode 100644
index 0000000000..76ba70a084
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-obj-literal.js
@@ -0,0 +1,79 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-obj-literal.case
+// - src/top-level-await/syntax/block.template
+/*---
+description: AwaitExpression ObjectLiteral (Valid syntax for top level await in a block.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+{
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ await { function() {} };
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-regexp.js
new file mode 100644
index 0000000000..270eb28ef1
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-regexp.js
@@ -0,0 +1,79 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-regexp.case
+// - src/top-level-await/syntax/block.template
+/*---
+description: AwaitExpression RegularExpressionLiteral (Valid syntax for top level await in a block.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+{
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ await /1/;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-template-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-template-literal.js
new file mode 100644
index 0000000000..f14fb16588
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-template-literal.js
@@ -0,0 +1,79 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-template-literal.case
+// - src/top-level-await/syntax/block.template
+/*---
+description: AwaitExpression TemplateLiteral (Valid syntax for top level await in a block.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+{
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ await ``;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-this.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-this.js
new file mode 100644
index 0000000000..8b64a84fff
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/block-await-expr-this.js
@@ -0,0 +1,79 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-this.case
+// - src/top-level-await/syntax/block.template
+/*---
+description: AwaitExpression this (Valid syntax for top level await in a block.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+{
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ {
+ await this;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/browser.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/browser.js
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/catch-parameter.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/catch-parameter.js
new file mode 100644
index 0000000000..92d0e13026
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/catch-parameter.js
@@ -0,0 +1,47 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Valid syntax for top level await.
+ AwaitExpression ImportCall
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ Catch[Yield, Await, Return]:
+ catch(CatchParameter[?Yield, ?Await])Block[?Yield, ?Await, ?Return]
+ catchBlock[?Yield, ?Await, ?Return]
+
+ Finally[Yield, Await, Return]:
+ finallyBlock[?Yield, ?Await, ?Return]
+
+ CatchParameter[Yield, Await]:
+ BindingIdentifier[?Yield, ?Await]
+ BindingPattern[?Yield, ?Await]
+esid: prod-AwaitExpression
+flags: [module]
+features: [top-level-await, dynamic-import]
+---*/
+
+try {} catch ({ x = await 42 }) {} // Initializer
+try {} catch ({ x: y = await 42 }) {} // BindingElement Initializer
+try {} catch ([ x = await 42 ]) {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/early-does-not-propagate-to-fn-declaration-body.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/early-does-not-propagate-to-fn-declaration-body.js
new file mode 100644
index 0000000000..822bdc4765
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/early-does-not-propagate-to-fn-declaration-body.js
@@ -0,0 +1,39 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) error:SyntaxError module -- requires shell-options
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ The Await capability does not propagate to the body of a function declaration
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ StatementListItem[Yield, Await, Return]:
+ Statement[?Yield, ?Await, ?Return]
+ Declaration[?Yield, ?Await]
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ HoistableDeclaration[Yield, Await, Default]:
+ FunctionDeclaration[?Yield, ?Await, ?Default]
+ GeneratorDeclaration[?Yield, ?Await, ?Default]
+ AsyncFunctionDeclaration[?Yield, ?Await, ?Default]
+ AsyncGeneratorDeclaration[?Yield, ?Await, ?Default]
+
+ FunctionDeclaration[Yield, Await, Default]:
+ function BindingIdentifier[?Yield, ?Await] ( FormalParameters[~Yield, ~Await] ) { FunctionBody[~Yield, ~Await] }
+negative:
+ phase: parse
+ type: SyntaxError
+esid: prod-ModuleItem
+flags: [module]
+features: [top-level-await]
+---*/
+
+$DONOTEVALUATE();
+
+function fn() { await 0; }
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/early-does-not-propagate-to-fn-declaration-params.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/early-does-not-propagate-to-fn-declaration-params.js
new file mode 100644
index 0000000000..2bfe9098db
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/early-does-not-propagate-to-fn-declaration-params.js
@@ -0,0 +1,41 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) error:SyntaxError module -- requires shell-options
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ The Await capability does not propagate to the parameters of a function declaration
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ StatementListItem[Yield, Await, Return]:
+ Statement[?Yield, ?Await, ?Return]
+ Declaration[?Yield, ?Await]
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ HoistableDeclaration[Yield, Await, Default]:
+ FunctionDeclaration[?Yield, ?Await, ?Default]
+ GeneratorDeclaration[?Yield, ?Await, ?Default]
+ AsyncFunctionDeclaration[?Yield, ?Await, ?Default]
+ AsyncGeneratorDeclaration[?Yield, ?Await, ?Default]
+
+ FunctionDeclaration[Yield, Await, Default]:
+ function BindingIdentifier[?Yield, ?Await] ( FormalParameters[~Yield, ~Await] ) { FunctionBody[~Yield, ~Await] }
+negative:
+ phase: parse
+ type: SyntaxError
+esid: prod-ModuleItem
+flags: [module]
+features: [top-level-await]
+---*/
+
+$DONOTEVALUATE();
+
+function fn(x = await 1) {
+ return x;
+}
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/early-does-not-propagate-to-fn-expr-body.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/early-does-not-propagate-to-fn-expr-body.js
new file mode 100644
index 0000000000..8cb5f4601d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/early-does-not-propagate-to-fn-expr-body.js
@@ -0,0 +1,31 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) error:SyntaxError module -- requires shell-options
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ The Await capability does not propagate to the body of a function expression
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ StatementListItem[Yield, Await, Return]:
+ Statement[?Yield, ?Await, ?Return]
+ Declaration[?Yield, ?Await]
+
+ FunctionExpression:
+ function BindingIdentifier[~Yield, ~Await]_opt ( FormalParameters[~Yield, ~Await] )
+ { FunctionBody[~Yield, ~Await] }
+negative:
+ phase: parse
+ type: SyntaxError
+esid: prod-ModuleItem
+flags: [module]
+features: [top-level-await]
+---*/
+
+$DONOTEVALUATE();
+
+0, function () {
+ await 1;
+};
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/early-does-not-propagate-to-fn-expr-params.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/early-does-not-propagate-to-fn-expr-params.js
new file mode 100644
index 0000000000..fbef8cfab6
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/early-does-not-propagate-to-fn-expr-params.js
@@ -0,0 +1,31 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) error:SyntaxError module -- requires shell-options
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ The Await capability does not propagate to the parameters of a function expression
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ StatementListItem[Yield, Await, Return]:
+ Statement[?Yield, ?Await, ?Return]
+ Declaration[?Yield, ?Await]
+
+ FunctionExpression:
+ function BindingIdentifier[~Yield, ~Await]_opt ( FormalParameters[~Yield, ~Await] )
+ { FunctionBody[~Yield, ~Await] }
+negative:
+ phase: parse
+ type: SyntaxError
+esid: prod-ModuleItem
+flags: [module]
+features: [top-level-await]
+---*/
+
+$DONOTEVALUATE();
+
+0, function (x = await 1) {
+ return x;
+};
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/early-no-escaped-await.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/early-no-escaped-await.js
new file mode 100644
index 0000000000..2caf665303
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/early-no-escaped-await.js
@@ -0,0 +1,26 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) error:SyntaxError module -- requires shell-options
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ The await keyword can't be escaped
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+negative:
+ phase: parse
+ type: SyntaxError
+esid: prod-ModuleItem
+flags: [module]
+features: [top-level-await]
+---*/
+
+$DONOTEVALUATE();
+
+\u0061wait 0;
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-array-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-array-literal.js
new file mode 100644
index 0000000000..77b3bd0e85
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-array-literal.js
@@ -0,0 +1,71 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-array-literal.case
+// - src/top-level-await/syntax/export-class-decl.template
+/*---
+description: AwaitExpression ArrayLiteral (Valid syntax for top level await in export ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export class C extends fn(await []) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-func-expression.js
new file mode 100644
index 0000000000..340721e543
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-func-expression.js
@@ -0,0 +1,77 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-func-expression.case
+// - src/top-level-await/syntax/export-class-decl.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in export ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export class C extends fn(await function() {}) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-identifier.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-identifier.js
new file mode 100644
index 0000000000..e201101947
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-identifier.js
@@ -0,0 +1,72 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-identifier.case
+// - src/top-level-await/syntax/export-class-decl.template
+/*---
+description: AwaitExpression IdentifierReference (Valid syntax for top level await in export ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+var foo = 1;
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export class C extends fn(await foo) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-literal-number.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-literal-number.js
new file mode 100644
index 0000000000..7f114c6d66
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-literal-number.js
@@ -0,0 +1,71 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-number.case
+// - src/top-level-await/syntax/export-class-decl.template
+/*---
+description: AwaitExpression NumberLiteral (Valid syntax for top level await in export ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export class C extends fn(await 1) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-literal-string.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-literal-string.js
new file mode 100644
index 0000000000..ccd7de5b1f
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-literal-string.js
@@ -0,0 +1,71 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-string.case
+// - src/top-level-await/syntax/export-class-decl.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in export ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export class C extends fn(await '') {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-nested.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-nested.js
new file mode 100644
index 0000000000..d78d4a8f0b
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-nested.js
@@ -0,0 +1,67 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-nested.case
+// - src/top-level-await/syntax/export-class-decl.template
+/*---
+description: Nested AwaitExpressions (Valid syntax for top level await in export ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export class C extends fn(await await await await await await await await await await await await await await await 'await') {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-new-expr.js
new file mode 100644
index 0000000000..c58c33fe96
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-new-expr.js
@@ -0,0 +1,68 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-new-expr.case
+// - src/top-level-await/syntax/export-class-decl.template
+/*---
+description: AwaitExpression new MemberExpression (Valid syntax for top level await in export ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export class C extends fn(await new Promise(function(res, rej) { res(1); })) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-null.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-null.js
new file mode 100644
index 0000000000..85a40119a0
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-null.js
@@ -0,0 +1,71 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-null.case
+// - src/top-level-await/syntax/export-class-decl.template
+/*---
+description: AwaitExpression NullLiteral (Valid syntax for top level await in export ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export class C extends fn(await null) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-obj-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-obj-literal.js
new file mode 100644
index 0000000000..a721387d66
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-obj-literal.js
@@ -0,0 +1,71 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-obj-literal.case
+// - src/top-level-await/syntax/export-class-decl.template
+/*---
+description: AwaitExpression ObjectLiteral (Valid syntax for top level await in export ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export class C extends fn(await { function() {} }) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-regexp.js
new file mode 100644
index 0000000000..aaebbf7bb7
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-regexp.js
@@ -0,0 +1,71 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-regexp.case
+// - src/top-level-await/syntax/export-class-decl.template
+/*---
+description: AwaitExpression RegularExpressionLiteral (Valid syntax for top level await in export ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export class C extends fn(await /1/) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-template-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-template-literal.js
new file mode 100644
index 0000000000..37617d67d3
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-template-literal.js
@@ -0,0 +1,71 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-template-literal.case
+// - src/top-level-await/syntax/export-class-decl.template
+/*---
+description: AwaitExpression TemplateLiteral (Valid syntax for top level await in export ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export class C extends fn(await ``) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-this.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-this.js
new file mode 100644
index 0000000000..84023b82a1
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-class-decl-await-expr-this.js
@@ -0,0 +1,71 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-this.case
+// - src/top-level-await/syntax/export-class-decl.template
+/*---
+description: AwaitExpression this (Valid syntax for top level await in export ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export class C extends fn(await this) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-array-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-array-literal.js
new file mode 100644
index 0000000000..cf7c4ec24e
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-array-literal.js
@@ -0,0 +1,67 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-array-literal.case
+// - src/top-level-await/syntax/export-dflt-assign-expr.template
+/*---
+description: AwaitExpression ArrayLiteral (Valid syntax for top level await in export default AssignmentExpression)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default [lookahead ∉ { function, async [no LineTerminator here] function, class }] AssignmentExpression [+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export default await [];
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-func-expression.js
new file mode 100644
index 0000000000..7d3564eedd
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-func-expression.js
@@ -0,0 +1,73 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-func-expression.case
+// - src/top-level-await/syntax/export-dflt-assign-expr.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in export default AssignmentExpression)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default [lookahead ∉ { function, async [no LineTerminator here] function, class }] AssignmentExpression [+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export default await function() {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-identifier.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-identifier.js
new file mode 100644
index 0000000000..82f817e29f
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-identifier.js
@@ -0,0 +1,68 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-identifier.case
+// - src/top-level-await/syntax/export-dflt-assign-expr.template
+/*---
+description: AwaitExpression IdentifierReference (Valid syntax for top level await in export default AssignmentExpression)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default [lookahead ∉ { function, async [no LineTerminator here] function, class }] AssignmentExpression [+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+var foo = 1;
+
+
+export default await foo;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-literal-number.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-literal-number.js
new file mode 100644
index 0000000000..d56c3d2eff
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-literal-number.js
@@ -0,0 +1,67 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-number.case
+// - src/top-level-await/syntax/export-dflt-assign-expr.template
+/*---
+description: AwaitExpression NumberLiteral (Valid syntax for top level await in export default AssignmentExpression)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default [lookahead ∉ { function, async [no LineTerminator here] function, class }] AssignmentExpression [+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export default await 1;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-literal-string.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-literal-string.js
new file mode 100644
index 0000000000..a8ca01a0ed
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-literal-string.js
@@ -0,0 +1,67 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-string.case
+// - src/top-level-await/syntax/export-dflt-assign-expr.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in export default AssignmentExpression)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default [lookahead ∉ { function, async [no LineTerminator here] function, class }] AssignmentExpression [+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export default await '';
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-nested.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-nested.js
new file mode 100644
index 0000000000..57d28a0dea
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-nested.js
@@ -0,0 +1,63 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-nested.case
+// - src/top-level-await/syntax/export-dflt-assign-expr.template
+/*---
+description: Nested AwaitExpressions (Valid syntax for top level await in export default AssignmentExpression)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default [lookahead ∉ { function, async [no LineTerminator here] function, class }] AssignmentExpression [+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+---*/
+
+
+export default await await await await await await await await await await await await await await await 'await';
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-new-expr.js
new file mode 100644
index 0000000000..623fb4dc8f
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-new-expr.js
@@ -0,0 +1,64 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-new-expr.case
+// - src/top-level-await/syntax/export-dflt-assign-expr.template
+/*---
+description: AwaitExpression new MemberExpression (Valid syntax for top level await in export default AssignmentExpression)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default [lookahead ∉ { function, async [no LineTerminator here] function, class }] AssignmentExpression [+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+---*/
+
+
+export default await new Promise(function(res, rej) { res(1); });
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-null.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-null.js
new file mode 100644
index 0000000000..80e9fc2160
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-null.js
@@ -0,0 +1,67 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-null.case
+// - src/top-level-await/syntax/export-dflt-assign-expr.template
+/*---
+description: AwaitExpression NullLiteral (Valid syntax for top level await in export default AssignmentExpression)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default [lookahead ∉ { function, async [no LineTerminator here] function, class }] AssignmentExpression [+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export default await null;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-obj-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-obj-literal.js
new file mode 100644
index 0000000000..fc06dea532
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-obj-literal.js
@@ -0,0 +1,67 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-obj-literal.case
+// - src/top-level-await/syntax/export-dflt-assign-expr.template
+/*---
+description: AwaitExpression ObjectLiteral (Valid syntax for top level await in export default AssignmentExpression)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default [lookahead ∉ { function, async [no LineTerminator here] function, class }] AssignmentExpression [+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export default await { function() {} };
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-regexp.js
new file mode 100644
index 0000000000..6ec034ed40
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-regexp.js
@@ -0,0 +1,67 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-regexp.case
+// - src/top-level-await/syntax/export-dflt-assign-expr.template
+/*---
+description: AwaitExpression RegularExpressionLiteral (Valid syntax for top level await in export default AssignmentExpression)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default [lookahead ∉ { function, async [no LineTerminator here] function, class }] AssignmentExpression [+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export default await /1/;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-template-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-template-literal.js
new file mode 100644
index 0000000000..a2467e2845
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-template-literal.js
@@ -0,0 +1,67 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-template-literal.case
+// - src/top-level-await/syntax/export-dflt-assign-expr.template
+/*---
+description: AwaitExpression TemplateLiteral (Valid syntax for top level await in export default AssignmentExpression)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default [lookahead ∉ { function, async [no LineTerminator here] function, class }] AssignmentExpression [+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export default await ``;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-this.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-this.js
new file mode 100644
index 0000000000..4487c03631
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dflt-assign-expr-await-expr-this.js
@@ -0,0 +1,67 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-this.case
+// - src/top-level-await/syntax/export-dflt-assign-expr.template
+/*---
+description: AwaitExpression this (Valid syntax for top level await in export default AssignmentExpression)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default [lookahead ∉ { function, async [no LineTerminator here] function, class }] AssignmentExpression [+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export default await this;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-array-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-array-literal.js
new file mode 100644
index 0000000000..29431ace74
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-array-literal.js
@@ -0,0 +1,71 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-array-literal.case
+// - src/top-level-await/syntax/export-dflt-class-decl.template
+/*---
+description: AwaitExpression ArrayLiteral (Valid syntax for top level await in export default ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export default class extends fn(await []) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-func-expression.js
new file mode 100644
index 0000000000..20c4a661a8
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-func-expression.js
@@ -0,0 +1,77 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-func-expression.case
+// - src/top-level-await/syntax/export-dflt-class-decl.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in export default ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export default class extends fn(await function() {}) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-identifier.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-identifier.js
new file mode 100644
index 0000000000..97f6b1fdde
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-identifier.js
@@ -0,0 +1,72 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-identifier.case
+// - src/top-level-await/syntax/export-dflt-class-decl.template
+/*---
+description: AwaitExpression IdentifierReference (Valid syntax for top level await in export default ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+var foo = 1;
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export default class extends fn(await foo) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-literal-number.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-literal-number.js
new file mode 100644
index 0000000000..dc0248f1b4
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-literal-number.js
@@ -0,0 +1,71 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-number.case
+// - src/top-level-await/syntax/export-dflt-class-decl.template
+/*---
+description: AwaitExpression NumberLiteral (Valid syntax for top level await in export default ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export default class extends fn(await 1) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-literal-string.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-literal-string.js
new file mode 100644
index 0000000000..088099355b
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-literal-string.js
@@ -0,0 +1,71 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-string.case
+// - src/top-level-await/syntax/export-dflt-class-decl.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in export default ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export default class extends fn(await '') {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-nested.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-nested.js
new file mode 100644
index 0000000000..2ec9a79e4a
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-nested.js
@@ -0,0 +1,67 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-nested.case
+// - src/top-level-await/syntax/export-dflt-class-decl.template
+/*---
+description: Nested AwaitExpressions (Valid syntax for top level await in export default ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export default class extends fn(await await await await await await await await await await await await await await await 'await') {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-new-expr.js
new file mode 100644
index 0000000000..c67039960e
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-new-expr.js
@@ -0,0 +1,68 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-new-expr.case
+// - src/top-level-await/syntax/export-dflt-class-decl.template
+/*---
+description: AwaitExpression new MemberExpression (Valid syntax for top level await in export default ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export default class extends fn(await new Promise(function(res, rej) { res(1); })) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-null.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-null.js
new file mode 100644
index 0000000000..54974f37d5
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-null.js
@@ -0,0 +1,71 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-null.case
+// - src/top-level-await/syntax/export-dflt-class-decl.template
+/*---
+description: AwaitExpression NullLiteral (Valid syntax for top level await in export default ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export default class extends fn(await null) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-obj-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-obj-literal.js
new file mode 100644
index 0000000000..377ab1ba2d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-obj-literal.js
@@ -0,0 +1,71 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-obj-literal.case
+// - src/top-level-await/syntax/export-dflt-class-decl.template
+/*---
+description: AwaitExpression ObjectLiteral (Valid syntax for top level await in export default ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export default class extends fn(await { function() {} }) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-regexp.js
new file mode 100644
index 0000000000..6edc947d3c
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-regexp.js
@@ -0,0 +1,71 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-regexp.case
+// - src/top-level-await/syntax/export-dflt-class-decl.template
+/*---
+description: AwaitExpression RegularExpressionLiteral (Valid syntax for top level await in export default ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export default class extends fn(await /1/) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-template-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-template-literal.js
new file mode 100644
index 0000000000..f2bf4a5435
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-template-literal.js
@@ -0,0 +1,71 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-template-literal.case
+// - src/top-level-await/syntax/export-dflt-class-decl.template
+/*---
+description: AwaitExpression TemplateLiteral (Valid syntax for top level await in export default ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export default class extends fn(await ``) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-this.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-this.js
new file mode 100644
index 0000000000..72436f9c6d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-dft-class-decl-await-expr-this.js
@@ -0,0 +1,71 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-this.case
+// - src/top-level-await/syntax/export-dflt-class-decl.template
+/*---
+description: AwaitExpression this (Valid syntax for top level await in export default ClassDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await, class]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ ClassDeclaration[Yield, Await, Default]:
+ classBindingIdentifier[?Yield, ?Await] ClassTail[?Yield, ?Await]
+ [+Default] class ClassTail[?Yield, ?Await]
+
+ ClassTail[Yield, Await]:
+ ClassHeritage[?Yield, ?Await]_opt { ClassBody[?Yield, ?Await]_opt }
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+function fn() {
+ return function() {};
+}
+// extends CallExpression with arguments
+export default class extends fn(await this) {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-array-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-array-literal.js
new file mode 100644
index 0000000000..76a2292585
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-array-literal.js
@@ -0,0 +1,64 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-array-literal.case
+// - src/top-level-await/syntax/export-lex-declaration.template
+/*---
+description: AwaitExpression ArrayLiteral (Valid syntax for top level await in export LexicalDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ LexicalDeclaration[In, Yield, Await]:
+ LetOrConstBindingList[?In, ?Yield, ?Await];
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export let x = await [];
+export const y = await [];
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-func-expression.js
new file mode 100644
index 0000000000..406ad58465
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-func-expression.js
@@ -0,0 +1,70 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-func-expression.case
+// - src/top-level-await/syntax/export-lex-declaration.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in export LexicalDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ LexicalDeclaration[In, Yield, Await]:
+ LetOrConstBindingList[?In, ?Yield, ?Await];
+
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export let x = await function() {};
+export const y = await function() {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-identifier.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-identifier.js
new file mode 100644
index 0000000000..df7de542fb
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-identifier.js
@@ -0,0 +1,65 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-identifier.case
+// - src/top-level-await/syntax/export-lex-declaration.template
+/*---
+description: AwaitExpression IdentifierReference (Valid syntax for top level await in export LexicalDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ LexicalDeclaration[In, Yield, Await]:
+ LetOrConstBindingList[?In, ?Yield, ?Await];
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+var foo = 1;
+
+
+export let x = await foo;
+export const y = await foo;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-literal-number.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-literal-number.js
new file mode 100644
index 0000000000..450b5c1c0f
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-literal-number.js
@@ -0,0 +1,64 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-number.case
+// - src/top-level-await/syntax/export-lex-declaration.template
+/*---
+description: AwaitExpression NumberLiteral (Valid syntax for top level await in export LexicalDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ LexicalDeclaration[In, Yield, Await]:
+ LetOrConstBindingList[?In, ?Yield, ?Await];
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export let x = await 1;
+export const y = await 1;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-literal-string.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-literal-string.js
new file mode 100644
index 0000000000..a22a94de52
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-literal-string.js
@@ -0,0 +1,64 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-string.case
+// - src/top-level-await/syntax/export-lex-declaration.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in export LexicalDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ LexicalDeclaration[In, Yield, Await]:
+ LetOrConstBindingList[?In, ?Yield, ?Await];
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export let x = await '';
+export const y = await '';
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-nested.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-nested.js
new file mode 100644
index 0000000000..e02d8dfad9
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-nested.js
@@ -0,0 +1,60 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-nested.case
+// - src/top-level-await/syntax/export-lex-declaration.template
+/*---
+description: Nested AwaitExpressions (Valid syntax for top level await in export LexicalDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ LexicalDeclaration[In, Yield, Await]:
+ LetOrConstBindingList[?In, ?Yield, ?Await];
+
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+---*/
+
+
+export let x = await await await await await await await await await await await await await await await 'await';
+export const y = await await await await await await await await await await await await await await await 'await';
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-new-expr.js
new file mode 100644
index 0000000000..72691f22b7
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-new-expr.js
@@ -0,0 +1,61 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-new-expr.case
+// - src/top-level-await/syntax/export-lex-declaration.template
+/*---
+description: AwaitExpression new MemberExpression (Valid syntax for top level await in export LexicalDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ LexicalDeclaration[In, Yield, Await]:
+ LetOrConstBindingList[?In, ?Yield, ?Await];
+
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+---*/
+
+
+export let x = await new Promise(function(res, rej) { res(1); });
+export const y = await new Promise(function(res, rej) { res(1); });
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-null.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-null.js
new file mode 100644
index 0000000000..8f647d5481
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-null.js
@@ -0,0 +1,64 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-null.case
+// - src/top-level-await/syntax/export-lex-declaration.template
+/*---
+description: AwaitExpression NullLiteral (Valid syntax for top level await in export LexicalDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ LexicalDeclaration[In, Yield, Await]:
+ LetOrConstBindingList[?In, ?Yield, ?Await];
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export let x = await null;
+export const y = await null;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-obj-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-obj-literal.js
new file mode 100644
index 0000000000..5574049b8f
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-obj-literal.js
@@ -0,0 +1,64 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-obj-literal.case
+// - src/top-level-await/syntax/export-lex-declaration.template
+/*---
+description: AwaitExpression ObjectLiteral (Valid syntax for top level await in export LexicalDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ LexicalDeclaration[In, Yield, Await]:
+ LetOrConstBindingList[?In, ?Yield, ?Await];
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export let x = await { function() {} };
+export const y = await { function() {} };
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-regexp.js
new file mode 100644
index 0000000000..26bd84c697
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-regexp.js
@@ -0,0 +1,64 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-regexp.case
+// - src/top-level-await/syntax/export-lex-declaration.template
+/*---
+description: AwaitExpression RegularExpressionLiteral (Valid syntax for top level await in export LexicalDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ LexicalDeclaration[In, Yield, Await]:
+ LetOrConstBindingList[?In, ?Yield, ?Await];
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export let x = await /1/;
+export const y = await /1/;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-template-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-template-literal.js
new file mode 100644
index 0000000000..f62342d893
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-template-literal.js
@@ -0,0 +1,64 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-template-literal.case
+// - src/top-level-await/syntax/export-lex-declaration.template
+/*---
+description: AwaitExpression TemplateLiteral (Valid syntax for top level await in export LexicalDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ LexicalDeclaration[In, Yield, Await]:
+ LetOrConstBindingList[?In, ?Yield, ?Await];
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export let x = await ``;
+export const y = await ``;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-this.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-this.js
new file mode 100644
index 0000000000..69cffb98f4
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-lex-decl-await-expr-this.js
@@ -0,0 +1,64 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-this.case
+// - src/top-level-await/syntax/export-lex-declaration.template
+/*---
+description: AwaitExpression this (Valid syntax for top level await in export LexicalDeclaration)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ Declaration[Yield, Await]:
+ HoistableDeclaration[?Yield, ?Await, ~Default]
+ ClassDeclaration[?Yield, ?Await, ~Default]
+ LexicalDeclaration[+In, ?Yield, ?Await]
+
+ LexicalDeclaration[In, Yield, Await]:
+ LetOrConstBindingList[?In, ?Yield, ?Await];
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export let x = await this;
+export const y = await this;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-array-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-array-literal.js
new file mode 100644
index 0000000000..12ffdf04f6
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-array-literal.js
@@ -0,0 +1,67 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-array-literal.case
+// - src/top-level-await/syntax/export-var-init.template
+/*---
+description: AwaitExpression ArrayLiteral (Valid syntax for top level await in export var BindingIdentifier Await_initializer)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ VariableStatement[Yield, Await]:
+ var VariableDeclarationList[+In, ?Yield, ?Await];
+
+ VariableDeclarationList[In, Yield, Await]:
+ VariableDeclaration[?In, ?Yield, ?Await]
+ VariableDeclarationList[?In, ?Yield, ?Await] , VariableDeclaration[?In, ?Yield, ?Await]
+
+ VariableDeclaration[In, Yield, Await]:
+ BindingIdentifier[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]opt
+ BindingPattern[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export var name1 = await [];
+export var { x = await [] } = {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-func-expression.js
new file mode 100644
index 0000000000..2955df9eb7
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-func-expression.js
@@ -0,0 +1,73 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-func-expression.case
+// - src/top-level-await/syntax/export-var-init.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in export var BindingIdentifier Await_initializer)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ VariableStatement[Yield, Await]:
+ var VariableDeclarationList[+In, ?Yield, ?Await];
+
+ VariableDeclarationList[In, Yield, Await]:
+ VariableDeclaration[?In, ?Yield, ?Await]
+ VariableDeclarationList[?In, ?Yield, ?Await] , VariableDeclaration[?In, ?Yield, ?Await]
+
+ VariableDeclaration[In, Yield, Await]:
+ BindingIdentifier[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]opt
+ BindingPattern[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]
+
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export var name1 = await function() {};
+export var { x = await function() {} } = {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-identifier.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-identifier.js
new file mode 100644
index 0000000000..57bb65cf80
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-identifier.js
@@ -0,0 +1,68 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-identifier.case
+// - src/top-level-await/syntax/export-var-init.template
+/*---
+description: AwaitExpression IdentifierReference (Valid syntax for top level await in export var BindingIdentifier Await_initializer)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ VariableStatement[Yield, Await]:
+ var VariableDeclarationList[+In, ?Yield, ?Await];
+
+ VariableDeclarationList[In, Yield, Await]:
+ VariableDeclaration[?In, ?Yield, ?Await]
+ VariableDeclarationList[?In, ?Yield, ?Await] , VariableDeclaration[?In, ?Yield, ?Await]
+
+ VariableDeclaration[In, Yield, Await]:
+ BindingIdentifier[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]opt
+ BindingPattern[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+var foo = 1;
+
+
+export var name1 = await foo;
+export var { x = await foo } = {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-literal-number.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-literal-number.js
new file mode 100644
index 0000000000..9aaa49dde6
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-literal-number.js
@@ -0,0 +1,67 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-number.case
+// - src/top-level-await/syntax/export-var-init.template
+/*---
+description: AwaitExpression NumberLiteral (Valid syntax for top level await in export var BindingIdentifier Await_initializer)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ VariableStatement[Yield, Await]:
+ var VariableDeclarationList[+In, ?Yield, ?Await];
+
+ VariableDeclarationList[In, Yield, Await]:
+ VariableDeclaration[?In, ?Yield, ?Await]
+ VariableDeclarationList[?In, ?Yield, ?Await] , VariableDeclaration[?In, ?Yield, ?Await]
+
+ VariableDeclaration[In, Yield, Await]:
+ BindingIdentifier[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]opt
+ BindingPattern[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export var name1 = await 1;
+export var { x = await 1 } = {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-literal-string.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-literal-string.js
new file mode 100644
index 0000000000..b673f52261
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-literal-string.js
@@ -0,0 +1,67 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-string.case
+// - src/top-level-await/syntax/export-var-init.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in export var BindingIdentifier Await_initializer)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ VariableStatement[Yield, Await]:
+ var VariableDeclarationList[+In, ?Yield, ?Await];
+
+ VariableDeclarationList[In, Yield, Await]:
+ VariableDeclaration[?In, ?Yield, ?Await]
+ VariableDeclarationList[?In, ?Yield, ?Await] , VariableDeclaration[?In, ?Yield, ?Await]
+
+ VariableDeclaration[In, Yield, Await]:
+ BindingIdentifier[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]opt
+ BindingPattern[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export var name1 = await '';
+export var { x = await '' } = {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-nested.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-nested.js
new file mode 100644
index 0000000000..37fa649545
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-nested.js
@@ -0,0 +1,63 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-nested.case
+// - src/top-level-await/syntax/export-var-init.template
+/*---
+description: Nested AwaitExpressions (Valid syntax for top level await in export var BindingIdentifier Await_initializer)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ VariableStatement[Yield, Await]:
+ var VariableDeclarationList[+In, ?Yield, ?Await];
+
+ VariableDeclarationList[In, Yield, Await]:
+ VariableDeclaration[?In, ?Yield, ?Await]
+ VariableDeclarationList[?In, ?Yield, ?Await] , VariableDeclaration[?In, ?Yield, ?Await]
+
+ VariableDeclaration[In, Yield, Await]:
+ BindingIdentifier[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]opt
+ BindingPattern[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]
+
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+---*/
+
+
+export var name1 = await await await await await await await await await await await await await await await 'await';
+export var { x = await await await await await await await await await await await await await await await 'await' } = {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-new-expr.js
new file mode 100644
index 0000000000..7e57cf4013
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-new-expr.js
@@ -0,0 +1,64 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-new-expr.case
+// - src/top-level-await/syntax/export-var-init.template
+/*---
+description: AwaitExpression new MemberExpression (Valid syntax for top level await in export var BindingIdentifier Await_initializer)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ VariableStatement[Yield, Await]:
+ var VariableDeclarationList[+In, ?Yield, ?Await];
+
+ VariableDeclarationList[In, Yield, Await]:
+ VariableDeclaration[?In, ?Yield, ?Await]
+ VariableDeclarationList[?In, ?Yield, ?Await] , VariableDeclaration[?In, ?Yield, ?Await]
+
+ VariableDeclaration[In, Yield, Await]:
+ BindingIdentifier[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]opt
+ BindingPattern[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]
+
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+---*/
+
+
+export var name1 = await new Promise(function(res, rej) { res(1); });
+export var { x = await new Promise(function(res, rej) { res(1); }) } = {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-null.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-null.js
new file mode 100644
index 0000000000..bb2f761c55
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-null.js
@@ -0,0 +1,67 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-null.case
+// - src/top-level-await/syntax/export-var-init.template
+/*---
+description: AwaitExpression NullLiteral (Valid syntax for top level await in export var BindingIdentifier Await_initializer)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ VariableStatement[Yield, Await]:
+ var VariableDeclarationList[+In, ?Yield, ?Await];
+
+ VariableDeclarationList[In, Yield, Await]:
+ VariableDeclaration[?In, ?Yield, ?Await]
+ VariableDeclarationList[?In, ?Yield, ?Await] , VariableDeclaration[?In, ?Yield, ?Await]
+
+ VariableDeclaration[In, Yield, Await]:
+ BindingIdentifier[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]opt
+ BindingPattern[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export var name1 = await null;
+export var { x = await null } = {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-obj-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-obj-literal.js
new file mode 100644
index 0000000000..a17b1da7e1
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-obj-literal.js
@@ -0,0 +1,67 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-obj-literal.case
+// - src/top-level-await/syntax/export-var-init.template
+/*---
+description: AwaitExpression ObjectLiteral (Valid syntax for top level await in export var BindingIdentifier Await_initializer)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ VariableStatement[Yield, Await]:
+ var VariableDeclarationList[+In, ?Yield, ?Await];
+
+ VariableDeclarationList[In, Yield, Await]:
+ VariableDeclaration[?In, ?Yield, ?Await]
+ VariableDeclarationList[?In, ?Yield, ?Await] , VariableDeclaration[?In, ?Yield, ?Await]
+
+ VariableDeclaration[In, Yield, Await]:
+ BindingIdentifier[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]opt
+ BindingPattern[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export var name1 = await { function() {} };
+export var { x = await { function() {} } } = {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-regexp.js
new file mode 100644
index 0000000000..b1b72ed211
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-regexp.js
@@ -0,0 +1,67 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-regexp.case
+// - src/top-level-await/syntax/export-var-init.template
+/*---
+description: AwaitExpression RegularExpressionLiteral (Valid syntax for top level await in export var BindingIdentifier Await_initializer)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ VariableStatement[Yield, Await]:
+ var VariableDeclarationList[+In, ?Yield, ?Await];
+
+ VariableDeclarationList[In, Yield, Await]:
+ VariableDeclaration[?In, ?Yield, ?Await]
+ VariableDeclarationList[?In, ?Yield, ?Await] , VariableDeclaration[?In, ?Yield, ?Await]
+
+ VariableDeclaration[In, Yield, Await]:
+ BindingIdentifier[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]opt
+ BindingPattern[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export var name1 = await /1/;
+export var { x = await /1/ } = {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-template-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-template-literal.js
new file mode 100644
index 0000000000..ced50dd3de
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-template-literal.js
@@ -0,0 +1,67 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-template-literal.case
+// - src/top-level-await/syntax/export-var-init.template
+/*---
+description: AwaitExpression TemplateLiteral (Valid syntax for top level await in export var BindingIdentifier Await_initializer)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ VariableStatement[Yield, Await]:
+ var VariableDeclarationList[+In, ?Yield, ?Await];
+
+ VariableDeclarationList[In, Yield, Await]:
+ VariableDeclaration[?In, ?Yield, ?Await]
+ VariableDeclarationList[?In, ?Yield, ?Await] , VariableDeclaration[?In, ?Yield, ?Await]
+
+ VariableDeclaration[In, Yield, Await]:
+ BindingIdentifier[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]opt
+ BindingPattern[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export var name1 = await ``;
+export var { x = await `` } = {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-this.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-this.js
new file mode 100644
index 0000000000..e9f573772e
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/export-var-await-expr-this.js
@@ -0,0 +1,67 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-this.case
+// - src/top-level-await/syntax/export-var-init.template
+/*---
+description: AwaitExpression this (Valid syntax for top level await in export var BindingIdentifier Await_initializer)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+ ExportDeclaration:
+ export * FromClause ;
+ export ExportClause FromClause ;
+ export ExportClause ;
+ export VariableStatement[~Yield, +Await]
+ export Declaration[~Yield, +Await]
+ export defaultHoistableDeclaration[~Yield, +Await, +Default]
+ export defaultClassDeclaration[~Yield, +Await, +Default]
+ export default[lookahead ∉ { function, async [no LineTerminator here] function, class }]AssignmentExpression[+In, ~Yield, ~Await];
+
+ VariableStatement[Yield, Await]:
+ var VariableDeclarationList[+In, ?Yield, ?Await];
+
+ VariableDeclarationList[In, Yield, Await]:
+ VariableDeclaration[?In, ?Yield, ?Await]
+ VariableDeclarationList[?In, ?Yield, ?Await] , VariableDeclaration[?In, ?Yield, ?Await]
+
+ VariableDeclaration[In, Yield, Await]:
+ BindingIdentifier[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]opt
+ BindingPattern[?Yield, ?Await] Initializer[?In, ?Yield, ?Await]
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+export var name1 = await this;
+export var { x = await this } = {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-array-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-array-literal.js
new file mode 100644
index 0000000000..f5c2dd8c74
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-array-literal.js
@@ -0,0 +1,70 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-array-literal.case
+// - src/top-level-await/syntax/for-await-expr.template
+/*---
+description: AwaitExpression ArrayLiteral (Valid syntax for top level await in for await statements.)
+esid: prod-AwaitExpression
+features: [top-level-await, async-iteration]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (binding of [await []]) {
+ await [];
+ break;
+}
+
+// [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (var binding of [await []]) {
+ await [];
+ break;
+}
+
+// [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (let binding of [await []]) {
+ await [];
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-func-expression.js
new file mode 100644
index 0000000000..af872a24a1
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-func-expression.js
@@ -0,0 +1,76 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-func-expression.case
+// - src/top-level-await/syntax/for-await-expr.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in for await statements.)
+esid: prod-AwaitExpression
+features: [top-level-await, async-iteration]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (binding of [await function() {}]) {
+ await function() {};
+ break;
+}
+
+// [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (var binding of [await function() {}]) {
+ await function() {};
+ break;
+}
+
+// [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (let binding of [await function() {}]) {
+ await function() {};
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-identifier.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-identifier.js
new file mode 100644
index 0000000000..4cd9126f43
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-identifier.js
@@ -0,0 +1,71 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-identifier.case
+// - src/top-level-await/syntax/for-await-expr.template
+/*---
+description: AwaitExpression IdentifierReference (Valid syntax for top level await in for await statements.)
+esid: prod-AwaitExpression
+features: [top-level-await, async-iteration]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+var foo = 1;
+
+
+var binding;
+
+// [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (binding of [await foo]) {
+ await foo;
+ break;
+}
+
+// [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (var binding of [await foo]) {
+ await foo;
+ break;
+}
+
+// [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (let binding of [await foo]) {
+ await foo;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-literal-number.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-literal-number.js
new file mode 100644
index 0000000000..0107f298e3
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-literal-number.js
@@ -0,0 +1,70 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-number.case
+// - src/top-level-await/syntax/for-await-expr.template
+/*---
+description: AwaitExpression NumberLiteral (Valid syntax for top level await in for await statements.)
+esid: prod-AwaitExpression
+features: [top-level-await, async-iteration]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (binding of [await 1]) {
+ await 1;
+ break;
+}
+
+// [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (var binding of [await 1]) {
+ await 1;
+ break;
+}
+
+// [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (let binding of [await 1]) {
+ await 1;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-literal-string.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-literal-string.js
new file mode 100644
index 0000000000..a5549b9d73
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-literal-string.js
@@ -0,0 +1,70 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-string.case
+// - src/top-level-await/syntax/for-await-expr.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in for await statements.)
+esid: prod-AwaitExpression
+features: [top-level-await, async-iteration]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (binding of [await '']) {
+ await '';
+ break;
+}
+
+// [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (var binding of [await '']) {
+ await '';
+ break;
+}
+
+// [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (let binding of [await '']) {
+ await '';
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-nested.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-nested.js
new file mode 100644
index 0000000000..5c531b2772
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-nested.js
@@ -0,0 +1,66 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-nested.case
+// - src/top-level-await/syntax/for-await-expr.template
+/*---
+description: Nested AwaitExpressions (Valid syntax for top level await in for await statements.)
+esid: prod-AwaitExpression
+features: [top-level-await, async-iteration]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+---*/
+
+
+var binding;
+
+// [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (binding of [await await await await await await await await await await await await await await await 'await']) {
+ await await await await await await await await await await await await await await await 'await';
+ break;
+}
+
+// [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (var binding of [await await await await await await await await await await await await await await await 'await']) {
+ await await await await await await await await await await await await await await await 'await';
+ break;
+}
+
+// [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (let binding of [await await await await await await await await await await await await await await await 'await']) {
+ await await await await await await await await await await await await await await await 'await';
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-new-expr.js
new file mode 100644
index 0000000000..7014e990e5
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-new-expr.js
@@ -0,0 +1,67 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-new-expr.case
+// - src/top-level-await/syntax/for-await-expr.template
+/*---
+description: AwaitExpression new MemberExpression (Valid syntax for top level await in for await statements.)
+esid: prod-AwaitExpression
+features: [top-level-await, async-iteration]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (binding of [await new Promise(function(res, rej) { res(1); })]) {
+ await new Promise(function(res, rej) { res(1); });
+ break;
+}
+
+// [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (var binding of [await new Promise(function(res, rej) { res(1); })]) {
+ await new Promise(function(res, rej) { res(1); });
+ break;
+}
+
+// [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (let binding of [await new Promise(function(res, rej) { res(1); })]) {
+ await new Promise(function(res, rej) { res(1); });
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-null.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-null.js
new file mode 100644
index 0000000000..93dac4b18d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-null.js
@@ -0,0 +1,70 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-null.case
+// - src/top-level-await/syntax/for-await-expr.template
+/*---
+description: AwaitExpression NullLiteral (Valid syntax for top level await in for await statements.)
+esid: prod-AwaitExpression
+features: [top-level-await, async-iteration]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (binding of [await null]) {
+ await null;
+ break;
+}
+
+// [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (var binding of [await null]) {
+ await null;
+ break;
+}
+
+// [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (let binding of [await null]) {
+ await null;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-obj-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-obj-literal.js
new file mode 100644
index 0000000000..69d90f4484
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-obj-literal.js
@@ -0,0 +1,70 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-obj-literal.case
+// - src/top-level-await/syntax/for-await-expr.template
+/*---
+description: AwaitExpression ObjectLiteral (Valid syntax for top level await in for await statements.)
+esid: prod-AwaitExpression
+features: [top-level-await, async-iteration]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (binding of [await { function() {} }]) {
+ await { function() {} };
+ break;
+}
+
+// [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (var binding of [await { function() {} }]) {
+ await { function() {} };
+ break;
+}
+
+// [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (let binding of [await { function() {} }]) {
+ await { function() {} };
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-regexp.js
new file mode 100644
index 0000000000..f7cd701168
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-regexp.js
@@ -0,0 +1,70 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-regexp.case
+// - src/top-level-await/syntax/for-await-expr.template
+/*---
+description: AwaitExpression RegularExpressionLiteral (Valid syntax for top level await in for await statements.)
+esid: prod-AwaitExpression
+features: [top-level-await, async-iteration]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (binding of [await /1/]) {
+ await /1/;
+ break;
+}
+
+// [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (var binding of [await /1/]) {
+ await /1/;
+ break;
+}
+
+// [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (let binding of [await /1/]) {
+ await /1/;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-template-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-template-literal.js
new file mode 100644
index 0000000000..fa4f3f9a8c
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-template-literal.js
@@ -0,0 +1,70 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-template-literal.case
+// - src/top-level-await/syntax/for-await-expr.template
+/*---
+description: AwaitExpression TemplateLiteral (Valid syntax for top level await in for await statements.)
+esid: prod-AwaitExpression
+features: [top-level-await, async-iteration]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (binding of [await ``]) {
+ await ``;
+ break;
+}
+
+// [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (var binding of [await ``]) {
+ await ``;
+ break;
+}
+
+// [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (let binding of [await ``]) {
+ await ``;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-this.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-this.js
new file mode 100644
index 0000000000..0d54cebba0
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-await-expr-this.js
@@ -0,0 +1,70 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-this.case
+// - src/top-level-await/syntax/for-await-expr.template
+/*---
+description: AwaitExpression this (Valid syntax for top level await in for await statements.)
+esid: prod-AwaitExpression
+features: [top-level-await, async-iteration]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// [+Await]for await ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (binding of [await this]) {
+ await this;
+ break;
+}
+
+// [+Await]for await ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (var binding of [await this]) {
+ await this;
+ break;
+}
+
+// [+Await]for await ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for await (let binding of [await this]) {
+ await this;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-array-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-array-literal.js
new file mode 100644
index 0000000000..61b8350e4b
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-array-literal.js
@@ -0,0 +1,76 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-array-literal.case
+// - src/top-level-await/syntax/for-expr.template
+/*---
+description: AwaitExpression ArrayLiteral (Valid syntax for top level await in for statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+// for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( await [] ; await []; await [] ) {
+ await [];
+ break;
+}
+
+// for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( var binding; await []; await [] ) {
+ await [];
+ break;
+}
+
+// for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( let binding; await []; await [] ) {
+ await [];
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-func-expression.js
new file mode 100644
index 0000000000..c30f6a27b1
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-func-expression.js
@@ -0,0 +1,82 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-func-expression.case
+// - src/top-level-await/syntax/for-expr.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in for statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+// for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( await function() {} ; await function() {}; await function() {} ) {
+ await function() {};
+ break;
+}
+
+// for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( var binding; await function() {}; await function() {} ) {
+ await function() {};
+ break;
+}
+
+// for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( let binding; await function() {}; await function() {} ) {
+ await function() {};
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-identifier.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-identifier.js
new file mode 100644
index 0000000000..bc22d5324a
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-identifier.js
@@ -0,0 +1,77 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-identifier.case
+// - src/top-level-await/syntax/for-expr.template
+/*---
+description: AwaitExpression IdentifierReference (Valid syntax for top level await in for statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+var foo = 1;
+
+
+// for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( await foo ; await foo; await foo ) {
+ await foo;
+ break;
+}
+
+// for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( var binding; await foo; await foo ) {
+ await foo;
+ break;
+}
+
+// for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( let binding; await foo; await foo ) {
+ await foo;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-literal-number.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-literal-number.js
new file mode 100644
index 0000000000..781d148dd3
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-literal-number.js
@@ -0,0 +1,76 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-number.case
+// - src/top-level-await/syntax/for-expr.template
+/*---
+description: AwaitExpression NumberLiteral (Valid syntax for top level await in for statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+// for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( await 1 ; await 1; await 1 ) {
+ await 1;
+ break;
+}
+
+// for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( var binding; await 1; await 1 ) {
+ await 1;
+ break;
+}
+
+// for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( let binding; await 1; await 1 ) {
+ await 1;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-literal-string.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-literal-string.js
new file mode 100644
index 0000000000..03bc71c088
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-literal-string.js
@@ -0,0 +1,76 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-string.case
+// - src/top-level-await/syntax/for-expr.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in for statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+// for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( await '' ; await ''; await '' ) {
+ await '';
+ break;
+}
+
+// for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( var binding; await ''; await '' ) {
+ await '';
+ break;
+}
+
+// for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( let binding; await ''; await '' ) {
+ await '';
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-nested.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-nested.js
new file mode 100644
index 0000000000..66cf0c82f8
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-nested.js
@@ -0,0 +1,72 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-nested.case
+// - src/top-level-await/syntax/for-expr.template
+/*---
+description: Nested AwaitExpressions (Valid syntax for top level await in for statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+---*/
+
+
+// for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( await await await await await await await await await await await await await await await 'await' ; await await await await await await await await await await await await await await await 'await'; await await await await await await await await await await await await await await await 'await' ) {
+ await await await await await await await await await await await await await await await 'await';
+ break;
+}
+
+// for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( var binding; await await await await await await await await await await await await await await await 'await'; await await await await await await await await await await await await await await await 'await' ) {
+ await await await await await await await await await await await await await await await 'await';
+ break;
+}
+
+// for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( let binding; await await await await await await await await await await await await await await await 'await'; await await await await await await await await await await await await await await await 'await' ) {
+ await await await await await await await await await await await await await await await 'await';
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-new-expr.js
new file mode 100644
index 0000000000..fbaff486c0
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-new-expr.js
@@ -0,0 +1,73 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-new-expr.case
+// - src/top-level-await/syntax/for-expr.template
+/*---
+description: AwaitExpression new MemberExpression (Valid syntax for top level await in for statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+---*/
+
+
+// for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( await new Promise(function(res, rej) { res(1); }) ; await new Promise(function(res, rej) { res(1); }); await new Promise(function(res, rej) { res(1); }) ) {
+ await new Promise(function(res, rej) { res(1); });
+ break;
+}
+
+// for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( var binding; await new Promise(function(res, rej) { res(1); }); await new Promise(function(res, rej) { res(1); }) ) {
+ await new Promise(function(res, rej) { res(1); });
+ break;
+}
+
+// for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( let binding; await new Promise(function(res, rej) { res(1); }); await new Promise(function(res, rej) { res(1); }) ) {
+ await new Promise(function(res, rej) { res(1); });
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-null.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-null.js
new file mode 100644
index 0000000000..ec57788c4c
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-null.js
@@ -0,0 +1,76 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-null.case
+// - src/top-level-await/syntax/for-expr.template
+/*---
+description: AwaitExpression NullLiteral (Valid syntax for top level await in for statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+// for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( await null ; await null; await null ) {
+ await null;
+ break;
+}
+
+// for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( var binding; await null; await null ) {
+ await null;
+ break;
+}
+
+// for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( let binding; await null; await null ) {
+ await null;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-obj-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-obj-literal.js
new file mode 100644
index 0000000000..d8fc5cd55b
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-obj-literal.js
@@ -0,0 +1,76 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-obj-literal.case
+// - src/top-level-await/syntax/for-expr.template
+/*---
+description: AwaitExpression ObjectLiteral (Valid syntax for top level await in for statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+// for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( await { function() {} } ; await { function() {} }; await { function() {} } ) {
+ await { function() {} };
+ break;
+}
+
+// for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( var binding; await { function() {} }; await { function() {} } ) {
+ await { function() {} };
+ break;
+}
+
+// for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( let binding; await { function() {} }; await { function() {} } ) {
+ await { function() {} };
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-regexp.js
new file mode 100644
index 0000000000..31a5fd3952
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-regexp.js
@@ -0,0 +1,76 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-regexp.case
+// - src/top-level-await/syntax/for-expr.template
+/*---
+description: AwaitExpression RegularExpressionLiteral (Valid syntax for top level await in for statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+// for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( await /1/ ; await /1/; await /1/ ) {
+ await /1/;
+ break;
+}
+
+// for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( var binding; await /1/; await /1/ ) {
+ await /1/;
+ break;
+}
+
+// for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( let binding; await /1/; await /1/ ) {
+ await /1/;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-template-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-template-literal.js
new file mode 100644
index 0000000000..e1361db77b
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-template-literal.js
@@ -0,0 +1,76 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-template-literal.case
+// - src/top-level-await/syntax/for-expr.template
+/*---
+description: AwaitExpression TemplateLiteral (Valid syntax for top level await in for statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+// for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( await `` ; await ``; await `` ) {
+ await ``;
+ break;
+}
+
+// for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( var binding; await ``; await `` ) {
+ await ``;
+ break;
+}
+
+// for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( let binding; await ``; await `` ) {
+ await ``;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-this.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-this.js
new file mode 100644
index 0000000000..dcf11d606a
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-await-expr-this.js
@@ -0,0 +1,76 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-this.case
+// - src/top-level-await/syntax/for-expr.template
+/*---
+description: AwaitExpression this (Valid syntax for top level await in for statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+// for ( [ lookahead ≠ let [] Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( await this ; await this; await this ) {
+ await this;
+ break;
+}
+
+// for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( var binding; await this; await this ) {
+ await this;
+ break;
+}
+
+// for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+for ( let binding; await this; await this ) {
+ await this;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-array-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-array-literal.js
new file mode 100644
index 0000000000..f51b16477d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-array-literal.js
@@ -0,0 +1,78 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-array-literal.case
+// - src/top-level-await/syntax/for-in-expr.template
+/*---
+description: AwaitExpression ArrayLiteral (Valid syntax for top level await in for-in statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding in [await []]) {
+ await [];
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding in [await []]) {
+ await [];
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding in [await []]) {
+ await [];
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-func-expression.js
new file mode 100644
index 0000000000..df63185843
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-func-expression.js
@@ -0,0 +1,84 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-func-expression.case
+// - src/top-level-await/syntax/for-in-expr.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in for-in statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding in [await function() {}]) {
+ await function() {};
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding in [await function() {}]) {
+ await function() {};
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding in [await function() {}]) {
+ await function() {};
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-identifier.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-identifier.js
new file mode 100644
index 0000000000..c5799bb31b
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-identifier.js
@@ -0,0 +1,79 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-identifier.case
+// - src/top-level-await/syntax/for-in-expr.template
+/*---
+description: AwaitExpression IdentifierReference (Valid syntax for top level await in for-in statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+var foo = 1;
+
+
+var binding;
+
+// for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding in [await foo]) {
+ await foo;
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding in [await foo]) {
+ await foo;
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding in [await foo]) {
+ await foo;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-literal-number.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-literal-number.js
new file mode 100644
index 0000000000..50d0f4567f
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-literal-number.js
@@ -0,0 +1,78 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-number.case
+// - src/top-level-await/syntax/for-in-expr.template
+/*---
+description: AwaitExpression NumberLiteral (Valid syntax for top level await in for-in statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding in [await 1]) {
+ await 1;
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding in [await 1]) {
+ await 1;
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding in [await 1]) {
+ await 1;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-literal-string.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-literal-string.js
new file mode 100644
index 0000000000..7ee2ed4ab5
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-literal-string.js
@@ -0,0 +1,78 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-string.case
+// - src/top-level-await/syntax/for-in-expr.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in for-in statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding in [await '']) {
+ await '';
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding in [await '']) {
+ await '';
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding in [await '']) {
+ await '';
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-nested.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-nested.js
new file mode 100644
index 0000000000..023f343516
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-nested.js
@@ -0,0 +1,74 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-nested.case
+// - src/top-level-await/syntax/for-in-expr.template
+/*---
+description: Nested AwaitExpressions (Valid syntax for top level await in for-in statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding in [await await await await await await await await await await await await await await await 'await']) {
+ await await await await await await await await await await await await await await await 'await';
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding in [await await await await await await await await await await await await await await await 'await']) {
+ await await await await await await await await await await await await await await await 'await';
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding in [await await await await await await await await await await await await await await await 'await']) {
+ await await await await await await await await await await await await await await await 'await';
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-new-expr.js
new file mode 100644
index 0000000000..552aef52c3
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-new-expr.js
@@ -0,0 +1,75 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-new-expr.case
+// - src/top-level-await/syntax/for-in-expr.template
+/*---
+description: AwaitExpression new MemberExpression (Valid syntax for top level await in for-in statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding in [await new Promise(function(res, rej) { res(1); })]) {
+ await new Promise(function(res, rej) { res(1); });
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding in [await new Promise(function(res, rej) { res(1); })]) {
+ await new Promise(function(res, rej) { res(1); });
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding in [await new Promise(function(res, rej) { res(1); })]) {
+ await new Promise(function(res, rej) { res(1); });
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-null.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-null.js
new file mode 100644
index 0000000000..eb94d54533
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-null.js
@@ -0,0 +1,78 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-null.case
+// - src/top-level-await/syntax/for-in-expr.template
+/*---
+description: AwaitExpression NullLiteral (Valid syntax for top level await in for-in statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding in [await null]) {
+ await null;
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding in [await null]) {
+ await null;
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding in [await null]) {
+ await null;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-obj-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-obj-literal.js
new file mode 100644
index 0000000000..f4dec100e8
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-obj-literal.js
@@ -0,0 +1,78 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-obj-literal.case
+// - src/top-level-await/syntax/for-in-expr.template
+/*---
+description: AwaitExpression ObjectLiteral (Valid syntax for top level await in for-in statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding in [await { function() {} }]) {
+ await { function() {} };
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding in [await { function() {} }]) {
+ await { function() {} };
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding in [await { function() {} }]) {
+ await { function() {} };
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-regexp.js
new file mode 100644
index 0000000000..9bc5bb13bc
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-regexp.js
@@ -0,0 +1,78 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-regexp.case
+// - src/top-level-await/syntax/for-in-expr.template
+/*---
+description: AwaitExpression RegularExpressionLiteral (Valid syntax for top level await in for-in statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding in [await /1/]) {
+ await /1/;
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding in [await /1/]) {
+ await /1/;
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding in [await /1/]) {
+ await /1/;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-template-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-template-literal.js
new file mode 100644
index 0000000000..15551dcf41
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-template-literal.js
@@ -0,0 +1,78 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-template-literal.case
+// - src/top-level-await/syntax/for-in-expr.template
+/*---
+description: AwaitExpression TemplateLiteral (Valid syntax for top level await in for-in statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding in [await ``]) {
+ await ``;
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding in [await ``]) {
+ await ``;
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding in [await ``]) {
+ await ``;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-this.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-this.js
new file mode 100644
index 0000000000..24560bccc5
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-in-await-expr-this.js
@@ -0,0 +1,78 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-this.case
+// - src/top-level-await/syntax/for-in-expr.template
+/*---
+description: AwaitExpression this (Valid syntax for top level await in for-in statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding in [await this]) {
+ await this;
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding in [await this]) {
+ await this;
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding in [await this]) {
+ await this;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-array-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-array-literal.js
new file mode 100644
index 0000000000..3340658335
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-array-literal.js
@@ -0,0 +1,78 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-array-literal.case
+// - src/top-level-await/syntax/for-of-expr.template
+/*---
+description: AwaitExpression ArrayLiteral (Valid syntax for top level await in for-of statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding of [await []]) {
+ await [];
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding of [await []]) {
+ await [];
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding of [await []]) {
+ await [];
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-func-expression.js
new file mode 100644
index 0000000000..d8b3cc9cbb
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-func-expression.js
@@ -0,0 +1,84 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-func-expression.case
+// - src/top-level-await/syntax/for-of-expr.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in for-of statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding of [await function() {}]) {
+ await function() {};
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding of [await function() {}]) {
+ await function() {};
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding of [await function() {}]) {
+ await function() {};
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-identifier.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-identifier.js
new file mode 100644
index 0000000000..c991fb8240
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-identifier.js
@@ -0,0 +1,79 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-identifier.case
+// - src/top-level-await/syntax/for-of-expr.template
+/*---
+description: AwaitExpression IdentifierReference (Valid syntax for top level await in for-of statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+var foo = 1;
+
+
+var binding;
+
+// for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding of [await foo]) {
+ await foo;
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding of [await foo]) {
+ await foo;
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding of [await foo]) {
+ await foo;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-literal-number.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-literal-number.js
new file mode 100644
index 0000000000..14db1f8679
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-literal-number.js
@@ -0,0 +1,78 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-number.case
+// - src/top-level-await/syntax/for-of-expr.template
+/*---
+description: AwaitExpression NumberLiteral (Valid syntax for top level await in for-of statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding of [await 1]) {
+ await 1;
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding of [await 1]) {
+ await 1;
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding of [await 1]) {
+ await 1;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-literal-string.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-literal-string.js
new file mode 100644
index 0000000000..417169c916
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-literal-string.js
@@ -0,0 +1,78 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-string.case
+// - src/top-level-await/syntax/for-of-expr.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in for-of statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding of [await '']) {
+ await '';
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding of [await '']) {
+ await '';
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding of [await '']) {
+ await '';
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-nested.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-nested.js
new file mode 100644
index 0000000000..f7a6f1a6ca
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-nested.js
@@ -0,0 +1,74 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-nested.case
+// - src/top-level-await/syntax/for-of-expr.template
+/*---
+description: Nested AwaitExpressions (Valid syntax for top level await in for-of statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding of [await await await await await await await await await await await await await await await 'await']) {
+ await await await await await await await await await await await await await await await 'await';
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding of [await await await await await await await await await await await await await await await 'await']) {
+ await await await await await await await await await await await await await await await 'await';
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding of [await await await await await await await await await await await await await await await 'await']) {
+ await await await await await await await await await await await await await await await 'await';
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-new-expr.js
new file mode 100644
index 0000000000..fb91fff884
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-new-expr.js
@@ -0,0 +1,75 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-new-expr.case
+// - src/top-level-await/syntax/for-of-expr.template
+/*---
+description: AwaitExpression new MemberExpression (Valid syntax for top level await in for-of statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding of [await new Promise(function(res, rej) { res(1); })]) {
+ await new Promise(function(res, rej) { res(1); });
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding of [await new Promise(function(res, rej) { res(1); })]) {
+ await new Promise(function(res, rej) { res(1); });
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding of [await new Promise(function(res, rej) { res(1); })]) {
+ await new Promise(function(res, rej) { res(1); });
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-null.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-null.js
new file mode 100644
index 0000000000..63487adcca
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-null.js
@@ -0,0 +1,78 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-null.case
+// - src/top-level-await/syntax/for-of-expr.template
+/*---
+description: AwaitExpression NullLiteral (Valid syntax for top level await in for-of statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding of [await null]) {
+ await null;
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding of [await null]) {
+ await null;
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding of [await null]) {
+ await null;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-obj-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-obj-literal.js
new file mode 100644
index 0000000000..43d5e4572d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-obj-literal.js
@@ -0,0 +1,78 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-obj-literal.case
+// - src/top-level-await/syntax/for-of-expr.template
+/*---
+description: AwaitExpression ObjectLiteral (Valid syntax for top level await in for-of statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding of [await { function() {} }]) {
+ await { function() {} };
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding of [await { function() {} }]) {
+ await { function() {} };
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding of [await { function() {} }]) {
+ await { function() {} };
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-regexp.js
new file mode 100644
index 0000000000..1f65846ebd
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-regexp.js
@@ -0,0 +1,78 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-regexp.case
+// - src/top-level-await/syntax/for-of-expr.template
+/*---
+description: AwaitExpression RegularExpressionLiteral (Valid syntax for top level await in for-of statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding of [await /1/]) {
+ await /1/;
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding of [await /1/]) {
+ await /1/;
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding of [await /1/]) {
+ await /1/;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-template-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-template-literal.js
new file mode 100644
index 0000000000..a9aae5c087
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-template-literal.js
@@ -0,0 +1,78 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-template-literal.case
+// - src/top-level-await/syntax/for-of-expr.template
+/*---
+description: AwaitExpression TemplateLiteral (Valid syntax for top level await in for-of statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding of [await ``]) {
+ await ``;
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding of [await ``]) {
+ await ``;
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding of [await ``]) {
+ await ``;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-this.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-this.js
new file mode 100644
index 0000000000..481f7bd96c
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/for-of-await-expr-this.js
@@ -0,0 +1,78 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-this.case
+// - src/top-level-await/syntax/for-of-expr.template
+/*---
+description: AwaitExpression this (Valid syntax for top level await in for-of statements.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ ...
+ for ( [ lookahead ≠ let []Expression[~In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( var VariableDeclarationList[~In, ?Yield, ?Await] ; Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( LexicalDeclaration[~In, ?Yield, ?Await] Expression[+In, ?Yield, ?Await]opt ; Expression[+In, ?Yield, ?Await]opt ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let [] LeftHandSideExpression[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] in Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+ ...
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+var binding;
+
+// for ( [lookahead ≠ let] LeftHandSideExpression[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (binding of [await this]) {
+ await this;
+ break;
+}
+
+// for ( var ForBinding[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (var binding of [await this]) {
+ await this;
+ break;
+}
+
+// for ( ForDeclaration[?Yield, ?Await] of AssignmentExpression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+for (let binding of [await this]) {
+ await this;
+ break;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-array-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-array-literal.js
new file mode 100644
index 0000000000..97a504d38a
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-array-literal.js
@@ -0,0 +1,53 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-array-literal.case
+// - src/top-level-await/syntax/if-block.template
+/*---
+description: AwaitExpression ArrayLiteral (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (true) {
+ await [];
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-func-expression.js
new file mode 100644
index 0000000000..2c6f96db00
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-func-expression.js
@@ -0,0 +1,59 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-func-expression.case
+// - src/top-level-await/syntax/if-block.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (true) {
+ await function() {};
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-identifier.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-identifier.js
new file mode 100644
index 0000000000..dc3c12d48d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-identifier.js
@@ -0,0 +1,54 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-identifier.case
+// - src/top-level-await/syntax/if-block.template
+/*---
+description: AwaitExpression IdentifierReference (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+var foo = 1;
+
+
+if (true) {
+ await foo;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-literal-number.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-literal-number.js
new file mode 100644
index 0000000000..e487f1f54b
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-literal-number.js
@@ -0,0 +1,53 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-number.case
+// - src/top-level-await/syntax/if-block.template
+/*---
+description: AwaitExpression NumberLiteral (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (true) {
+ await 1;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-literal-string.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-literal-string.js
new file mode 100644
index 0000000000..686c80dde0
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-literal-string.js
@@ -0,0 +1,53 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-string.case
+// - src/top-level-await/syntax/if-block.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (true) {
+ await '';
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-nested.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-nested.js
new file mode 100644
index 0000000000..c87aa0a286
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-nested.js
@@ -0,0 +1,49 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-nested.case
+// - src/top-level-await/syntax/if-block.template
+/*---
+description: Nested AwaitExpressions (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+---*/
+
+
+if (true) {
+ await await await await await await await await await await await await await await await 'await';
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-new-expr.js
new file mode 100644
index 0000000000..e1f47bf561
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-new-expr.js
@@ -0,0 +1,50 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-new-expr.case
+// - src/top-level-await/syntax/if-block.template
+/*---
+description: AwaitExpression new MemberExpression (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+---*/
+
+
+if (true) {
+ await new Promise(function(res, rej) { res(1); });
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-null.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-null.js
new file mode 100644
index 0000000000..1b47c99e77
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-null.js
@@ -0,0 +1,53 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-null.case
+// - src/top-level-await/syntax/if-block.template
+/*---
+description: AwaitExpression NullLiteral (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (true) {
+ await null;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-obj-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-obj-literal.js
new file mode 100644
index 0000000000..abaf9ada86
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-obj-literal.js
@@ -0,0 +1,53 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-obj-literal.case
+// - src/top-level-await/syntax/if-block.template
+/*---
+description: AwaitExpression ObjectLiteral (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (true) {
+ await { function() {} };
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-regexp.js
new file mode 100644
index 0000000000..50a0a7a960
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-regexp.js
@@ -0,0 +1,53 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-regexp.case
+// - src/top-level-await/syntax/if-block.template
+/*---
+description: AwaitExpression RegularExpressionLiteral (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (true) {
+ await /1/;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-template-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-template-literal.js
new file mode 100644
index 0000000000..2f4b1cdf16
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-template-literal.js
@@ -0,0 +1,53 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-template-literal.case
+// - src/top-level-await/syntax/if-block.template
+/*---
+description: AwaitExpression TemplateLiteral (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (true) {
+ await ``;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-this.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-this.js
new file mode 100644
index 0000000000..a09fc5055c
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-block-await-expr-this.js
@@ -0,0 +1,53 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-this.case
+// - src/top-level-await/syntax/if-block.template
+/*---
+description: AwaitExpression this (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (true) {
+ await this;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-array-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-array-literal.js
new file mode 100644
index 0000000000..dc0aa89dba
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-array-literal.js
@@ -0,0 +1,51 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-array-literal.case
+// - src/top-level-await/syntax/if-expr.template
+/*---
+description: AwaitExpression ArrayLiteral (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (await []) {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-func-expression.js
new file mode 100644
index 0000000000..e7de1c5239
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-func-expression.js
@@ -0,0 +1,57 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-func-expression.case
+// - src/top-level-await/syntax/if-expr.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (await function() {}) {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-identifier.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-identifier.js
new file mode 100644
index 0000000000..700591be6f
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-identifier.js
@@ -0,0 +1,52 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-identifier.case
+// - src/top-level-await/syntax/if-expr.template
+/*---
+description: AwaitExpression IdentifierReference (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+var foo = 1;
+
+
+if (await foo) {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-literal-number.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-literal-number.js
new file mode 100644
index 0000000000..5ebd1215bc
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-literal-number.js
@@ -0,0 +1,51 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-number.case
+// - src/top-level-await/syntax/if-expr.template
+/*---
+description: AwaitExpression NumberLiteral (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (await 1) {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-literal-string.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-literal-string.js
new file mode 100644
index 0000000000..497b374f47
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-literal-string.js
@@ -0,0 +1,51 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-string.case
+// - src/top-level-await/syntax/if-expr.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (await '') {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-nested.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-nested.js
new file mode 100644
index 0000000000..cfc1a15c10
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-nested.js
@@ -0,0 +1,47 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-nested.case
+// - src/top-level-await/syntax/if-expr.template
+/*---
+description: Nested AwaitExpressions (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+---*/
+
+
+if (await await await await await await await await await await await await await await await 'await') {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-new-expr.js
new file mode 100644
index 0000000000..c5ad6a455d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-new-expr.js
@@ -0,0 +1,48 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-new-expr.case
+// - src/top-level-await/syntax/if-expr.template
+/*---
+description: AwaitExpression new MemberExpression (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+---*/
+
+
+if (await new Promise(function(res, rej) { res(1); })) {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-null.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-null.js
new file mode 100644
index 0000000000..45458f3d85
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-null.js
@@ -0,0 +1,51 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-null.case
+// - src/top-level-await/syntax/if-expr.template
+/*---
+description: AwaitExpression NullLiteral (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (await null) {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-obj-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-obj-literal.js
new file mode 100644
index 0000000000..9195e4f500
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-obj-literal.js
@@ -0,0 +1,51 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-obj-literal.case
+// - src/top-level-await/syntax/if-expr.template
+/*---
+description: AwaitExpression ObjectLiteral (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (await { function() {} }) {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-regexp.js
new file mode 100644
index 0000000000..329ba64716
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-regexp.js
@@ -0,0 +1,51 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-regexp.case
+// - src/top-level-await/syntax/if-expr.template
+/*---
+description: AwaitExpression RegularExpressionLiteral (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (await /1/) {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-template-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-template-literal.js
new file mode 100644
index 0000000000..e71e1ec14c
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-template-literal.js
@@ -0,0 +1,51 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-template-literal.case
+// - src/top-level-await/syntax/if-expr.template
+/*---
+description: AwaitExpression TemplateLiteral (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (await ``) {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-this.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-this.js
new file mode 100644
index 0000000000..aebcf3060f
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/if-expr-await-expr-this.js
@@ -0,0 +1,51 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-this.case
+// - src/top-level-await/syntax/if-expr.template
+/*---
+description: AwaitExpression this (Valid syntax for top level await in an if expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IfStatement[Yield, Await, Return]:
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]elseStatement[?Yield, ?Await, ?Return]
+ if(Expression[+In, ?Yield, ?Await])Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+if (await this) {}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/shell.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/shell.js
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-array-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-array-literal.js
new file mode 100644
index 0000000000..5816ae0ac4
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-array-literal.js
@@ -0,0 +1,45 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-array-literal.case
+// - src/top-level-await/syntax/top-level.template
+/*---
+description: AwaitExpression ArrayLiteral (Valid syntax for top level await.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+await [];
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-func-expression.js
new file mode 100644
index 0000000000..f7d250385d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-func-expression.js
@@ -0,0 +1,51 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-func-expression.case
+// - src/top-level-await/syntax/top-level.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+await function() {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-identifier.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-identifier.js
new file mode 100644
index 0000000000..c5e5d55a18
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-identifier.js
@@ -0,0 +1,46 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-identifier.case
+// - src/top-level-await/syntax/top-level.template
+/*---
+description: AwaitExpression IdentifierReference (Valid syntax for top level await.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+var foo = 1;
+
+
+await foo;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-literal-number.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-literal-number.js
new file mode 100644
index 0000000000..bad2046a05
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-literal-number.js
@@ -0,0 +1,45 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-number.case
+// - src/top-level-await/syntax/top-level.template
+/*---
+description: AwaitExpression NumberLiteral (Valid syntax for top level await.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+await 1;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-literal-string.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-literal-string.js
new file mode 100644
index 0000000000..b028e3d023
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-literal-string.js
@@ -0,0 +1,45 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-string.case
+// - src/top-level-await/syntax/top-level.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+await '';
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-nested.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-nested.js
new file mode 100644
index 0000000000..a3d7c9e61b
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-nested.js
@@ -0,0 +1,41 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-nested.case
+// - src/top-level-await/syntax/top-level.template
+/*---
+description: Nested AwaitExpressions (Valid syntax for top level await.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+---*/
+
+
+await await await await await await await await await await await await await await await 'await';
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-new-expr.js
new file mode 100644
index 0000000000..cf1883c592
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-new-expr.js
@@ -0,0 +1,42 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-new-expr.case
+// - src/top-level-await/syntax/top-level.template
+/*---
+description: AwaitExpression new MemberExpression (Valid syntax for top level await.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+---*/
+
+
+await new Promise(function(res, rej) { res(1); });
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-null.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-null.js
new file mode 100644
index 0000000000..5d874c23b8
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-null.js
@@ -0,0 +1,45 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-null.case
+// - src/top-level-await/syntax/top-level.template
+/*---
+description: AwaitExpression NullLiteral (Valid syntax for top level await.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+await null;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-obj-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-obj-literal.js
new file mode 100644
index 0000000000..f87ce5a6b5
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-obj-literal.js
@@ -0,0 +1,45 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-obj-literal.case
+// - src/top-level-await/syntax/top-level.template
+/*---
+description: AwaitExpression ObjectLiteral (Valid syntax for top level await.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+await { function() {} };
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-regexp.js
new file mode 100644
index 0000000000..de93b53279
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-regexp.js
@@ -0,0 +1,45 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-regexp.case
+// - src/top-level-await/syntax/top-level.template
+/*---
+description: AwaitExpression RegularExpressionLiteral (Valid syntax for top level await.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+await /1/;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-template-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-template-literal.js
new file mode 100644
index 0000000000..c64cf2b6d1
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-template-literal.js
@@ -0,0 +1,45 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-template-literal.case
+// - src/top-level-await/syntax/top-level.template
+/*---
+description: AwaitExpression TemplateLiteral (Valid syntax for top level await.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+await ``;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-this.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-this.js
new file mode 100644
index 0000000000..af1c9a613b
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/top-level-await-expr-this.js
@@ -0,0 +1,45 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-this.case
+// - src/top-level-await/syntax/top-level.template
+/*---
+description: AwaitExpression this (Valid syntax for top level await.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+await this;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-array-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-array-literal.js
new file mode 100644
index 0000000000..4d82f8a135
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-array-literal.js
@@ -0,0 +1,70 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-array-literal.case
+// - src/top-level-await/syntax/try.template
+/*---
+description: AwaitExpression ArrayLiteral (Valid syntax for top level await in try-catch-finally blocks.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+try {
+ await [];
+} catch(e) {
+ await [];
+}
+
+try {
+ await [];
+} finally {
+ await [];
+}
+
+try {
+ await [];
+} catch(e) {
+ await [];
+} finally {
+ await [];
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-func-expression.js
new file mode 100644
index 0000000000..e08ca19bb6
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-func-expression.js
@@ -0,0 +1,76 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-func-expression.case
+// - src/top-level-await/syntax/try.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in try-catch-finally blocks.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+try {
+ await function() {};
+} catch(e) {
+ await function() {};
+}
+
+try {
+ await function() {};
+} finally {
+ await function() {};
+}
+
+try {
+ await function() {};
+} catch(e) {
+ await function() {};
+} finally {
+ await function() {};
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-identifier.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-identifier.js
new file mode 100644
index 0000000000..072ddbdb08
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-identifier.js
@@ -0,0 +1,71 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-identifier.case
+// - src/top-level-await/syntax/try.template
+/*---
+description: AwaitExpression IdentifierReference (Valid syntax for top level await in try-catch-finally blocks.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+var foo = 1;
+
+
+try {
+ await foo;
+} catch(e) {
+ await foo;
+}
+
+try {
+ await foo;
+} finally {
+ await foo;
+}
+
+try {
+ await foo;
+} catch(e) {
+ await foo;
+} finally {
+ await foo;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-literal-number.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-literal-number.js
new file mode 100644
index 0000000000..8e1627aebe
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-literal-number.js
@@ -0,0 +1,70 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-number.case
+// - src/top-level-await/syntax/try.template
+/*---
+description: AwaitExpression NumberLiteral (Valid syntax for top level await in try-catch-finally blocks.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+try {
+ await 1;
+} catch(e) {
+ await 1;
+}
+
+try {
+ await 1;
+} finally {
+ await 1;
+}
+
+try {
+ await 1;
+} catch(e) {
+ await 1;
+} finally {
+ await 1;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-literal-string.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-literal-string.js
new file mode 100644
index 0000000000..8a493f05b6
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-literal-string.js
@@ -0,0 +1,70 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-string.case
+// - src/top-level-await/syntax/try.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in try-catch-finally blocks.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+try {
+ await '';
+} catch(e) {
+ await '';
+}
+
+try {
+ await '';
+} finally {
+ await '';
+}
+
+try {
+ await '';
+} catch(e) {
+ await '';
+} finally {
+ await '';
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-nested.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-nested.js
new file mode 100644
index 0000000000..0eb8dbd39f
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-nested.js
@@ -0,0 +1,66 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-nested.case
+// - src/top-level-await/syntax/try.template
+/*---
+description: Nested AwaitExpressions (Valid syntax for top level await in try-catch-finally blocks.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+---*/
+
+
+try {
+ await await await await await await await await await await await await await await await 'await';
+} catch(e) {
+ await await await await await await await await await await await await await await await 'await';
+}
+
+try {
+ await await await await await await await await await await await await await await await 'await';
+} finally {
+ await await await await await await await await await await await await await await await 'await';
+}
+
+try {
+ await await await await await await await await await await await await await await await 'await';
+} catch(e) {
+ await await await await await await await await await await await await await await await 'await';
+} finally {
+ await await await await await await await await await await await await await await await 'await';
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-new-expr.js
new file mode 100644
index 0000000000..3f70273d17
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-new-expr.js
@@ -0,0 +1,67 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-new-expr.case
+// - src/top-level-await/syntax/try.template
+/*---
+description: AwaitExpression new MemberExpression (Valid syntax for top level await in try-catch-finally blocks.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+---*/
+
+
+try {
+ await new Promise(function(res, rej) { res(1); });
+} catch(e) {
+ await new Promise(function(res, rej) { res(1); });
+}
+
+try {
+ await new Promise(function(res, rej) { res(1); });
+} finally {
+ await new Promise(function(res, rej) { res(1); });
+}
+
+try {
+ await new Promise(function(res, rej) { res(1); });
+} catch(e) {
+ await new Promise(function(res, rej) { res(1); });
+} finally {
+ await new Promise(function(res, rej) { res(1); });
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-null.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-null.js
new file mode 100644
index 0000000000..94fafa6e40
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-null.js
@@ -0,0 +1,70 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-null.case
+// - src/top-level-await/syntax/try.template
+/*---
+description: AwaitExpression NullLiteral (Valid syntax for top level await in try-catch-finally blocks.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+try {
+ await null;
+} catch(e) {
+ await null;
+}
+
+try {
+ await null;
+} finally {
+ await null;
+}
+
+try {
+ await null;
+} catch(e) {
+ await null;
+} finally {
+ await null;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-obj-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-obj-literal.js
new file mode 100644
index 0000000000..9b88864fd4
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-obj-literal.js
@@ -0,0 +1,70 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-obj-literal.case
+// - src/top-level-await/syntax/try.template
+/*---
+description: AwaitExpression ObjectLiteral (Valid syntax for top level await in try-catch-finally blocks.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+try {
+ await { function() {} };
+} catch(e) {
+ await { function() {} };
+}
+
+try {
+ await { function() {} };
+} finally {
+ await { function() {} };
+}
+
+try {
+ await { function() {} };
+} catch(e) {
+ await { function() {} };
+} finally {
+ await { function() {} };
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-regexp.js
new file mode 100644
index 0000000000..d6d3d9723d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-regexp.js
@@ -0,0 +1,70 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-regexp.case
+// - src/top-level-await/syntax/try.template
+/*---
+description: AwaitExpression RegularExpressionLiteral (Valid syntax for top level await in try-catch-finally blocks.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+try {
+ await /1/;
+} catch(e) {
+ await /1/;
+}
+
+try {
+ await /1/;
+} finally {
+ await /1/;
+}
+
+try {
+ await /1/;
+} catch(e) {
+ await /1/;
+} finally {
+ await /1/;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-template-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-template-literal.js
new file mode 100644
index 0000000000..c02ace77aa
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-template-literal.js
@@ -0,0 +1,70 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-template-literal.case
+// - src/top-level-await/syntax/try.template
+/*---
+description: AwaitExpression TemplateLiteral (Valid syntax for top level await in try-catch-finally blocks.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+try {
+ await ``;
+} catch(e) {
+ await ``;
+}
+
+try {
+ await ``;
+} finally {
+ await ``;
+}
+
+try {
+ await ``;
+} catch(e) {
+ await ``;
+} finally {
+ await ``;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-this.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-this.js
new file mode 100644
index 0000000000..ac4960596d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/try-await-expr-this.js
@@ -0,0 +1,70 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-this.case
+// - src/top-level-await/syntax/try.template
+/*---
+description: AwaitExpression this (Valid syntax for top level await in try-catch-finally blocks.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+try {
+ await this;
+} catch(e) {
+ await this;
+}
+
+try {
+ await this;
+} finally {
+ await this;
+}
+
+try {
+ await this;
+} catch(e) {
+ await this;
+} finally {
+ await this;
+}
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-array-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-array-literal.js
new file mode 100644
index 0000000000..f886a5acdc
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-array-literal.js
@@ -0,0 +1,46 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-array-literal.case
+// - src/top-level-await/syntax/typeof.template
+/*---
+description: AwaitExpression ArrayLiteral (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ typeof UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+typeof await [];
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-func-expression.js
new file mode 100644
index 0000000000..f9d07dab50
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-func-expression.js
@@ -0,0 +1,52 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-func-expression.case
+// - src/top-level-await/syntax/typeof.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ typeof UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+typeof await function() {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-identifier.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-identifier.js
new file mode 100644
index 0000000000..8e265a43ae
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-identifier.js
@@ -0,0 +1,47 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-identifier.case
+// - src/top-level-await/syntax/typeof.template
+/*---
+description: AwaitExpression IdentifierReference (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ typeof UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+var foo = 1;
+
+
+typeof await foo;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-literal-number.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-literal-number.js
new file mode 100644
index 0000000000..0290f5e9d1
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-literal-number.js
@@ -0,0 +1,46 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-number.case
+// - src/top-level-await/syntax/typeof.template
+/*---
+description: AwaitExpression NumberLiteral (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ typeof UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+typeof await 1;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-literal-string.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-literal-string.js
new file mode 100644
index 0000000000..2ea0abc6aa
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-literal-string.js
@@ -0,0 +1,46 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-string.case
+// - src/top-level-await/syntax/typeof.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ typeof UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+typeof await '';
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-nested.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-nested.js
new file mode 100644
index 0000000000..21e286cf97
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-nested.js
@@ -0,0 +1,42 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-nested.case
+// - src/top-level-await/syntax/typeof.template
+/*---
+description: Nested AwaitExpressions (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ typeof UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+---*/
+
+
+typeof await await await await await await await await await await await await await await await 'await';
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-new-expr.js
new file mode 100644
index 0000000000..353589d296
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-new-expr.js
@@ -0,0 +1,43 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-new-expr.case
+// - src/top-level-await/syntax/typeof.template
+/*---
+description: AwaitExpression new MemberExpression (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ typeof UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+---*/
+
+
+typeof await new Promise(function(res, rej) { res(1); });
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-null.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-null.js
new file mode 100644
index 0000000000..9c2b157b38
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-null.js
@@ -0,0 +1,46 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-null.case
+// - src/top-level-await/syntax/typeof.template
+/*---
+description: AwaitExpression NullLiteral (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ typeof UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+typeof await null;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-obj-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-obj-literal.js
new file mode 100644
index 0000000000..574cb372d7
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-obj-literal.js
@@ -0,0 +1,46 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-obj-literal.case
+// - src/top-level-await/syntax/typeof.template
+/*---
+description: AwaitExpression ObjectLiteral (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ typeof UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+typeof await { function() {} };
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-regexp.js
new file mode 100644
index 0000000000..984e5b26c4
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-regexp.js
@@ -0,0 +1,46 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-regexp.case
+// - src/top-level-await/syntax/typeof.template
+/*---
+description: AwaitExpression RegularExpressionLiteral (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ typeof UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+typeof await /1/;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-template-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-template-literal.js
new file mode 100644
index 0000000000..125e3fbe12
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-template-literal.js
@@ -0,0 +1,46 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-template-literal.case
+// - src/top-level-await/syntax/typeof.template
+/*---
+description: AwaitExpression TemplateLiteral (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ typeof UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+typeof await ``;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-this.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-this.js
new file mode 100644
index 0000000000..8ae49ab87a
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/typeof-await-expr-this.js
@@ -0,0 +1,46 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-this.case
+// - src/top-level-await/syntax/typeof.template
+/*---
+description: AwaitExpression this (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ typeof UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+typeof await this;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-array-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-array-literal.js
new file mode 100644
index 0000000000..d1125518b9
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-array-literal.js
@@ -0,0 +1,46 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-array-literal.case
+// - src/top-level-await/syntax/void.template
+/*---
+description: AwaitExpression ArrayLiteral (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ void UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+void await [];
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-func-expression.js
new file mode 100644
index 0000000000..d01d3c4b71
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-func-expression.js
@@ -0,0 +1,52 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-func-expression.case
+// - src/top-level-await/syntax/void.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ void UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+void await function() {};
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-identifier.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-identifier.js
new file mode 100644
index 0000000000..dafdda387e
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-identifier.js
@@ -0,0 +1,47 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-identifier.case
+// - src/top-level-await/syntax/void.template
+/*---
+description: AwaitExpression IdentifierReference (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ void UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+var foo = 1;
+
+
+void await foo;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-literal-number.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-literal-number.js
new file mode 100644
index 0000000000..9b7fe68681
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-literal-number.js
@@ -0,0 +1,46 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-number.case
+// - src/top-level-await/syntax/void.template
+/*---
+description: AwaitExpression NumberLiteral (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ void UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+void await 1;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-literal-string.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-literal-string.js
new file mode 100644
index 0000000000..c3d269387f
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-literal-string.js
@@ -0,0 +1,46 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-string.case
+// - src/top-level-await/syntax/void.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ void UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+void await '';
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-nested.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-nested.js
new file mode 100644
index 0000000000..6823745686
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-nested.js
@@ -0,0 +1,42 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-nested.case
+// - src/top-level-await/syntax/void.template
+/*---
+description: Nested AwaitExpressions (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ void UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+---*/
+
+
+void await await await await await await await await await await await await await await await 'await';
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-new-expr.js
new file mode 100644
index 0000000000..c6017b6eb2
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-new-expr.js
@@ -0,0 +1,43 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-new-expr.case
+// - src/top-level-await/syntax/void.template
+/*---
+description: AwaitExpression new MemberExpression (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ void UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+---*/
+
+
+void await new Promise(function(res, rej) { res(1); });
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-null.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-null.js
new file mode 100644
index 0000000000..849cd76d8d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-null.js
@@ -0,0 +1,46 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-null.case
+// - src/top-level-await/syntax/void.template
+/*---
+description: AwaitExpression NullLiteral (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ void UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+void await null;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-obj-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-obj-literal.js
new file mode 100644
index 0000000000..fea62fa5c6
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-obj-literal.js
@@ -0,0 +1,46 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-obj-literal.case
+// - src/top-level-await/syntax/void.template
+/*---
+description: AwaitExpression ObjectLiteral (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ void UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+void await { function() {} };
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-regexp.js
new file mode 100644
index 0000000000..540452120d
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-regexp.js
@@ -0,0 +1,46 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-regexp.case
+// - src/top-level-await/syntax/void.template
+/*---
+description: AwaitExpression RegularExpressionLiteral (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ void UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+void await /1/;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-template-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-template-literal.js
new file mode 100644
index 0000000000..1f89fb7210
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-template-literal.js
@@ -0,0 +1,46 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-template-literal.case
+// - src/top-level-await/syntax/void.template
+/*---
+description: AwaitExpression TemplateLiteral (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ void UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+void await ``;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-this.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-this.js
new file mode 100644
index 0000000000..aab82b4198
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/void-await-expr-this.js
@@ -0,0 +1,46 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-this.case
+// - src/top-level-await/syntax/void.template
+/*---
+description: AwaitExpression this (Valid syntax for top level await in an UnaryExpression (void).)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ void UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+void await this;
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-array-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-array-literal.js
new file mode 100644
index 0000000000..009672fbfb
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-array-literal.js
@@ -0,0 +1,50 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-array-literal.case
+// - src/top-level-await/syntax/while-expr.template
+/*---
+description: AwaitExpression ArrayLiteral (Valid syntax for top level await in an while expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ while ( Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+while (await []) { break; }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-func-expression.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-func-expression.js
new file mode 100644
index 0000000000..7c7788b6a5
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-func-expression.js
@@ -0,0 +1,56 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-func-expression.case
+// - src/top-level-await/syntax/while-expr.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in an while expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ while ( Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+ ...
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+while (await function() {}) { break; }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-identifier.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-identifier.js
new file mode 100644
index 0000000000..055c9ab664
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-identifier.js
@@ -0,0 +1,51 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-identifier.case
+// - src/top-level-await/syntax/while-expr.template
+/*---
+description: AwaitExpression IdentifierReference (Valid syntax for top level await in an while expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ while ( Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+var foo = 1;
+
+
+while (await foo) { break; }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-literal-number.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-literal-number.js
new file mode 100644
index 0000000000..2d2e724f11
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-literal-number.js
@@ -0,0 +1,50 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-number.case
+// - src/top-level-await/syntax/while-expr.template
+/*---
+description: AwaitExpression NumberLiteral (Valid syntax for top level await in an while expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ while ( Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+while (await 1) { break; }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-literal-string.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-literal-string.js
new file mode 100644
index 0000000000..ff3c25e9e8
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-literal-string.js
@@ -0,0 +1,50 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-literal-string.case
+// - src/top-level-await/syntax/while-expr.template
+/*---
+description: AwaitExpression StringLiteral (Valid syntax for top level await in an while expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ while ( Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+while (await '') { break; }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-nested.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-nested.js
new file mode 100644
index 0000000000..be70e74db2
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-nested.js
@@ -0,0 +1,46 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-nested.case
+// - src/top-level-await/syntax/while-expr.template
+/*---
+description: Nested AwaitExpressions (Valid syntax for top level await in an while expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ while ( Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ TryStatement[Yield, Await, Return]:
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+ try Block[?Yield, ?Await, ?Return] Catch[?Yield, ?Await, ?Return] Finally[?Yield, ?Await, ?Return]
+
+ ...
+
+ ExpressionStatement[Yield, Await]:
+ [lookahead ∉ { {, function, async [no LineTerminator here] function, class, let [ }]
+ Expression[+In, ?Yield, ?Await];
+
+---*/
+
+
+while (await await await await await await await await await await await await await await await 'await') { break; }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-new-expr.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-new-expr.js
new file mode 100644
index 0000000000..3411b85e43
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-new-expr.js
@@ -0,0 +1,47 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-new-expr.case
+// - src/top-level-await/syntax/while-expr.template
+/*---
+description: AwaitExpression new MemberExpression (Valid syntax for top level await in an while expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ while ( Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ LeftHandSideExpression[Yield, Await]:
+ NewExpression[?Yield, ?Await]
+ CallExpression[?Yield, ?Await]
+
+ NewExpression[Yield, Await]:
+ MemberExpression[?Yield, ?Await]
+ new NewExpression[?Yield, ?Await]
+
+ MemberExpression[Yield, Await]:
+ ...
+ new MemberExpression[?Yield, ?Await] Arguments[?Yield, ?Await]
+
+---*/
+
+
+while (await new Promise(function(res, rej) { res(1); })) { break; }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-null.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-null.js
new file mode 100644
index 0000000000..e78a1a967e
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-null.js
@@ -0,0 +1,50 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-null.case
+// - src/top-level-await/syntax/while-expr.template
+/*---
+description: AwaitExpression NullLiteral (Valid syntax for top level await in an while expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ while ( Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+while (await null) { break; }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-obj-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-obj-literal.js
new file mode 100644
index 0000000000..aaf318c2d3
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-obj-literal.js
@@ -0,0 +1,50 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-obj-literal.case
+// - src/top-level-await/syntax/while-expr.template
+/*---
+description: AwaitExpression ObjectLiteral (Valid syntax for top level await in an while expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ while ( Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+while (await { function() {} }) { break; }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-regexp.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-regexp.js
new file mode 100644
index 0000000000..e628f66b84
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-regexp.js
@@ -0,0 +1,50 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-regexp.case
+// - src/top-level-await/syntax/while-expr.template
+/*---
+description: AwaitExpression RegularExpressionLiteral (Valid syntax for top level await in an while expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ while ( Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+while (await /1/) { break; }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-template-literal.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-template-literal.js
new file mode 100644
index 0000000000..74080bbbb0
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-template-literal.js
@@ -0,0 +1,50 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-template-literal.case
+// - src/top-level-await/syntax/while-expr.template
+/*---
+description: AwaitExpression TemplateLiteral (Valid syntax for top level await in an while expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ while ( Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+while (await ``) { break; }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-this.js b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-this.js
new file mode 100644
index 0000000000..71b7679487
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/syntax/while-await-expr-this.js
@@ -0,0 +1,50 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module -- requires shell-options
+// This file was procedurally generated from the following sources:
+// - src/top-level-await/await-expr-this.case
+// - src/top-level-await/syntax/while-expr.template
+/*---
+description: AwaitExpression this (Valid syntax for top level await in an while expression position.)
+esid: prod-AwaitExpression
+features: [top-level-await]
+flags: [generated, module]
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ IterationStatement[Yield, Await, Return]:
+ while ( Expression[+In, ?Yield, ?Await] ) Statement[?Yield, ?Await, ?Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+
+ ...
+
+
+ PrimaryExpression[Yield, Await]:
+ this
+ IdentifierReference[?Yield, ?Await]
+ Literal
+ ArrayLiteral[?Yield, ?Await]
+ ObjectLiteral[?Yield, ?Await]
+ FunctionExpression
+ ClassExpression[?Yield, ?Await]
+ GeneratorExpression
+ AsyncFunctionExpression
+ AsyncGeneratorExpression
+ RegularExpressionLiteral
+ TemplateLiteral[?Yield, ?Await, ~Tagged]
+ CoverParenthesizedExpressionAndArrowParameterList[?Yield, ?Await]
+
+---*/
+
+
+while (await this) { break; }
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/module-code/top-level-await/top-level-ticks-2.js b/js/src/tests/test262/language/module-code/top-level-await/top-level-ticks-2.js
new file mode 100644
index 0000000000..001966f3dd
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/top-level-ticks-2.js
@@ -0,0 +1,47 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module async -- requires shell-options
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-asyncblockstart
+description: >
+ Evaluation of await ticks order
+info: |
+ AsyncBlockStart ( promiseCapability, asyncBody, asyncContext )
+
+ 1. Assert: promiseCapability is a PromiseCapability Record.
+ 2. Let runningContext be the running execution context.
+ 3. Set the code evaluation state of asyncContext such that when evaluation is resumed for that execution context the following steps will be performed:
+ a. Let result be the result of evaluating asyncBody.
+ ...
+includes: [compareArray.js]
+flags: [module, async]
+features: [top-level-await]
+---*/
+
+var expected = [
+ 'await 1',
+ 'tick 1',
+ 'await 2',
+ 'tick 2',
+ 'await 3',
+ 'tick 3',
+ 'await 4',
+ 'tick 4',
+];
+
+var actual = [];
+
+Promise.resolve(0)
+ .then(() => actual.push('tick 1'))
+ .then(() => actual.push('tick 2'))
+ .then(() => actual.push('tick 3'))
+ .then(() => actual.push('tick 4'))
+ .then(() => {
+ assert.compareArray(actual, expected, 'Ticks for top level await and promises');
+}).then($DONE, $DONE);
+
+await actual.push('await 1');
+await actual.push('await 2');
+await actual.push('await 3');
+await actual.push('await 4');
diff --git a/js/src/tests/test262/language/module-code/top-level-await/top-level-ticks.js b/js/src/tests/test262/language/module-code/top-level-await/top-level-ticks.js
new file mode 100644
index 0000000000..43e786f311
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/top-level-ticks.js
@@ -0,0 +1,47 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module async -- requires shell-options
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+esid: sec-asyncblockstart
+description: >
+ Evaluation of await ticks order
+info: |
+ AsyncBlockStart ( promiseCapability, asyncBody, asyncContext )
+
+ 1. Assert: promiseCapability is a PromiseCapability Record.
+ 2. Let runningContext be the running execution context.
+ 3. Set the code evaluation state of asyncContext such that when evaluation is resumed for that execution context the following steps will be performed:
+ a. Let result be the result of evaluating asyncBody.
+ ...
+includes: [compareArray.js]
+flags: [module, async]
+features: [top-level-await]
+---*/
+
+var expected = [
+ 'tick 1',
+ 'await 1',
+ 'tick 2',
+ 'await 2',
+ 'tick 3',
+ 'await 3',
+ 'tick 4',
+ 'await 4',
+];
+
+var actual = [];
+
+Promise.resolve(0)
+ .then(() => actual.push('tick 1'))
+ .then(() => actual.push('tick 2'))
+ .then(() => actual.push('tick 3'))
+ .then(() => actual.push('tick 4'))
+ .then(() => {
+ assert.compareArray(actual, expected, 'Ticks for top level await and promises');
+}).then($DONE, $DONE);
+
+await 1; actual.push('await 1');
+await 2; actual.push('await 2');
+await 3; actual.push('await 3');
+await 4; actual.push('await 4');
diff --git a/js/src/tests/test262/language/module-code/top-level-await/void-await-expr.js b/js/src/tests/test262/language/module-code/top-level-await/void-await-expr.js
new file mode 100644
index 0000000000..fba36f5009
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/void-await-expr.js
@@ -0,0 +1,36 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module async -- requires shell-options
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ void AwaitExpression is still evaluated
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ void UnaryExpression[?Yield, ?Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+esid: prod-AwaitExpression
+flags: [module, async]
+features: [top-level-await]
+---*/
+
+var got = 0;
+var x = {
+ get y() {
+ got += 1;
+ }
+};
+
+void await x.y;
+
+assert.sameValue(got, 1);
+
+$DONE();
diff --git a/js/src/tests/test262/language/module-code/top-level-await/while-dynamic-evaluation.js b/js/src/tests/test262/language/module-code/top-level-await/while-dynamic-evaluation.js
new file mode 100644
index 0000000000..5641e7ded9
--- /dev/null
+++ b/js/src/tests/test262/language/module-code/top-level-await/while-dynamic-evaluation.js
@@ -0,0 +1,49 @@
+// |reftest| shell-option(--enable-top-level-await) skip-if(!xulRuntime.shell) module async -- requires shell-options
+// Copyright (C) 2019 Leo Balter. All rights reserved.
+// This code is governed by the BSD license found in the LICENSE file.
+
+/*---
+description: >
+ Evaluate Await expression for IfStatement
+info: |
+ ModuleItem:
+ StatementListItem[~Yield, +Await, ~Return]
+
+ ...
+
+ UnaryExpression[Yield, Await]
+ [+Await]AwaitExpression[?Yield]
+
+ AwaitExpression[Yield]:
+ await UnaryExpression[?Yield, +Await]
+esid: prod-AwaitExpression
+flags: [module, async]
+features: [top-level-await]
+---*/
+
+var values = [];
+var p = Promise.resolve().then(() => {
+ // Replaces p!
+ p = Promise.resolve().then(() => {
+ p = Promise.resolve().then(() => {
+ values.push(3);
+ return false;
+ });
+
+ values.push(2);
+ return true;
+ })
+
+ values.push(1);
+
+ return true;
+});
+
+while (await p) {}
+
+assert.sameValue(values.length, 3);
+assert.sameValue(values[0], 1);
+assert.sameValue(values[1], 2);
+assert.sameValue(values[2], 3);
+
+$DONE();