summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/language/statements/class/async-gen-method
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /js/src/tests/test262/language/statements/class/async-gen-method
parentInitial commit. (diff)
downloadfirefox-esr-upstream.tar.xz
firefox-esr-upstream.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'js/src/tests/test262/language/statements/class/async-gen-method')
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/array-destructuring-param-strict-body.js137
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/await-as-binding-identifier-escaped.js37
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/await-as-binding-identifier.js37
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/await-as-identifier-reference-escaped.js37
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/await-as-identifier-reference.js37
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/await-as-label-identifier-escaped.js37
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/await-as-label-identifier.js37
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-abrupt.js67
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-arg-val-not-undefined.js91
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-arg-val-undefined.js74
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-duplicates.js66
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-ref-later.js68
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-ref-prior.js71
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-ref-self.js68
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-rest.js70
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-trailing-comma.js66
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b1/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b1/cls-decl-async-gen-meth-forbidden-ext-direct-access-prop-arguments.js38
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b1/cls-decl-async-gen-meth-forbidden-ext-direct-access-prop-caller.js38
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b1/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b2/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b2/cls-decl-async-gen-meth-forbidden-ext-indirect-access-own-prop-caller-get.js64
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b2/cls-decl-async-gen-meth-forbidden-ext-indirect-access-own-prop-caller-value.js64
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b2/cls-decl-async-gen-meth-forbidden-ext-indirect-access-prop-caller.js64
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b2/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/browser.js0
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/object-destructuring-param-strict-body.js137
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/params-trailing-comma-multiple.js66
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/params-trailing-comma-single.js65
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/rest-param-strict-body.js137
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/rest-params-trailing-comma-early-error.js63
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/shell.js0
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-as-binding-identifier-escaped.js37
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-as-binding-identifier.js37
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-as-identifier-reference-escaped.js37
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-as-identifier-reference.js37
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-as-label-identifier-escaped.js37
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-as-label-identifier.js37
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-identifier-spread-strict-strict.js55
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-identifier-strict-strict.js46
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-promise-reject-next-catch.js51
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-promise-reject-next-for-await-of-async-iterator.js57
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-promise-reject-next-for-await-of-sync-iterator.js56
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-promise-reject-next-yield-star-async-iterator.js55
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-promise-reject-next-yield-star-sync-iterator.js54
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-promise-reject-next.js51
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-spread-arr-multiple.js57
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-spread-arr-single.js56
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-spread-obj.js59
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-async-next.js226
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-async-return.js242
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-async-throw.js250
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-expr-abrupt.js61
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-get-abrupt.js81
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-not-callable-boolean-throw.js80
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-not-callable-number-throw.js80
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-not-callable-object-throw.js80
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-not-callable-string-throw.js80
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-not-callable-symbol-throw.js80
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-null-sync-get-abrupt.js86
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-abrupt.js77
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-boolean-throw.js77
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-null-throw.js77
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-number-throw.js77
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-string-throw.js77
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-symbol-throw.js77
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-undefined-throw.js77
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-undefined-sync-get-abrupt.js86
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-get-abrupt.js80
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-not-callable-boolean-throw.js79
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-not-callable-number-throw.js79
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-not-callable-object-throw.js79
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-not-callable-string-throw.js79
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-not-callable-symbol-throw.js79
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-abrupt.js74
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-boolean-throw.js79
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-null-throw.js79
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-number-throw.js79
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-string-throw.js79
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-symbol-throw.js79
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-undefined-throw.js79
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-call-done-get-abrupt.js80
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-call-returns-abrupt.js72
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-call-value-get-abrupt.js82
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-get-abrupt.js72
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-non-object-ignores-then.js92
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-boolean-throw.js69
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-null-throw.js69
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-number-throw.js69
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-object-throw.js69
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-string-throw.js69
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-symbol-throw.js69
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-undefined-throw.js69
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-get-abrupt.js96
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-boolean-fulfillpromise.js90
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-null-fulfillpromise.js90
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-number-fulfillpromise.js90
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-object-fulfillpromise.js90
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-string-fulfillpromise.js90
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-symbol-fulfillpromise.js90
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-undefined-fulfillpromise.js90
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-returns-abrupt.js96
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-sync-next.js229
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-sync-return.js204
-rw-r--r--js/src/tests/test262/language/statements/class/async-gen-method/yield-star-sync-throw.js210
107 files changed, 7895 insertions, 0 deletions
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/array-destructuring-param-strict-body.js b/js/src/tests/test262/language/statements/class/async-gen-method/array-destructuring-param-strict-body.js
new file mode 100644
index 0000000000..afe29a17e6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/array-destructuring-param-strict-body.js
@@ -0,0 +1,137 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/array-destructuring-param-strict-body.case
+// - src/function-forms/syntax/cls-decl-async-gen-meth.template
+/*---
+description: ArrayBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [rest-parameters, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3.4 Static Semantics: IsSimpleParameterList
+
+ BindingElement : BindingPattern
+
+ 1. Return false.
+
+ 14.1.2 Static Semantics: Early Errors
+
+ FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+ FunctionDeclaration : function ( FormalParameters ) { FunctionBody }
+ FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.2.1 Static Semantics: Early Errors
+
+ ArrowFunction : ArrowParameters => ConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and
+ IsSimpleParameterList of ArrowParameters is false.
+
+ 14.3.1 Static Semantics: Early Errors
+
+ MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of PropertySetParameterList is false.
+
+ 14.4.1 Static Semantics: Early Errors
+
+ GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+ GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ 14.5.1 Static Semantics: Early Errors
+
+ AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.7.1 Static Semantics: Early Errors
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.8.1 Static Semantics: Early Errors
+
+ AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and
+ IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false.
+
+---*/
+$DONOTEVALUATE();
+
+class C {
+ async *method([element]) {
+ "use strict";
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/await-as-binding-identifier-escaped.js b/js/src/tests/test262/language/statements/class/async-gen-method/await-as-binding-identifier-escaped.js
new file mode 100644
index 0000000000..c769ed5e60
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/await-as-binding-identifier-escaped.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/await-as-binding-identifier-escaped.case
+// - src/async-generators/syntax/async-class-decl-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ BindingIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { async *gen() {
+ var \u0061wait;
+}}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/await-as-binding-identifier.js b/js/src/tests/test262/language/statements/class/async-gen-method/await-as-binding-identifier.js
new file mode 100644
index 0000000000..b8da3a80d8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/await-as-binding-identifier.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/await-as-binding-identifier.case
+// - src/async-generators/syntax/async-class-decl-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ BindingIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { async *gen() {
+ var await;
+}}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/await-as-identifier-reference-escaped.js b/js/src/tests/test262/language/statements/class/async-gen-method/await-as-identifier-reference-escaped.js
new file mode 100644
index 0000000000..8bbc5763e4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/await-as-identifier-reference-escaped.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/await-as-identifier-reference-escaped.case
+// - src/async-generators/syntax/async-class-decl-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ IdentifierReference : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { async *gen() {
+ void \u0061wait;
+}}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/await-as-identifier-reference.js b/js/src/tests/test262/language/statements/class/async-gen-method/await-as-identifier-reference.js
new file mode 100644
index 0000000000..c941d9c970
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/await-as-identifier-reference.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/await-as-identifier-reference.case
+// - src/async-generators/syntax/async-class-decl-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ IdentifierReference : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { async *gen() {
+ void await;
+}}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/await-as-label-identifier-escaped.js b/js/src/tests/test262/language/statements/class/async-gen-method/await-as-label-identifier-escaped.js
new file mode 100644
index 0000000000..a80f495432
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/await-as-label-identifier-escaped.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/await-as-label-identifier-escaped.case
+// - src/async-generators/syntax/async-class-decl-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ LabelIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { async *gen() {
+ \u0061wait: ;
+}}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/await-as-label-identifier.js b/js/src/tests/test262/language/statements/class/async-gen-method/await-as-label-identifier.js
new file mode 100644
index 0000000000..f7dd596937
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/await-as-label-identifier.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/await-as-label-identifier.case
+// - src/async-generators/syntax/async-class-decl-method.template
+/*---
+description: await is a reserved keyword within generator function bodies and may not be used as a label identifier. (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ LabelIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Await] parameter and
+ StringValue of Identifier is "await".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { async *gen() {
+ await: ;
+}}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/browser.js b/js/src/tests/test262/language/statements/class/async-gen-method/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/browser.js
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-abrupt.js b/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-abrupt.js
new file mode 100644
index 0000000000..d1bcfa11ed
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-abrupt.js
@@ -0,0 +1,67 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-abrupt.case
+// - src/function-forms/error/cls-decl-async-gen-meth.template
+/*---
+description: Abrupt completion returned by evaluation of initializer (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [default-parameters, async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+
+var callCount = 0;
+class C {
+ async *method(_ = (function() { throw new Test262Error(); }())) {
+
+ callCount = callCount + 1;
+ }
+}
+
+assert.throws(Test262Error, function() {
+ C.prototype.method();
+});
+assert.sameValue(callCount, 0, 'method body not evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-arg-val-not-undefined.js b/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-arg-val-not-undefined.js
new file mode 100644
index 0000000000..ee15d9a365
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-arg-val-not-undefined.js
@@ -0,0 +1,91 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-arg-val-not-undefined.case
+// - src/function-forms/default/cls-decl-async-gen-meth.template
+/*---
+description: Use of initializer when argument value is not `undefined` (class declaration async generator method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [default-parameters, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ [...]
+ 23. Let iteratorRecord be Record {[[Iterator]]:
+ CreateListIterator(argumentsList), [[Done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ a. Perform ? IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+---*/
+var obj = {};
+var falseCount = 0;
+var stringCount = 0;
+var nanCount = 0;
+var zeroCount = 0;
+var nullCount = 0;
+var objCount = 0;
+
+var callCount = 0;
+class C {
+ async *method(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) {
+ assert.sameValue(aFalse, false);
+ assert.sameValue(aString, '');
+ assert.sameValue(aNaN, NaN);
+ assert.sameValue(a0, 0);
+ assert.sameValue(aNull, null);
+ assert.sameValue(aObj, obj);
+ callCount = callCount + 1;
+ }
+}
+
+// Stores a reference `ref` for case evaluation
+var ref = C.prototype.method;
+
+ref(false, '', NaN, 0, null, obj).next().then(() => {
+ assert.sameValue(callCount, 1, 'method invoked exactly once');
+}).then($DONE, $DONE);
+
+assert.sameValue(falseCount, 0, 'initializer not evaluated: false');
+assert.sameValue(stringCount, 0, 'initializer not evaluated: string');
+assert.sameValue(nanCount, 0, 'initializer not evaluated: NaN');
+assert.sameValue(zeroCount, 0, 'initializer not evaluated: 0');
+assert.sameValue(nullCount, 0, 'initializer not evaluated: null');
+assert.sameValue(objCount, 0, 'initializer not evaluated: object');
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-arg-val-undefined.js b/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-arg-val-undefined.js
new file mode 100644
index 0000000000..711588c5a7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-arg-val-undefined.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-arg-val-undefined.case
+// - src/function-forms/default/cls-decl-async-gen-meth.template
+/*---
+description: Use of initializer when argument value is `undefined` (class declaration async generator method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [default-parameters, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ [...]
+ 23. Let iteratorRecord be Record {[[Iterator]]:
+ CreateListIterator(argumentsList), [[Done]]: false}.
+ 24. If hasDuplicates is true, then
+ [...]
+ 25. Else,
+ a. Perform ? IteratorBindingInitialization for formals with
+ iteratorRecord and env as arguments.
+ [...]
+
+---*/
+
+var callCount = 0;
+class C {
+ async *method(fromLiteral = 23, fromExpr = 45, fromHole = 99) {
+ assert.sameValue(fromLiteral, 23);
+ assert.sameValue(fromExpr, 45);
+ assert.sameValue(fromHole, 99);
+ callCount = callCount + 1;
+ }
+}
+
+// Stores a reference `ref` for case evaluation
+var ref = C.prototype.method;
+
+ref(undefined, void 0).next().then(() => {
+ assert.sameValue(callCount, 1, 'method invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-duplicates.js b/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-duplicates.js
new file mode 100644
index 0000000000..0f0499f102
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-duplicates.js
@@ -0,0 +1,66 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-duplicates.case
+// - src/function-forms/syntax/cls-decl-async-gen-meth.template
+/*---
+description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [default-parameters, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 14.1.2 Static Semantics: Early Errors
+
+ StrictFormalParameters : FormalParameters
+
+ - It is a Syntax Error if BoundNames of FormalParameters contains any
+ duplicate elements.
+
+ FormalParameters : FormalParameterList
+
+ - It is a Syntax Error if IsSimpleParameterList of FormalParameterList is
+ false and BoundNames of FormalParameterList contains any duplicate
+ elements.
+
+---*/
+$DONOTEVALUATE();
+
+class C {
+ async *method(x = 0, x) {
+
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-ref-later.js b/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-ref-later.js
new file mode 100644
index 0000000000..934b90117e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-ref-later.js
@@ -0,0 +1,68 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-ref-later.case
+// - src/function-forms/error/cls-decl-async-gen-meth.template
+/*---
+description: Referencing a parameter that occurs later in the ParameterList (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [default-parameters, async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+var x = 0;
+
+var callCount = 0;
+class C {
+ async *method(x = y, y) {
+
+ callCount = callCount + 1;
+ }
+}
+
+assert.throws(ReferenceError, function() {
+ C.prototype.method();
+});
+assert.sameValue(callCount, 0, 'method body not evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-ref-prior.js b/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-ref-prior.js
new file mode 100644
index 0000000000..f8d6fdb234
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-ref-prior.js
@@ -0,0 +1,71 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-ref-prior.case
+// - src/function-forms/default/cls-decl-async-gen-meth.template
+/*---
+description: Referencing a parameter that occurs earlier in the ParameterList (class declaration async generator method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [default-parameters, async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+var x = 0;
+
+var callCount = 0;
+class C {
+ async *method(x, y = x, z = y) {
+ assert.sameValue(x, 3, 'first argument value');
+ assert.sameValue(y, 3, 'second argument value');
+ assert.sameValue(z, 3, 'third argument value');
+ callCount = callCount + 1;
+ }
+}
+
+// Stores a reference `ref` for case evaluation
+var ref = C.prototype.method;
+
+ref(3).next().then(() => {
+ assert.sameValue(callCount, 1, 'method invoked exactly once');
+}).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-ref-self.js b/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-ref-self.js
new file mode 100644
index 0000000000..233d3c84b0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-ref-self.js
@@ -0,0 +1,68 @@
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-ref-self.case
+// - src/function-forms/error/cls-decl-async-gen-meth.template
+/*---
+description: Referencing a parameter from within its own initializer (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [default-parameters, async-iteration]
+flags: [generated]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 14.1.19 Runtime Semantics: IteratorBindingInitialization
+
+ FormalsList : FormalsList , FormalParameter
+
+ 1. Let status be the result of performing IteratorBindingInitialization for
+ FormalsList using iteratorRecord and environment as the arguments.
+ 2. ReturnIfAbrupt(status).
+ 3. Return the result of performing IteratorBindingInitialization for
+ FormalParameter using iteratorRecord and environment as the arguments.
+
+---*/
+var x = 0;
+
+var callCount = 0;
+class C {
+ async *method(x = x) {
+
+ callCount = callCount + 1;
+ }
+}
+
+assert.throws(ReferenceError, function() {
+ C.prototype.method();
+});
+assert.sameValue(callCount, 0, 'method body not evaluated');
+
+reportCompare(0, 0);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-rest.js b/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-rest.js
new file mode 100644
index 0000000000..11481afb99
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-rest.js
@@ -0,0 +1,70 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-rest.case
+// - src/function-forms/syntax/cls-decl-async-gen-meth.template
+/*---
+description: RestParameter does not support an initializer (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [default-parameters, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 14.1 Function Definitions
+
+ Syntax
+
+ FunctionRestParameter[Yield] :
+
+ BindingRestElement[?Yield]
+
+ 13.3.3 Destructuring Binding Patterns
+
+ Syntax
+
+ BindingRestElement[Yield] :
+
+ ...BindingIdentifier[?Yield]
+ ...BindingPattern[?Yield]
+
+---*/
+$DONOTEVALUATE();
+
+class C {
+ async *method(...x = []) {
+
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-trailing-comma.js b/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-trailing-comma.js
new file mode 100644
index 0000000000..a156db4c70
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/dflt-params-trailing-comma.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/dflt-params-trailing-comma.case
+// - src/function-forms/default/cls-decl-async-gen-meth.template
+/*---
+description: A trailing comma should not increase the respective length, using default parameters (class declaration async generator method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] ,
+---*/
+
+var callCount = 0;
+class C {
+ async *method(a, b = 39,) {
+ assert.sameValue(a, 42);
+ assert.sameValue(b, 39);
+ callCount = callCount + 1;
+ }
+}
+
+// Stores a reference `ref` for case evaluation
+var ref = C.prototype.method;
+
+ref(42, undefined, 1).next().then(() => {
+ assert.sameValue(callCount, 1, 'method invoked exactly once');
+}).then($DONE, $DONE);
+
+assert.sameValue(ref.length, 1, 'length is properly set');
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b1/browser.js b/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b1/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b1/browser.js
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b1/cls-decl-async-gen-meth-forbidden-ext-direct-access-prop-arguments.js b/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b1/cls-decl-async-gen-meth-forbidden-ext-direct-access-prop-arguments.js
new file mode 100644
index 0000000000..25bfc4645e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b1/cls-decl-async-gen-meth-forbidden-ext-direct-access-prop-arguments.js
@@ -0,0 +1,38 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-direct-access-prop-arguments.case
+// - src/function-forms/forbidden-extensions/bullet-one/cls-decl-async-gen-meth.template
+/*---
+description: Forbidden extension, f.arguments (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [arrow-function, async-functions, async-iteration, class, generators]
+flags: [generated, noStrict, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+
+ ECMAScript function objects defined using syntactic constructors in strict mode code must
+ not be created with own properties named "caller" or "arguments". Such own properties also
+ must not be created for function objects defined using an ArrowFunction, MethodDefinition,
+ GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression,
+ ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or
+ AsyncArrowFunction regardless of whether the definition is contained in strict mode code.
+ Built-in functions, strict functions created using the Function constructor, generator functions
+ created using the Generator constructor, async functions created using the AsyncFunction
+ constructor, and functions created using the bind method also must not be created with such own
+ properties.
+
+---*/
+
+var callCount = 0;
+class C {
+ async *method() {
+ assert.sameValue(this.method.hasOwnProperty("arguments"), false);
+ callCount++;
+ }
+}
+
+C.prototype.method().next()
+ .then(() => {
+ assert.sameValue(callCount, 1, 'function body evaluated');
+ }, $DONE).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b1/cls-decl-async-gen-meth-forbidden-ext-direct-access-prop-caller.js b/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b1/cls-decl-async-gen-meth-forbidden-ext-direct-access-prop-caller.js
new file mode 100644
index 0000000000..87675f55e5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b1/cls-decl-async-gen-meth-forbidden-ext-direct-access-prop-caller.js
@@ -0,0 +1,38 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-direct-access-prop-caller.case
+// - src/function-forms/forbidden-extensions/bullet-one/cls-decl-async-gen-meth.template
+/*---
+description: Forbidden extension, o.caller (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [arrow-function, async-functions, async-iteration, class, generators]
+flags: [generated, noStrict, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+
+ ECMAScript function objects defined using syntactic constructors in strict mode code must
+ not be created with own properties named "caller" or "arguments". Such own properties also
+ must not be created for function objects defined using an ArrowFunction, MethodDefinition,
+ GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression,
+ ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or
+ AsyncArrowFunction regardless of whether the definition is contained in strict mode code.
+ Built-in functions, strict functions created using the Function constructor, generator functions
+ created using the Generator constructor, async functions created using the AsyncFunction
+ constructor, and functions created using the bind method also must not be created with such own
+ properties.
+
+---*/
+
+var callCount = 0;
+class C {
+ async *method() {
+ assert.sameValue(this.method.hasOwnProperty("caller"), false);
+ callCount++;
+ }
+}
+
+C.prototype.method().next()
+ .then(() => {
+ assert.sameValue(callCount, 1, 'function body evaluated');
+ }, $DONE).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b1/shell.js b/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b1/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b1/shell.js
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b2/browser.js b/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b2/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b2/browser.js
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b2/cls-decl-async-gen-meth-forbidden-ext-indirect-access-own-prop-caller-get.js b/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b2/cls-decl-async-gen-meth-forbidden-ext-indirect-access-own-prop-caller-get.js
new file mode 100644
index 0000000000..1ee1d902c6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b2/cls-decl-async-gen-meth-forbidden-ext-indirect-access-own-prop-caller-get.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-get.case
+// - src/function-forms/forbidden-extensions/bullet-two/cls-decl-async-gen-meth.template
+/*---
+description: Forbidden extension, o.caller (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [arrow-function, async-functions, async-iteration, class]
+flags: [generated, noStrict, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+
+ If an implementation extends any function object with an own property named "caller" the value of
+ that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function
+ object. If it is an accessor property, the function that is the value of the property's [[Get]]
+ attribute must never return a strict function when called.
+
+---*/
+var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol();
+function inner() {
+ // This property may exist, but is forbidden from having a value that is a strict function object
+ return inner.hasOwnProperty("caller")
+ ? inner.caller
+ : CALLER_OWN_PROPERTY_DOES_NOT_EXIST;
+}
+
+var callCount = 0;
+class C {
+ async *method() {
+ /* implicit strict */
+ // This and the following conditional value is set in the test's .case file.
+ // For every test that has a "true" value here, there is a
+ // corresponding test that has a "false" value here.
+ // They are generated from two different case files, which use
+ let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
+ if (descriptor && descriptor.configurable && true) {
+ Object.defineProperty(inner, "caller", {get(){return 1}});
+ }
+ var result = inner();
+ if (descriptor && descriptor.configurable && true) {
+ assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
+ }
+
+ // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
+ // forbidden-ext-indirect-access-prop-caller.case
+ //
+ // If the function object "inner" has an own property
+ // named "caller", then its value will be returned.
+ //
+ // If the function object "inner" DOES NOT have an
+ // own property named "caller", then the symbol
+ // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
+ if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
+ assert.notSameValue(result, this.method);
+ }
+ callCount++;
+ }
+}
+
+C.prototype.method().next()
+ .then(() => {
+ assert.sameValue(callCount, 1, 'function body evaluated');
+ }, $DONE).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b2/cls-decl-async-gen-meth-forbidden-ext-indirect-access-own-prop-caller-value.js b/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b2/cls-decl-async-gen-meth-forbidden-ext-indirect-access-own-prop-caller-value.js
new file mode 100644
index 0000000000..1cc848438f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b2/cls-decl-async-gen-meth-forbidden-ext-indirect-access-own-prop-caller-value.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-indirect-access-own-prop-caller-value.case
+// - src/function-forms/forbidden-extensions/bullet-two/cls-decl-async-gen-meth.template
+/*---
+description: Forbidden extension, o.caller (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [arrow-function, async-functions, async-iteration, class]
+flags: [generated, noStrict, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+
+ If an implementation extends any function object with an own property named "caller" the value of
+ that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function
+ object. If it is an accessor property, the function that is the value of the property's [[Get]]
+ attribute must never return a strict function when called.
+
+---*/
+var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol();
+function inner() {
+ // This property may exist, but is forbidden from having a value that is a strict function object
+ return inner.hasOwnProperty("caller")
+ ? inner.caller
+ : CALLER_OWN_PROPERTY_DOES_NOT_EXIST;
+}
+
+var callCount = 0;
+class C {
+ async *method() {
+ /* implicit strict */
+ // This and the following conditional value is set in the test's .case file.
+ // For every test that has a "true" value here, there is a
+ // corresponding test that has a "false" value here.
+ // They are generated from two different case files, which use
+ let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
+ if (descriptor && descriptor.configurable && true) {
+ Object.defineProperty(inner, "caller", {value: 1});
+ }
+ var result = inner();
+ if (descriptor && descriptor.configurable && true) {
+ assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
+ }
+
+ // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
+ // forbidden-ext-indirect-access-prop-caller.case
+ //
+ // If the function object "inner" has an own property
+ // named "caller", then its value will be returned.
+ //
+ // If the function object "inner" DOES NOT have an
+ // own property named "caller", then the symbol
+ // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
+ if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
+ assert.notSameValue(result, this.method);
+ }
+ callCount++;
+ }
+}
+
+C.prototype.method().next()
+ .then(() => {
+ assert.sameValue(callCount, 1, 'function body evaluated');
+ }, $DONE).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b2/cls-decl-async-gen-meth-forbidden-ext-indirect-access-prop-caller.js b/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b2/cls-decl-async-gen-meth-forbidden-ext-indirect-access-prop-caller.js
new file mode 100644
index 0000000000..f1c8cb25fb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b2/cls-decl-async-gen-meth-forbidden-ext-indirect-access-prop-caller.js
@@ -0,0 +1,64 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/forbidden-ext-indirect-access-prop-caller.case
+// - src/function-forms/forbidden-extensions/bullet-two/cls-decl-async-gen-meth.template
+/*---
+description: Forbidden extension, o.caller (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [arrow-function, async-functions, async-iteration, class]
+flags: [generated, noStrict, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+
+ If an implementation extends any function object with an own property named "caller" the value of
+ that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function
+ object. If it is an accessor property, the function that is the value of the property's [[Get]]
+ attribute must never return a strict function when called.
+
+---*/
+var CALLER_OWN_PROPERTY_DOES_NOT_EXIST = Symbol();
+function inner() {
+ // This property may exist, but is forbidden from having a value that is a strict function object
+ return inner.hasOwnProperty("caller")
+ ? inner.caller
+ : CALLER_OWN_PROPERTY_DOES_NOT_EXIST;
+}
+
+var callCount = 0;
+class C {
+ async *method() {
+ /* implicit strict */
+ // This and the following conditional value is set in the test's .case file.
+ // For every test that has a "true" value here, there is a
+ // corresponding test that has a "false" value here.
+ // They are generated from two different case files, which use
+ let descriptor = Object.getOwnPropertyDescriptor(inner, "caller");
+ if (descriptor && descriptor.configurable && false) {
+ Object.defineProperty(inner, "caller", {});
+ }
+ var result = inner();
+ if (descriptor && descriptor.configurable && false) {
+ assert.sameValue(result, 1, 'If this test defined an own "caller" property on the inner function, then it should be accessible and should return the value it was set to.');
+ }
+
+ // "CALLER_OWN_PROPERTY_DOES_NOT_EXIST" is from
+ // forbidden-ext-indirect-access-prop-caller.case
+ //
+ // If the function object "inner" has an own property
+ // named "caller", then its value will be returned.
+ //
+ // If the function object "inner" DOES NOT have an
+ // own property named "caller", then the symbol
+ // CALLER_OWN_PROPERTY_DOES_NOT_EXIST will be returned.
+ if (result !== CALLER_OWN_PROPERTY_DOES_NOT_EXIST) {
+ assert.notSameValue(result, this.method);
+ }
+ callCount++;
+ }
+}
+
+C.prototype.method().next()
+ .then(() => {
+ assert.sameValue(callCount, 1, 'function body evaluated');
+ }, $DONE).then($DONE, $DONE);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b2/shell.js b/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b2/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/b2/shell.js
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/browser.js b/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/browser.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/browser.js
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/shell.js b/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/forbidden-ext/shell.js
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/object-destructuring-param-strict-body.js b/js/src/tests/test262/language/statements/class/async-gen-method/object-destructuring-param-strict-body.js
new file mode 100644
index 0000000000..12171b4e5e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/object-destructuring-param-strict-body.js
@@ -0,0 +1,137 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/object-destructuring-param-strict-body.case
+// - src/function-forms/syntax/cls-decl-async-gen-meth.template
+/*---
+description: ObjectBindingPattern and Use Strict Directive are not allowed to coexist for the same function. (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [rest-parameters, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 13.3.3.4 Static Semantics: IsSimpleParameterList
+
+ BindingElement : BindingPattern
+
+ 1. Return false.
+
+ 14.1.2 Static Semantics: Early Errors
+
+ FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+ FunctionDeclaration : function ( FormalParameters ) { FunctionBody }
+ FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.2.1 Static Semantics: Early Errors
+
+ ArrowFunction : ArrowParameters => ConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and
+ IsSimpleParameterList of ArrowParameters is false.
+
+ 14.3.1 Static Semantics: Early Errors
+
+ MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of PropertySetParameterList is false.
+
+ 14.4.1 Static Semantics: Early Errors
+
+ GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+ GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ 14.5.1 Static Semantics: Early Errors
+
+ AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.7.1 Static Semantics: Early Errors
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.8.1 Static Semantics: Early Errors
+
+ AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and
+ IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false.
+
+---*/
+$DONOTEVALUATE();
+
+class C {
+ async *method({property}) {
+ "use strict";
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/params-trailing-comma-multiple.js b/js/src/tests/test262/language/statements/class/async-gen-method/params-trailing-comma-multiple.js
new file mode 100644
index 0000000000..e86210f4f1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/params-trailing-comma-multiple.js
@@ -0,0 +1,66 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/params-trailing-comma-multiple.case
+// - src/function-forms/default/cls-decl-async-gen-meth.template
+/*---
+description: A trailing comma should not increase the respective length, using multiple parameters (class declaration async generator method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] ,
+---*/
+
+var callCount = 0;
+class C {
+ async *method(a, b,) {
+ assert.sameValue(a, 42);
+ assert.sameValue(b, 39);
+ callCount = callCount + 1;
+ }
+}
+
+// Stores a reference `ref` for case evaluation
+var ref = C.prototype.method;
+
+ref(42, 39, 1).next().then(() => {
+ assert.sameValue(callCount, 1, 'method invoked exactly once');
+}).then($DONE, $DONE);
+
+assert.sameValue(ref.length, 2, 'length is properly set');
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/params-trailing-comma-single.js b/js/src/tests/test262/language/statements/class/async-gen-method/params-trailing-comma-single.js
new file mode 100644
index 0000000000..a84e93b285
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/params-trailing-comma-single.js
@@ -0,0 +1,65 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/function-forms/params-trailing-comma-single.case
+// - src/function-forms/default/cls-decl-async-gen-meth.template
+/*---
+description: A trailing comma should not increase the respective length, using a single parameter (class declaration async generator method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] ,
+---*/
+
+var callCount = 0;
+class C {
+ async *method(a,) {
+ assert.sameValue(a, 42);
+ callCount = callCount + 1;
+ }
+}
+
+// Stores a reference `ref` for case evaluation
+var ref = C.prototype.method;
+
+ref(42, 39).next().then(() => {
+ assert.sameValue(callCount, 1, 'method invoked exactly once');
+}).then($DONE, $DONE);
+
+assert.sameValue(ref.length, 1, 'length is properly set');
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/rest-param-strict-body.js b/js/src/tests/test262/language/statements/class/async-gen-method/rest-param-strict-body.js
new file mode 100644
index 0000000000..93b4172858
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/rest-param-strict-body.js
@@ -0,0 +1,137 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/rest-param-strict-body.case
+// - src/function-forms/syntax/cls-decl-async-gen-meth.template
+/*---
+description: RestParameter and Use Strict Directive are not allowed to coexist for the same function. (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [rest-parameters, async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ 14.1.13 Static Semantics: IsSimpleParameterList
+
+ FormalParameters : FormalParameterList , FunctionRestParameter
+
+ 1. Return false.
+
+ 14.1.2 Static Semantics: Early Errors
+
+ FunctionDeclaration : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+ FunctionDeclaration : function ( FormalParameters ) { FunctionBody }
+ FunctionExpression : function BindingIdentifier ( FormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.2.1 Static Semantics: Early Errors
+
+ ArrowFunction : ArrowParameters => ConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of ConciseBody is true and
+ IsSimpleParameterList of ArrowParameters is false.
+
+ 14.3.1 Static Semantics: Early Errors
+
+ MethodDefinition : PropertyName ( UniqueFormalParameters ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ MethodDefinition : set PropertyName ( PropertySetParameterList ) { FunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
+ IsSimpleParameterList of PropertySetParameterList is false.
+
+ 14.4.1 Static Semantics: Early Errors
+
+ GeneratorMethod : * PropertyName ( UniqueFormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ GeneratorDeclaration : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+ GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody }
+ GeneratorExpression : function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of GeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ 14.5.1 Static Semantics: Early Errors
+
+ AsyncGeneratorMethod : async * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncGeneratorDeclaration : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorDeclaration : async function * ( FormalParameters ) { AsyncGeneratorBody }
+ AsyncGeneratorExpression : async function * BindingIdentifier ( FormalParameters ) { AsyncGeneratorBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncGeneratorBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.7.1 Static Semantics: Early Errors
+
+ AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of UniqueFormalParameters is false.
+
+ AsyncFunctionDeclaration : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionDeclaration : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function ( FormalParameters ) { AsyncFunctionBody }
+ AsyncFunctionExpression : async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody }
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncFunctionBody is true and
+ IsSimpleParameterList of FormalParameters is false.
+
+ 14.8.1 Static Semantics: Early Errors
+
+ AsyncArrowFunction : CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody
+
+ - It is a Syntax Error if ContainsUseStrict of AsyncConciseBody is true and
+ IsSimpleParameterList of CoverCallExpressionAndAsyncArrowHead is false.
+
+---*/
+$DONOTEVALUATE();
+
+class C {
+ async *method(a,...rest) {
+ "use strict";
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/rest-params-trailing-comma-early-error.js b/js/src/tests/test262/language/statements/class/async-gen-method/rest-params-trailing-comma-early-error.js
new file mode 100644
index 0000000000..ac3e44e824
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/rest-params-trailing-comma-early-error.js
@@ -0,0 +1,63 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/function-forms/rest-params-trailing-comma-early-error.case
+// - src/function-forms/syntax/cls-decl-async-gen-meth.template
+/*---
+description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (class expression method)
+esid: sec-class-definitions-runtime-semantics-evaluation
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassDeclaration : class BindingIdentifier ClassTail
+
+ 1. Let className be StringValue of BindingIdentifier.
+ 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
+ argument className.
+ [...]
+
+ 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
+
+ 21. For each ClassElement m in order from methods
+ a. If IsStatic of m is false, then
+ i. Let status be the result of performing
+ PropertyDefinitionEvaluation for m with arguments proto and
+ false.
+ [...]
+
+ Runtime Semantics: PropertyDefinitionEvaluation
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
+ { AsyncGeneratorBody }
+
+ 1. Let propKey be the result of evaluating PropertyName.
+ 2. ReturnIfAbrupt(propKey).
+ 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
+ Otherwise let strict be false.
+ 4. Let scope be the running execution context's LexicalEnvironment.
+ 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
+ AsyncGeneratorBody, scope, strict).
+ [...]
+
+
+ Trailing comma in the parameters list
+
+ 14.1 Function Definitions
+
+ FormalParameters[Yield, Await] :
+ [empty]
+ FunctionRestParameter[?Yield, ?Await]
+ FormalParameterList[?Yield, ?Await]
+ FormalParameterList[?Yield, ?Await] ,
+ FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await]
+---*/
+$DONOTEVALUATE();
+
+class C {
+ async *method(...a,) {
+
+ }
+}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/shell.js b/js/src/tests/test262/language/statements/class/async-gen-method/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/shell.js
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-as-binding-identifier-escaped.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-as-binding-identifier-escaped.js
new file mode 100644
index 0000000000..c516f6d840
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-as-binding-identifier-escaped.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-as-binding-identifier-escaped.case
+// - src/async-generators/syntax/async-class-decl-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ BindingIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { async *gen() {
+ var yi\u0065ld;
+}}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-as-binding-identifier.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-as-binding-identifier.js
new file mode 100644
index 0000000000..e0ee916ba1
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-as-binding-identifier.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-as-binding-identifier.case
+// - src/async-generators/syntax/async-class-decl-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as a binding identifier. (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ BindingIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { async *gen() {
+ var yield;
+}}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-as-identifier-reference-escaped.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-as-identifier-reference-escaped.js
new file mode 100644
index 0000000000..1280b4655f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-as-identifier-reference-escaped.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-as-identifier-reference-escaped.case
+// - src/async-generators/syntax/async-class-decl-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ IdentifierReference : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { async *gen() {
+ void yi\u0065ld;
+}}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-as-identifier-reference.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-as-identifier-reference.js
new file mode 100644
index 0000000000..6fe5770f86
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-as-identifier-reference.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-as-identifier-reference.case
+// - src/async-generators/syntax/async-class-decl-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as an identifier reference. (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ IdentifierReference : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { async *gen() {
+ void yield;
+}}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-as-label-identifier-escaped.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-as-label-identifier-escaped.js
new file mode 100644
index 0000000000..5bdce639e2
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-as-label-identifier-escaped.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-as-label-identifier-escaped.case
+// - src/async-generators/syntax/async-class-decl-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as a label identifier. (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ LabelIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { async *gen() {
+ yi\u0065ld: ;
+}}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-as-label-identifier.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-as-label-identifier.js
new file mode 100644
index 0000000000..ce338ce1b8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-as-label-identifier.js
@@ -0,0 +1,37 @@
+// |reftest| error:SyntaxError
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-as-label-identifier.case
+// - src/async-generators/syntax/async-class-decl-method.template
+/*---
+description: yield is a reserved keyword within generator function bodies and may not be used as a label identifier. (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ LabelIdentifier : Identifier
+
+ It is a Syntax Error if this production has a [Yield] parameter and
+ StringValue of Identifier is "yield".
+
+---*/
+$DONOTEVALUATE();
+
+
+class C { async *gen() {
+ yield: ;
+}}
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-identifier-spread-strict-strict.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-identifier-spread-strict-strict.js
new file mode 100644
index 0000000000..635f0c848c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-identifier-spread-strict-strict.js
@@ -0,0 +1,55 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-identifier-spread-strict.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: It's an early error if the AssignmentExpression is a function body with yield as an identifier in strict mode. (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [object-spread, async-iteration]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ Spread Properties
+
+ PropertyDefinition[Yield]:
+ (...)
+ ...AssignmentExpression[In, ?Yield]
+
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ return {
+ ...(function() {
+ var yield;
+ throw new Test262Error();
+ }()),
+ }
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-identifier-strict-strict.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-identifier-strict-strict.js
new file mode 100644
index 0000000000..8fd9382ede
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-identifier-strict-strict.js
@@ -0,0 +1,46 @@
+// |reftest| error:SyntaxError
+'use strict';
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-identifier-strict.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: It's an early error if the generator body has another function body with yield as an identifier in strict mode. (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated, onlyStrict]
+negative:
+ phase: parse
+ type: SyntaxError
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+---*/
+$DONOTEVALUATE();
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ (function() {
+ var yield;
+ throw new Test262Error();
+ }())
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-promise-reject-next-catch.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-promise-reject-next-catch.js
new file mode 100644
index 0000000000..64f693bd72
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-promise-reject-next-catch.js
@@ -0,0 +1,51 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-promise-reject-next-catch.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: yield Promise.reject(value) is treated as throw value (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+---*/
+let error = new Error();
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield Promise.reject(error);
+ yield "unreachable";
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error("Promise incorrectly resolved.");
+}).catch(rejectValue => {
+ // yield Promise.reject(error);
+ assert.sameValue(rejectValue, error);
+
+ iter.next().then(({done, value}) => {
+ // iter is closed now.
+ assert.sameValue(done, true, "The value of IteratorResult.done is `true`");
+ assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`");
+ }).then($DONE, $DONE);
+});
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-promise-reject-next-for-await-of-async-iterator.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-promise-reject-next-for-await-of-async-iterator.js
new file mode 100644
index 0000000000..83ecb6da04
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-promise-reject-next-for-await-of-async-iterator.js
@@ -0,0 +1,57 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-promise-reject-next-for-await-of-async-iterator.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: yield * [Promise.reject(value)] is treated as throw value (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+---*/
+let error = new Error();
+async function * readFile() {
+ yield Promise.reject(error);
+ yield "unreachable";
+}
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ for await (let line of readFile()) {
+ yield line;
+ }
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error("Promise incorrectly resolved.");
+}, rejectValue => {
+
+ // yield Promise.reject(error);
+ assert.sameValue(rejectValue, error);
+
+ iter.next().then(({done, value}) => {
+ // iter is closed now.
+ assert.sameValue(done, true, "The value of IteratorResult.done is `true`");
+ assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`");
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-promise-reject-next-for-await-of-sync-iterator.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-promise-reject-next-for-await-of-sync-iterator.js
new file mode 100644
index 0000000000..45989ca753
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-promise-reject-next-for-await-of-sync-iterator.js
@@ -0,0 +1,56 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-promise-reject-next-for-await-of-sync-iterator.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: yield Promise.reject(value) in for-await-of is treated as throw value (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+---*/
+let error = new Error();
+let iterable = [
+ Promise.reject(error),
+ "unreachable"
+];
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ for await (let value of iterable) {
+ yield value;
+ }
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error("Promise incorrectly resolved.");
+}, rejectValue => {
+ // yield Promise.reject(error);
+ assert.sameValue(rejectValue, error);
+
+ iter.next().then(({done, value}) => {
+ // iter is closed now.
+ assert.sameValue(done, true, "The value of IteratorResult.done is `true`");
+ assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`");
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-promise-reject-next-yield-star-async-iterator.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-promise-reject-next-yield-star-async-iterator.js
new file mode 100644
index 0000000000..e7d1b5dbe7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-promise-reject-next-yield-star-async-iterator.js
@@ -0,0 +1,55 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-promise-reject-next-yield-star-async-iterator.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: yield * (async iterator) is treated as throw value (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+---*/
+let error = new Error();
+async function * readFile() {
+ yield Promise.reject(error);
+ yield "unreachable";
+}
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield * readFile();
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error("Promise incorrectly resolved.");
+}, rejectValue => {
+ // yield Promise.reject(error);
+ assert.sameValue(rejectValue, error);
+
+ iter.next().then(({done, value}) => {
+ // iter is closed now.
+ assert.sameValue(done, true, "The value of IteratorResult.done is `true`");
+ assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`");
+ }).then($DONE, $DONE);
+}, $DONE).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-promise-reject-next-yield-star-sync-iterator.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-promise-reject-next-yield-star-sync-iterator.js
new file mode 100644
index 0000000000..f6614c70fe
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-promise-reject-next-yield-star-sync-iterator.js
@@ -0,0 +1,54 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-promise-reject-next-yield-star-sync-iterator.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: yield * (async iterator) is treated as throw value (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+---*/
+let error = new Error();
+let iterable = [
+ Promise.reject(error),
+ "unreachable"
+];
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield * iterable;
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error("Promise incorrectly resolved.");
+}, rejectValue => {
+ // yield Promise.reject(error);
+ assert.sameValue(rejectValue, error);
+
+ iter.next().then(({done, value}) => {
+ // iter is closed now.
+ assert.sameValue(done, true, "The value of IteratorResult.done is `true`");
+ assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`");
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-promise-reject-next.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-promise-reject-next.js
new file mode 100644
index 0000000000..6d10c0e0d0
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-promise-reject-next.js
@@ -0,0 +1,51 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-promise-reject-next.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: yield Promise.reject(value) is treated as throw value (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+---*/
+let error = new Error();
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield Promise.reject(error);
+ yield "unreachable";
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error("Promise incorrectly resolved.");
+}, rejectValue => {
+ // yield Promise.reject(error);
+ assert.sameValue(rejectValue, error);
+
+ iter.next().then(({done, value}) => {
+ // iter is closed now.
+ assert.sameValue(done, true, "The value of IteratorResult.done is `true`");
+ assert.sameValue(value, undefined, "The value of IteratorResult.value is `undefined`");
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-spread-arr-multiple.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-spread-arr-multiple.js
new file mode 100644
index 0000000000..1396fedca9
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-spread-arr-multiple.js
@@ -0,0 +1,57 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-spread-arr-multiple.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Use yield value in a array spread position (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated, async]
+includes: [compareArray.js]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ Array Initializer
+
+ SpreadElement[Yield, Await]:
+ ...AssignmentExpression[+In, ?Yield, ?Await]
+
+---*/
+var arr = ['a', 'b', 'c'];
+var item;
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield [...yield yield];
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next(false);
+item = iter.next(['a', 'b', 'c']);
+
+item.then(({ done, value }) => {
+ item = iter.next(value);
+
+ item.then(({ done, value }) => {
+ assert.compareArray(value, arr);
+ assert.sameValue(done, false);
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-spread-arr-single.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-spread-arr-single.js
new file mode 100644
index 0000000000..55b7f0855a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-spread-arr-single.js
@@ -0,0 +1,56 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-spread-arr-single.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Use yield value in a array spread position (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ Array Initializer
+
+ SpreadElement[Yield, Await]:
+ ...AssignmentExpression[+In, ?Yield, ?Await]
+
+---*/
+var arr = ['a', 'b', 'c'];
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield [...yield];
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next(false);
+var item = iter.next(arr);
+
+item.then(({ done, value }) => {
+ assert.notSameValue(value, arr, 'value is a new array');
+ assert(Array.isArray(value), 'value is an Array exotic object');
+ assert.sameValue(value.length, 3)
+ assert.sameValue(value[0], 'a');
+ assert.sameValue(value[1], 'b');
+ assert.sameValue(value[2], 'c');
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-spread-obj.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-spread-obj.js
new file mode 100644
index 0000000000..0e00dd9637
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-spread-obj.js
@@ -0,0 +1,59 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-spread-obj.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Use yield value in a object spread position (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [object-spread, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ Spread Properties
+
+ PropertyDefinition[Yield]:
+ (...)
+ ...AssignmentExpression[In, ?Yield]
+
+---*/
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield {
+ ...yield,
+ y: 1,
+ ...yield yield,
+ };
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next();
+iter.next({ x: 42 });
+iter.next({ x: 'lol' });
+var item = iter.next({ y: 39 });
+
+item.then(({ done, value }) => {
+ assert.sameValue(value.x, 42);
+ assert.sameValue(value.y, 39);
+ assert.sameValue(Object.keys(value).length, 2);
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-async-next.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-async-next.js
new file mode 100644
index 0000000000..84ecde54f8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-async-next.js
@@ -0,0 +1,226 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-async-next.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Execution order for yield* with async iterator and next() (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, async-iteration, Symbol.asyncIterator]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+
+---*/
+var log = [];
+var obj = {
+ get [Symbol.iterator]() {
+ log.push({ name: "get [Symbol.iterator]" });
+ },
+ get [Symbol.asyncIterator]() {
+ log.push({
+ name: "get [Symbol.asyncIterator]",
+ thisValue: this
+ });
+ return function() {
+ log.push({
+ name: "call [Symbol.asyncIterator]",
+ thisValue: this,
+ args: [...arguments]
+ });
+ var nextCount = 0;
+ return {
+ name: "asyncIterator",
+ get next() {
+ log.push({
+ name: "get next",
+ thisValue: this
+ });
+ return function() {
+ log.push({
+ name: "call next",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ nextCount++;
+ if (nextCount == 1) {
+ return {
+ name: "next-promise-1",
+ get then() {
+ log.push({
+ name: "get next then (1)",
+ thisValue: this
+ });
+ return function(resolve) {
+ log.push({
+ name: "call next then (1)",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ resolve({
+ name: "next-result-1",
+ get value() {
+ log.push({
+ name: "get next value (1)",
+ thisValue: this
+ });
+ return "next-value-1";
+ },
+ get done() {
+ log.push({
+ name: "get next done (1)",
+ thisValue: this
+ });
+ return false;
+ }
+ });
+ };
+ }
+ };
+ }
+
+ return {
+ name: "next-promise-2",
+ get then() {
+ log.push({
+ name: "get next then (2)",
+ thisValue: this
+ });
+ return function(resolve) {
+ log.push({
+ name: "call next then (2)",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ resolve({
+ name: "next-result-2",
+ get value() {
+ log.push({
+ name: "get next value (2)",
+ thisValue: this
+ });
+ return "next-value-2";
+ },
+ get done() {
+ log.push({
+ name: "get next done (2)",
+ thisValue: this
+ });
+ return true;
+ }
+ });
+ };
+ }
+ };
+ };
+ }
+ };
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ log.push({ name: "before yield*" });
+ var v = yield* obj;
+ log.push({
+ name: "after yield*",
+ value: v
+ });
+ return "return-value";
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+assert.sameValue(log.length, 0, "log.length");
+
+iter.next("next-arg-1").then(v => {
+ assert.sameValue(log[0].name, "before yield*");
+
+ assert.sameValue(log[1].name, "get [Symbol.asyncIterator]");
+ assert.sameValue(log[1].thisValue, obj, "get [Symbol.asyncIterator] thisValue");
+
+ assert.sameValue(log[2].name, "call [Symbol.asyncIterator]");
+ assert.sameValue(log[2].thisValue, obj, "[Symbol.asyncIterator] thisValue");
+ assert.sameValue(log[2].args.length, 0, "[Symbol.asyncIterator] args.length");
+
+ assert.sameValue(log[3].name, "get next");
+ assert.sameValue(log[3].thisValue.name, "asyncIterator", "get next thisValue");
+
+ assert.sameValue(log[4].name, "call next");
+ assert.sameValue(log[4].thisValue.name, "asyncIterator", "next thisValue");
+ assert.sameValue(log[4].args.length, 1, "next args.length");
+ assert.sameValue(log[4].args[0], undefined, "next args[0]");
+
+ assert.sameValue(log[5].name, "get next then (1)");
+ assert.sameValue(log[5].thisValue.name, "next-promise-1", "get next then thisValue");
+
+ assert.sameValue(log[6].name, "call next then (1)");
+ assert.sameValue(log[6].thisValue.name, "next-promise-1", "next then thisValue");
+ assert.sameValue(log[6].args.length, 2, "next then args.length");
+ assert.sameValue(typeof log[6].args[0], "function", "next then args[0]");
+ assert.sameValue(typeof log[6].args[1], "function", "next then args[1]");
+
+ assert.sameValue(log[7].name, "get next done (1)");
+ assert.sameValue(log[7].thisValue.name, "next-result-1", "get next done thisValue");
+
+ assert.sameValue(log[8].name, "get next value (1)");
+ assert.sameValue(log[8].thisValue.name, "next-result-1", "get next value thisValue");
+
+ assert.sameValue(v.value, "next-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 9, "log.length");
+
+ iter.next("next-arg-2").then(v => {
+ assert.sameValue(log[9].name, "call next");
+ assert.sameValue(log[9].thisValue.name, "asyncIterator", "next thisValue");
+ assert.sameValue(log[9].args.length, 1, "next args.length");
+ assert.sameValue(log[9].args[0], "next-arg-2", "next args[0]");
+
+ assert.sameValue(log[10].name, "get next then (2)");
+ assert.sameValue(log[10].thisValue.name, "next-promise-2", "get next then thisValue");
+
+ assert.sameValue(log[11].name, "call next then (2)");
+ assert.sameValue(log[11].thisValue.name, "next-promise-2", "next then thisValue");
+ assert.sameValue(log[11].args.length, 2, "next then args.length");
+ assert.sameValue(typeof log[11].args[0], "function", "next then args[0]");
+ assert.sameValue(typeof log[11].args[1], "function", "next then args[1]");
+
+ assert.sameValue(log[12].name, "get next done (2)");
+ assert.sameValue(log[12].thisValue.name, "next-result-2", "get next done thisValue");
+
+ assert.sameValue(log[13].name, "get next value (2)");
+ assert.sameValue(log[13].thisValue.name, "next-result-2", "get next value thisValue");
+
+ assert.sameValue(log[14].name, "after yield*");
+ assert.sameValue(log[14].value, "next-value-2");
+
+ assert.sameValue(v.value, "return-value");
+ assert.sameValue(v.done, true);
+
+ assert.sameValue(log.length, 15, "log.length");
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-async-return.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-async-return.js
new file mode 100644
index 0000000000..f006307f4a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-async-return.js
@@ -0,0 +1,242 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-async-return.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: execution order for yield* with async iterator and return() (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration, Symbol.asyncIterator]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ ...
+ 6. Repeat
+ ...
+ c. Else,
+ i. Assert: received.[[Type]] is return.
+ ii. Let return be ? GetMethod(iterator, "return").
+ iii. If return is undefined, return Completion(received).
+ iv. Let innerReturnResult be ? Call(return, iterator, « received.[[Value]] »).
+ v. If generatorKind is async, then set innerReturnResult to ? Await(innerReturnResult).
+ ...
+ vii. Let done be ? IteratorComplete(innerReturnResult).
+ viii. If done is true, then
+ 1. Let value be ? IteratorValue(innerReturnResult).
+ 2. If generatorKind is async, then set value to ? Await(value).
+ 3. Return Completion{[[Type]]: return, [[Value]]: value, [[Target]]: empty}.
+ ix. If generatorKind is async, then let received be AsyncGeneratorYield(? IteratorValue(innerResult)).
+ ...
+
+ AsyncGeneratorYield ( value )
+ ...
+ 8. Return ! AsyncGeneratorResolve(generator, value, false).
+ ...
+
+---*/
+var log = [];
+var obj = {
+ [Symbol.asyncIterator]() {
+ var returnCount = 0;
+ return {
+ name: 'asyncIterator',
+ get next() {
+ log.push({ name: "get next" });
+ return function() {
+ return {
+ value: "next-value-1",
+ done: false
+ };
+ };
+ },
+ get return() {
+ log.push({
+ name: "get return",
+ thisValue: this
+ });
+ return function() {
+ log.push({
+ name: "call return",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ returnCount++;
+ if (returnCount == 1) {
+ return {
+ name: "return-promise-1",
+ get then() {
+ log.push({
+ name: "get return then (1)",
+ thisValue: this
+ });
+ return function(resolve) {
+ log.push({
+ name: "call return then (1)",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ resolve({
+ name: "return-result-1",
+ get value() {
+ log.push({
+ name: "get return value (1)",
+ thisValue: this
+ });
+ return "return-value-1";
+ },
+ get done() {
+ log.push({
+ name: "get return done (1)",
+ thisValue: this
+ });
+ return false;
+ }
+ });
+ };
+ }
+ };
+ }
+
+ return {
+ name: "return-promise-2",
+ get then() {
+ log.push({
+ name: "get return then (2)",
+ thisValue: this
+ });
+ return function(resolve) {
+ log.push({
+ name: "call return then (2)",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ resolve({
+ name: "return-result-2",
+ get value() {
+ log.push({
+ name: "get return value (2)",
+ thisValue: this
+ });
+ return "return-value-2";
+ },
+ get done() {
+ log.push({
+ name: "get return done (2)",
+ thisValue: this
+ });
+ return true;
+ }
+ });
+ };
+ }
+ };
+ };
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ log.push({ name: "before yield*" });
+ yield* obj;
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+assert.sameValue(log.length, 0, "log.length");
+
+iter.next().then(v => {
+ assert.sameValue(log[0].name, "before yield*");
+
+ assert.sameValue(log[1].name, "get next");
+
+ assert.sameValue(v.value, "next-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 2, "log.length");
+
+ iter.return("return-arg-1").then(v => {
+ assert.sameValue(log[2].name, "get return");
+ assert.sameValue(log[2].thisValue.name, "asyncIterator", "get return thisValue");
+
+ assert.sameValue(log[3].name, "call return");
+ assert.sameValue(log[3].thisValue.name, "asyncIterator", "return thisValue");
+ assert.sameValue(log[3].args.length, 1, "return args.length");
+ assert.sameValue(log[3].args[0], "return-arg-1", "return args[0]");
+
+ assert.sameValue(log[4].name, "get return then (1)");
+ assert.sameValue(log[4].thisValue.name, "return-promise-1", "get return then thisValue");
+
+ assert.sameValue(log[5].name, "call return then (1)");
+ assert.sameValue(log[5].thisValue.name, "return-promise-1", "return then thisValue");
+ assert.sameValue(log[5].args.length, 2, "return then args.length");
+ assert.sameValue(typeof log[5].args[0], "function", "return then args[0]");
+ assert.sameValue(typeof log[5].args[1], "function", "return then args[1]");
+
+ assert.sameValue(log[6].name, "get return done (1)");
+ assert.sameValue(log[6].thisValue.name, "return-result-1", "get return done thisValue");
+
+ assert.sameValue(log[7].name, "get return value (1)");
+ assert.sameValue(log[7].thisValue.name, "return-result-1", "get return value thisValue");
+
+ assert.sameValue(v.value, "return-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 8, "log.length");
+
+ iter.return("return-arg-2").then(v => {
+ assert.sameValue(log[8].name, "get return");
+ assert.sameValue(log[8].thisValue.name, "asyncIterator", "get return thisValue");
+
+ assert.sameValue(log[9].name, "call return");
+ assert.sameValue(log[9].thisValue.name, "asyncIterator", "return thisValue");
+ assert.sameValue(log[9].args.length, 1, "return args.length");
+ assert.sameValue(log[9].args[0], "return-arg-2", "return args[0]");
+
+ assert.sameValue(log[10].name, "get return then (2)");
+ assert.sameValue(log[10].thisValue.name, "return-promise-2", "get return then thisValue");
+
+ assert.sameValue(log[11].name, "call return then (2)");
+ assert.sameValue(log[11].thisValue.name, "return-promise-2", "return then thisValue");
+ assert.sameValue(log[11].args.length, 2, "return then args.length");
+ assert.sameValue(typeof log[11].args[0], "function", "return then args[0]");
+ assert.sameValue(typeof log[11].args[1], "function", "return then args[1]");
+
+ assert.sameValue(log[12].name, "get return done (2)");
+ assert.sameValue(log[12].thisValue.name, "return-result-2", "get return done thisValue");
+
+ assert.sameValue(log[13].name, "get return value (2)");
+ assert.sameValue(log[13].thisValue.name, "return-result-2", "get return value thisValue");
+
+ assert.sameValue(v.value, "return-value-2");
+ assert.sameValue(v.done, true);
+
+ assert.sameValue(log.length, 14, "log.length");
+ }).then($DONE, $DONE);
+ }).catch($DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-async-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-async-throw.js
new file mode 100644
index 0000000000..b7af5893bd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-async-throw.js
@@ -0,0 +1,250 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-async-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: execution order for yield* with async iterator and throw() (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration, Symbol.asyncIterator]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ ...
+ 6. Repeat
+ ...
+ b. Else if received.[[Type]] is throw, then
+ i. Let throw be ? GetMethod(iterator, "throw").
+ ii. If throw is not undefined, then
+ 1. Let innerResult be ? Call(throw, iterator, « received.[[Value]] »).
+ 2. If generatorKind is async, then set innerResult to ? Await(innerResult).
+ ...
+ 5. Let done be ? IteratorComplete(innerResult).
+ 6. If done is true, then
+ a. Let resultValue be Return ? IteratorValue(innerResult).
+ b. If generatorKind is async, then set resultValue to ? Await(resultValue).
+ c. Return resultValue.
+ 7. If generatorKind is async, then let received be AsyncGeneratorYield(? IteratorValue(innerResult)).
+ ...
+
+ AsyncGeneratorYield ( value )
+
+ ...
+ 8. Return ! AsyncGeneratorResolve(generator, value, false).
+ ...
+
+---*/
+var log = [];
+var obj = {
+ [Symbol.asyncIterator]() {
+ var throwCount = 0;
+ return {
+ name: "asyncIterator",
+ get next() {
+ log.push({ name: "get next" });
+ return function() {
+ return {
+ value: "next-value-1",
+ done: false
+ };
+ };
+ },
+ get throw() {
+ log.push({
+ name: "get throw",
+ thisValue: this
+ });
+ return function() {
+ log.push({
+ name: "call throw",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ throwCount++;
+ if (throwCount == 1) {
+ return {
+ name: "throw-promise-1",
+ get then() {
+ log.push({
+ name: "get throw then (1)",
+ thisValue: this
+ });
+ return function(resolve) {
+ log.push({
+ name: "call throw then (1)",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ resolve({
+ name: "throw-result-1",
+ get value() {
+ log.push({
+ name: "get throw value (1)",
+ thisValue: this
+ });
+ return "throw-value-1";
+ },
+ get done() {
+ log.push({
+ name: "get throw done (1)",
+ thisValue: this
+ });
+ return false;
+ }
+ });
+ };
+ }
+ };
+ }
+
+ return {
+ name: "throw-promise-2",
+ get then() {
+ log.push({
+ name: "get throw then (2)",
+ thisValue: this
+ });
+ return function(resolve) {
+ log.push({
+ name: "call throw then (2)",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ resolve({
+ name: "throw-result-2",
+ get value() {
+ log.push({
+ name: "get throw value (2)",
+ thisValue: this
+ });
+ return "throw-value-2";
+ },
+ get done() {
+ log.push({
+ name: "get throw done (2)",
+ thisValue: this
+ });
+ return true;
+ }
+ });
+ };
+ }
+ };
+ };
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ log.push({ name: "before yield*" });
+ var v = yield* obj;
+ log.push({
+ name: "after yield*",
+ value: v
+ });
+ return "return-value";
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+assert.sameValue(log.length, 0, "log.length");
+
+iter.next().then(v => {
+ assert.sameValue(log[0].name, "before yield*");
+
+ assert.sameValue(log[1].name, "get next");
+
+ assert.sameValue(v.value, "next-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 2, "log.length");
+
+ iter.throw("throw-arg-1").then(v => {
+ assert.sameValue(log[2].name, "get throw");
+ assert.sameValue(log[2].thisValue.name, "asyncIterator", "get throw thisValue");
+
+ assert.sameValue(log[3].name, "call throw");
+ assert.sameValue(log[3].thisValue.name, "asyncIterator", "throw thisValue");
+ assert.sameValue(log[3].args.length, 1, "throw args.length");
+ assert.sameValue(log[3].args[0], "throw-arg-1", "throw args[0]");
+
+ assert.sameValue(log[4].name, "get throw then (1)");
+ assert.sameValue(log[4].thisValue.name, "throw-promise-1", "get throw thisValue");
+
+ assert.sameValue(log[5].name, "call throw then (1)");
+ assert.sameValue(log[5].thisValue.name, "throw-promise-1", "throw thisValue");
+ assert.sameValue(log[5].args.length, 2, "throw then args.length");
+ assert.sameValue(typeof log[5].args[0], "function", "throw then args[0]");
+ assert.sameValue(typeof log[5].args[1], "function", "throw then args[1]");
+
+ assert.sameValue(log[6].name, "get throw done (1)");
+ assert.sameValue(log[6].thisValue.name, "throw-result-1", "get throw done thisValue");
+
+ assert.sameValue(log[7].name, "get throw value (1)");
+ assert.sameValue(log[7].thisValue.name, "throw-result-1", "get throw value thisValue");
+
+ assert.sameValue(v.value, "throw-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 8, "log.length");
+
+ iter.throw("throw-arg-2").then(v => {
+ assert.sameValue(log[8].name, "get throw");
+ assert.sameValue(log[8].thisValue.name, "asyncIterator", "get throw thisValue");
+
+ assert.sameValue(log[9].name, "call throw");
+ assert.sameValue(log[9].thisValue.name, "asyncIterator", "throw thisValue");
+ assert.sameValue(log[9].args.length, 1, "throw args.length");
+ assert.sameValue(log[9].args[0], "throw-arg-2", "throw args[0]");
+
+ assert.sameValue(log[10].name, "get throw then (2)");
+ assert.sameValue(log[10].thisValue.name, "throw-promise-2", "get throw thisValue");
+
+ assert.sameValue(log[11].name, "call throw then (2)");
+ assert.sameValue(log[11].thisValue.name, "throw-promise-2", "throw thisValue");
+ assert.sameValue(log[11].args.length, 2, "throw then args.length");
+ assert.sameValue(typeof log[11].args[0], "function", "throw then args[0]");
+ assert.sameValue(typeof log[11].args[1], "function", "throw then args[1]");
+
+ assert.sameValue(log[12].name, "get throw done (2)");
+ assert.sameValue(log[12].thisValue.name, "throw-result-2", "get throw done thisValue");
+
+ assert.sameValue(log[13].name, "get throw value (2)");
+ assert.sameValue(log[13].thisValue.name, "throw-result-2", "get throw value thisValue");
+
+ assert.sameValue(log[14].name, "after yield*");
+ assert.sameValue(log[14].value, "throw-value-2");
+
+ assert.sameValue(v.value, "return-value");
+ assert.sameValue(v.done, true);
+
+ assert.sameValue(log.length, 15, "log.length");
+ }).then($DONE, $DONE);
+ }).catch($DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-expr-abrupt.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-expr-abrupt.js
new file mode 100644
index 0000000000..9fa5fa10eb
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-expr-abrupt.js
@@ -0,0 +1,61 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-expr-abrupt.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Abrupt completion while getting yield* operand (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ ...
+
+---*/
+var obj = {};
+var abrupt = function() {
+ throw obj;
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* abrupt();
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, obj, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-get-abrupt.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-get-abrupt.js
new file mode 100644
index 0000000000..e3e4865196
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-get-abrupt.js
@@ -0,0 +1,81 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-get-abrupt.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Abrupt completion while getting [Symbol.asyncIterator] (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ get [Symbol.asyncIterator]() {
+ throw reason;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-not-callable-boolean-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-not-callable-boolean-throw.js
new file mode 100644
index 0000000000..ee931b78bf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-not-callable-boolean-throw.js
@@ -0,0 +1,80 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-not-callable-boolean-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (boolean) (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ 3. If func is either undefined or null, return undefined.
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]: false
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-not-callable-number-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-not-callable-number-throw.js
new file mode 100644
index 0000000000..02cef73682
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-not-callable-number-throw.js
@@ -0,0 +1,80 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-not-callable-number-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (number) (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ 3. If func is either undefined or null, return undefined.
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]: 0
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-not-callable-object-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-not-callable-object-throw.js
new file mode 100644
index 0000000000..7394078578
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-not-callable-object-throw.js
@@ -0,0 +1,80 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-not-callable-object-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (object) (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ 3. If func is either undefined or null, return undefined.
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]: {}
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-not-callable-string-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-not-callable-string-throw.js
new file mode 100644
index 0000000000..f672cfd0bc
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-not-callable-string-throw.js
@@ -0,0 +1,80 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-not-callable-string-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (string) (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ 3. If func is either undefined or null, return undefined.
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]: ''
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-not-callable-symbol-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-not-callable-symbol-throw.js
new file mode 100644
index 0000000000..c0fd63751f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-not-callable-symbol-throw.js
@@ -0,0 +1,80 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-not-callable-symbol-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.asyncIterator] (symbol) (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ 3. If func is either undefined or null, return undefined.
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]: Symbol.asyncIterator
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-null-sync-get-abrupt.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-null-sync-get-abrupt.js
new file mode 100644
index 0000000000..87e5dd619b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-null-sync-get-abrupt.js
@@ -0,0 +1,86 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-null-sync-get-abrupt.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Abrupt completion while getting @@iterator after null @@asyncIterator (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+
+---*/
+var calls = 0;
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw reason;
+ },
+ get [Symbol.asyncIterator]() {
+ calls += 1;
+ return null;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, 'reject reason');
+ assert.sameValue(calls, 1);
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-abrupt.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-abrupt.js
new file mode 100644
index 0000000000..0ba984c4de
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-abrupt.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-returns-abrupt.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Abrupt completion while calling [Symbol.asyncIterator] (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+ 6. Let iterator be ? Call(method, obj).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ throw reason;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-boolean-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-boolean-throw.js
new file mode 100644
index 0000000000..35f08fbfd5
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-boolean-throw.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-returns-boolean-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Non object returned by [Symbol.asyncIterator]() - boolean (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+ 6. Let iterator be ? Call(method, obj).
+ 7. If Type(iterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return true;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-null-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-null-throw.js
new file mode 100644
index 0000000000..46e9d344df
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-null-throw.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-returns-null-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Non object returned by [Symbol.asyncIterator]() - null (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+ 6. Let iterator be ? Call(method, obj).
+ 7. If Type(iterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return null;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-number-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-number-throw.js
new file mode 100644
index 0000000000..a92c451abd
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-number-throw.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-returns-number-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Non object returned by [Symbol.asyncIterator]() - number (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+ 6. Let iterator be ? Call(method, obj).
+ 7. If Type(iterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return 42;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-string-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-string-throw.js
new file mode 100644
index 0000000000..f6ff86e9c3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-string-throw.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-returns-string-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Non object returned by [Symbol.asyncIterator]() - string (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+ 6. Let iterator be ? Call(method, obj).
+ 7. If Type(iterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return '42';
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-symbol-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-symbol-throw.js
new file mode 100644
index 0000000000..6d3abc9a26
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-symbol-throw.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-returns-symbol-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Non object returned by [Symbol.asyncIterator]() - symbol (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+ 6. Let iterator be ? Call(method, obj).
+ 7. If Type(iterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return Symbol.asyncIterator;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-undefined-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-undefined-throw.js
new file mode 100644
index 0000000000..3f821ab7e7
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-returns-undefined-throw.js
@@ -0,0 +1,77 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-returns-undefined-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Non object returned by [Symbol.asyncIterator]() - undefined (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ ...
+ 6. Let iterator be ? Call(method, obj).
+ 7. If Type(iterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return undefined;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-undefined-sync-get-abrupt.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-undefined-sync-get-abrupt.js
new file mode 100644
index 0000000000..39524b5304
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-async-undefined-sync-get-abrupt.js
@@ -0,0 +1,86 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-async-undefined-sync-get-abrupt.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Abrupt completion while getting @@iterator after undefined @@asyncIterator (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+
+---*/
+var calls = 0;
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw reason;
+ },
+ get [Symbol.asyncIterator]() {
+ calls += 1;
+ return undefined;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, 'reject reason');
+ assert.sameValue(calls, 1);
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-get-abrupt.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-get-abrupt.js
new file mode 100644
index 0000000000..d0b336e722
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-get-abrupt.js
@@ -0,0 +1,80 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-get-abrupt.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Abrupt completion while getting [Symbol.iterator] (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw reason;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-not-callable-boolean-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-not-callable-boolean-throw.js
new file mode 100644
index 0000000000..6f44d3ee98
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-not-callable-boolean-throw.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-not-callable-boolean-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.iterator] (boolean) (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]: false
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-not-callable-number-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-not-callable-number-throw.js
new file mode 100644
index 0000000000..3fb3df0fa8
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-not-callable-number-throw.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-not-callable-number-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.iterator] (number) (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]: 0
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-not-callable-object-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-not-callable-object-throw.js
new file mode 100644
index 0000000000..4dcf06dc35
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-not-callable-object-throw.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-not-callable-object-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.iterator] (object) (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]: {}
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-not-callable-string-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-not-callable-string-throw.js
new file mode 100644
index 0000000000..ae77bebeaa
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-not-callable-string-throw.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-not-callable-string-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.iterator] (string) (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]: ''
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-not-callable-symbol-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-not-callable-symbol-throw.js
new file mode 100644
index 0000000000..af6649ac1c
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-not-callable-symbol-throw.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-not-callable-symbol-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Throws a TypeError on a non-callable [Symbol.iterator] (symbol) (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ...
+
+ GetMethod ( V, P )
+
+ ...
+ 2. Let func be ? GetV(V, P).
+ ...
+ 4. If IsCallable(func) is false, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]: Symbol.iterator
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-abrupt.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-abrupt.js
new file mode 100644
index 0000000000..c7c1894a08
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-abrupt.js
@@ -0,0 +1,74 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-returns-abrupt.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Abrupt completion while calling [Symbol.iterator] (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ii. Let syncIterator be ? Call(syncMethod, obj).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ [Symbol.iterator]() {
+ throw reason;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-boolean-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-boolean-throw.js
new file mode 100644
index 0000000000..116f08fe59
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-boolean-throw.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-returns-boolean-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Non object returned by [Symbol.iterator]() - boolean (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ii. Let syncIterator be ? Call(syncMethod, obj).
+ iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
+ ...
+
+ CreateAsyncFromSyncIterator(syncIterator)
+
+ 1. If Type(syncIterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]() {
+ return true;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-null-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-null-throw.js
new file mode 100644
index 0000000000..7471f6b535
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-null-throw.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-returns-null-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Non object returned by [Symbol.iterator]() - null (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ii. Let syncIterator be ? Call(syncMethod, obj).
+ iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
+ ...
+
+ CreateAsyncFromSyncIterator(syncIterator)
+
+ 1. If Type(syncIterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]() {
+ return null;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-number-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-number-throw.js
new file mode 100644
index 0000000000..cf39a2c8c4
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-number-throw.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-returns-number-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Non object returned by [Symbol.iterator]() - number (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ii. Let syncIterator be ? Call(syncMethod, obj).
+ iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
+ ...
+
+ CreateAsyncFromSyncIterator(syncIterator)
+
+ 1. If Type(syncIterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]() {
+ return 0;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-string-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-string-throw.js
new file mode 100644
index 0000000000..5bd0727fef
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-string-throw.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-returns-string-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Non object returned by [Symbol.iterator]() - string (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ii. Let syncIterator be ? Call(syncMethod, obj).
+ iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
+ ...
+
+ CreateAsyncFromSyncIterator(syncIterator)
+
+ 1. If Type(syncIterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]() {
+ return '';
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-symbol-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-symbol-throw.js
new file mode 100644
index 0000000000..9943d01a31
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-symbol-throw.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-returns-symbol-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Non object returned by [Symbol.iterator]() - symbol (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ii. Let syncIterator be ? Call(syncMethod, obj).
+ iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
+ ...
+
+ CreateAsyncFromSyncIterator(syncIterator)
+
+ 1. If Type(syncIterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]() {
+ return Symbol.iterator;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-undefined-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-undefined-throw.js
new file mode 100644
index 0000000000..316be8f17e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-getiter-sync-returns-undefined-throw.js
@@ -0,0 +1,79 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-getiter-sync-returns-undefined-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Non object returned by [Symbol.iterator]() - undefined (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ 1. Let exprRef be the result of evaluating AssignmentExpression.
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ii. Let syncIterator be ? Call(syncMethod, obj).
+ iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
+ ...
+
+ CreateAsyncFromSyncIterator(syncIterator)
+
+ 1. If Type(syncIterator) is not Object, throw a TypeError exception.
+ ...
+
+---*/
+var obj = {
+ [Symbol.iterator]() {
+ return undefined;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-call-done-get-abrupt.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-call-done-get-abrupt.js
new file mode 100644
index 0000000000..c3789c2873
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-call-done-get-abrupt.js
@@ -0,0 +1,80 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-call-done-get-abrupt.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Abrupt completion while getting done (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ ...
+ v. Let done be ? IteratorComplete(innerResult).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ get done() {
+ throw reason;
+ }
+ };
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-call-returns-abrupt.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-call-returns-abrupt.js
new file mode 100644
index 0000000000..5018bbb2be
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-call-returns-abrupt.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-call-returns-abrupt.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Abrupt completion while calling next (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ throw reason;
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-call-value-get-abrupt.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-call-value-get-abrupt.js
new file mode 100644
index 0000000000..e5c8b1b039
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-call-value-get-abrupt.js
@@ -0,0 +1,82 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-call-value-get-abrupt.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Abrupt completion while getting value (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ ...
+ vi. If done is true, then
+ 1. Return ? IteratorValue(innerResult).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ done: true,
+ get value() {
+ throw reason;
+ }
+ };
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-get-abrupt.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-get-abrupt.js
new file mode 100644
index 0000000000..2fb2a77100
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-get-abrupt.js
@@ -0,0 +1,72 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-get-abrupt.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Abrupt completion while getting next (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ get next() {
+ throw reason;
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, "reject reason");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-non-object-ignores-then.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-non-object-ignores-then.js
new file mode 100644
index 0000000000..0e47083f23
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-non-object-ignores-then.js
@@ -0,0 +1,92 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-non-object-ignores-then.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: If next() value is not-object, do not access respective then property (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ iv. If Type(innerResult) is not Object, throw a TypeError exception.
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 7. If Type(resolution) is not Object, then
+ a. Return FulfillPromise(promise, resolution).
+ 8. Let then be Get(resolution, "then").
+ ...
+
+---*/
+Number.prototype.then = function() {
+ throw new Test262Error('Number#then should not be used');
+};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return 42;
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, 'TypeError');
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-boolean-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-boolean-throw.js
new file mode 100644
index 0000000000..40dfa0aa49
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-boolean-throw.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-not-callable-boolean-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Not-callable next value in a yield star position - boolean (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next: true
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-null-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-null-throw.js
new file mode 100644
index 0000000000..f24943e9ca
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-null-throw.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-not-callable-null-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Not-callable next value in a yield star position - null (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next: null
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-number-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-number-throw.js
new file mode 100644
index 0000000000..64a27fae1e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-number-throw.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-not-callable-number-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Not-callable next value in a yield star position - number (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next: 42
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-object-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-object-throw.js
new file mode 100644
index 0000000000..a1ef33d2bf
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-object-throw.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-not-callable-object-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Not-callable next value in a yield star position - object (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next: {}
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-string-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-string-throw.js
new file mode 100644
index 0000000000..be3c40ec57
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-string-throw.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-not-callable-string-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Not-callable next value in a yield star position - string (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next: ''
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-symbol-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-symbol-throw.js
new file mode 100644
index 0000000000..8d5c129490
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-symbol-throw.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-not-callable-symbol-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Not-callable next value in a yield star position - symbol (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next: Symbol('oi')
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-undefined-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-undefined-throw.js
new file mode 100644
index 0000000000..0a755d6f73
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-not-callable-undefined-throw.js
@@ -0,0 +1,69 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-not-callable-undefined-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Not-callable next value in a yield star position - undefined (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next: undefined
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v.constructor, TypeError, "TypeError");
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-get-abrupt.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-get-abrupt.js
new file mode 100644
index 0000000000..c233ce580a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-get-abrupt.js
@@ -0,0 +1,96 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-get-abrupt.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Return abrupt after getting next().then (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 8. Let then be Get(resolution, "then").
+ ...
+ 10. Get thenAction be then.[[Value]].
+ ...
+ 12. Perform EnqueueJob("PromiseJobs", PromiseResolveThenableJob, « promise,
+ resolution, thenAction »).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ get then() {
+ throw reason;
+ }
+ };
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, 'reject reason');
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-boolean-fulfillpromise.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-boolean-fulfillpromise.js
new file mode 100644
index 0000000000..d9086dcba6
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-boolean-fulfillpromise.js
@@ -0,0 +1,90 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-non-callable-boolean-fulfillpromise.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: FulfillPromise if next().then is not-callable (boolean) (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ iv. If Type(innerResult) is not Object, throw a TypeError exception.
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 7. If Type(resolution) is not Object, then
+ a. Return FulfillPromise(promise, resolution).
+ 8. Let then be Get(resolution, "then").
+ ...
+ 11. If IsCallable(thenAction) is false, then
+ a. Return FulfillPromise(promise, resolution).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ then: true,
+ value: 42,
+ done: false
+ }
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(({ value, done }) => {
+ assert.sameValue(value, 42);
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-null-fulfillpromise.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-null-fulfillpromise.js
new file mode 100644
index 0000000000..e1fa7fde10
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-null-fulfillpromise.js
@@ -0,0 +1,90 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-non-callable-null-fulfillpromise.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: FulfillPromise if next().then is not-callable (null) (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ iv. If Type(innerResult) is not Object, throw a TypeError exception.
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 7. If Type(resolution) is not Object, then
+ a. Return FulfillPromise(promise, resolution).
+ 8. Let then be Get(resolution, "then").
+ ...
+ 11. If IsCallable(thenAction) is false, then
+ a. Return FulfillPromise(promise, resolution).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ then: null,
+ value: 42,
+ done: false
+ }
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(({ value, done }) => {
+ assert.sameValue(value, 42);
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-number-fulfillpromise.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-number-fulfillpromise.js
new file mode 100644
index 0000000000..c1d0811a23
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-number-fulfillpromise.js
@@ -0,0 +1,90 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-non-callable-number-fulfillpromise.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: FulfillPromise if next().then is not-callable (number) (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ iv. If Type(innerResult) is not Object, throw a TypeError exception.
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 7. If Type(resolution) is not Object, then
+ a. Return FulfillPromise(promise, resolution).
+ 8. Let then be Get(resolution, "then").
+ ...
+ 11. If IsCallable(thenAction) is false, then
+ a. Return FulfillPromise(promise, resolution).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ then: 39,
+ value: 42,
+ done: false
+ }
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(({ value, done }) => {
+ assert.sameValue(value, 42);
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-object-fulfillpromise.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-object-fulfillpromise.js
new file mode 100644
index 0000000000..71d346bc80
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-object-fulfillpromise.js
@@ -0,0 +1,90 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-non-callable-object-fulfillpromise.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: FulfillPromise if next().then is not-callable (object) (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ iv. If Type(innerResult) is not Object, throw a TypeError exception.
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 7. If Type(resolution) is not Object, then
+ a. Return FulfillPromise(promise, resolution).
+ 8. Let then be Get(resolution, "then").
+ ...
+ 11. If IsCallable(thenAction) is false, then
+ a. Return FulfillPromise(promise, resolution).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ then: {},
+ value: 42,
+ done: false
+ }
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(({ value, done }) => {
+ assert.sameValue(value, 42);
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-string-fulfillpromise.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-string-fulfillpromise.js
new file mode 100644
index 0000000000..d957d8af7b
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-string-fulfillpromise.js
@@ -0,0 +1,90 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-non-callable-string-fulfillpromise.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: FulfillPromise if next().then is not-callable (string) (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ iv. If Type(innerResult) is not Object, throw a TypeError exception.
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 7. If Type(resolution) is not Object, then
+ a. Return FulfillPromise(promise, resolution).
+ 8. Let then be Get(resolution, "then").
+ ...
+ 11. If IsCallable(thenAction) is false, then
+ a. Return FulfillPromise(promise, resolution).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ then: '',
+ value: 42,
+ done: false
+ }
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(({ value, done }) => {
+ assert.sameValue(value, 42);
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-symbol-fulfillpromise.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-symbol-fulfillpromise.js
new file mode 100644
index 0000000000..339c5f09f3
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-symbol-fulfillpromise.js
@@ -0,0 +1,90 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-non-callable-symbol-fulfillpromise.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: FulfillPromise if next().then is not-callable (symbol) (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ iv. If Type(innerResult) is not Object, throw a TypeError exception.
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 7. If Type(resolution) is not Object, then
+ a. Return FulfillPromise(promise, resolution).
+ 8. Let then be Get(resolution, "then").
+ ...
+ 11. If IsCallable(thenAction) is false, then
+ a. Return FulfillPromise(promise, resolution).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ then: Symbol('oi'),
+ value: 42,
+ done: false
+ }
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(({ value, done }) => {
+ assert.sameValue(value, 42);
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-undefined-fulfillpromise.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-undefined-fulfillpromise.js
new file mode 100644
index 0000000000..4153342a2f
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-non-callable-undefined-fulfillpromise.js
@@ -0,0 +1,90 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-non-callable-undefined-fulfillpromise.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: FulfillPromise if next().then is not-callable (undefined) (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ iv. If Type(innerResult) is not Object, throw a TypeError exception.
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 7. If Type(resolution) is not Object, then
+ a. Return FulfillPromise(promise, resolution).
+ 8. Let then be Get(resolution, "then").
+ ...
+ 11. If IsCallable(thenAction) is false, then
+ a. Return FulfillPromise(promise, resolution).
+ ...
+
+---*/
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ then: undefined,
+ value: 42,
+ done: false
+ }
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(({ value, done }) => {
+ assert.sameValue(value, 42);
+ assert.sameValue(done, false);
+}).then($DONE, $DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-returns-abrupt.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-returns-abrupt.js
new file mode 100644
index 0000000000..a8c6fa6699
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-next-then-returns-abrupt.js
@@ -0,0 +1,96 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-next-then-returns-abrupt.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: Return abrupt after calling next().then (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, Symbol.asyncIterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+ ...
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ ...
+
+ Await
+
+ ...
+ 2. Let promiseCapability be ! NewPromiseCapability(%Promise%).
+ 3. Perform ! Call(promiseCapability.[[Resolve]], undefined, « promise »).
+ ...
+
+ Promise Resolve Functions
+
+ ...
+ 8. Let then be Get(resolution, "then").
+ ...
+ 10. Get thenAction be then.[[Value]].
+ ...
+ 12. Perform EnqueueJob("PromiseJobs", PromiseResolveThenableJob, « promise,
+ resolution, thenAction »).
+ ...
+
+---*/
+var reason = {};
+var obj = {
+ get [Symbol.iterator]() {
+ throw new Test262Error('it should not get Symbol.iterator');
+ },
+ [Symbol.asyncIterator]() {
+ return {
+ next() {
+ return {
+ then() {
+ throw reason;
+ }
+ };
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ yield* obj;
+ throw new Test262Error('abrupt completion closes iter');
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+iter.next().then(() => {
+ throw new Test262Error('Promise incorrectly fulfilled.');
+}, v => {
+ assert.sameValue(v, reason, 'reject reason');
+
+ iter.next().then(({ done, value }) => {
+ assert.sameValue(done, true, 'the iterator is completed');
+ assert.sameValue(value, undefined, 'value is undefined');
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-sync-next.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-sync-next.js
new file mode 100644
index 0000000000..8f5fc9702e
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-sync-next.js
@@ -0,0 +1,229 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-sync-next.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: execution order for yield* with sync iterator and next() (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, async-iteration, Symbol.asyncIterator]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ ...
+ 2. Let value be ? GetValue(exprRef).
+ 3. Let generatorKind be ! GetGeneratorKind().
+ 4. Let iterator be ? GetIterator(value, generatorKind).
+ 5. Let received be NormalCompletion(undefined).
+ 6. Repeat
+ a. If received.[[Type]] is normal, then
+ i. Let innerResult be ? IteratorNext(iterator, received.[[Value]]).
+ ii. Let innerResult be ? Invoke(iterator, "next",
+ « received.[[Value]] »).
+ iii. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ ...
+ v. Let done be ? IteratorComplete(innerResult).
+ vi. If done is true, then
+ 1. Return ? IteratorValue(innerResult).
+ vii. Let received be GeneratorYield(innerResult).
+ ...
+
+ GetIterator ( obj [ , hint ] )
+
+ ...
+ 3. If hint is async,
+ a. Set method to ? GetMethod(obj, @@asyncIterator).
+ b. If method is undefined,
+ i. Let syncMethod be ? GetMethod(obj, @@iterator).
+ ii. Let syncIterator be ? Call(syncMethod, obj).
+ iii. Return ? CreateAsyncFromSyncIterator(syncIterator).
+ ...
+
+ %AsyncFromSyncIteratorPrototype%.next ( value )
+
+ ...
+ 5. Let nextResult be IteratorNext(syncIterator, value).
+ ...
+ 7. Let nextValue be IteratorValue(nextResult).
+ ...
+ 9. Let nextDone be IteratorComplete(nextResult).
+ ...
+ 12. Perform ! Call(valueWrapperCapability.[[Resolve]], undefined,
+ « nextValue »).
+ ...
+ 14. Set onFulfilled.[[Done]] to nextDone.
+ 15. Perform ! PerformPromiseThen(valueWrapperCapability.[[Promise]],
+ onFulfilled, undefined, promiseCapability).
+ ...
+
+ Async Iterator Value Unwrap Functions
+
+ 1. Return ! CreateIterResultObject(value, F.[[Done]]).
+
+---*/
+var log = [];
+var obj = {
+ get [Symbol.iterator]() {
+ log.push({
+ name: "get [Symbol.iterator]",
+ thisValue: this
+ });
+ return function() {
+ log.push({
+ name: "call [Symbol.iterator]",
+ thisValue: this,
+ args: [...arguments]
+ });
+ var nextCount = 0;
+ return {
+ name: "syncIterator",
+ get next() {
+ log.push({
+ name: "get next",
+ thisValue: this
+ });
+ return function() {
+ log.push({
+ name: "call next",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ nextCount++;
+ if (nextCount == 1) {
+ return {
+ name: "next-result-1",
+ get value() {
+ log.push({
+ name: "get next value (1)",
+ thisValue: this
+ });
+ return "next-value-1";
+ },
+ get done() {
+ log.push({
+ name: "get next done (1)",
+ thisValue: this
+ });
+ return false;
+ }
+ };
+ }
+
+ return {
+ name: "next-result-2",
+ get value() {
+ log.push({
+ name: "get next value (2)",
+ thisValue: this
+ });
+ return "next-value-2";
+ },
+ get done() {
+ log.push({
+ name: "get next done (2)",
+ thisValue: this
+ });
+ return true;
+ }
+ };
+ };
+ }
+ };
+ };
+ },
+ get [Symbol.asyncIterator]() {
+ log.push({ name: "get [Symbol.asyncIterator]" });
+ return null;
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ log.push({ name: "before yield*" });
+ var v = yield* obj;
+ log.push({
+ name: "after yield*",
+ value: v
+ });
+ return "return-value";
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+assert.sameValue(log.length, 0, "log.length");
+
+iter.next("next-arg-1").then(v => {
+ assert.sameValue(log[0].name, "before yield*");
+
+ assert.sameValue(log[1].name, "get [Symbol.asyncIterator]");
+
+ assert.sameValue(log[2].name, "get [Symbol.iterator]");
+ assert.sameValue(log[2].thisValue, obj, "get [Symbol.iterator] thisValue");
+
+ assert.sameValue(log[3].name, "call [Symbol.iterator]");
+ assert.sameValue(log[3].thisValue, obj, "[Symbol.iterator] thisValue");
+ assert.sameValue(log[3].args.length, 0, "[Symbol.iterator] args.length");
+
+ assert.sameValue(log[4].name, "get next");
+ assert.sameValue(log[4].thisValue.name, "syncIterator", "get next thisValue");
+
+ assert.sameValue(log[5].name, "call next");
+ assert.sameValue(log[5].thisValue.name, "syncIterator", "next thisValue");
+ assert.sameValue(log[5].args.length, 1, "next args.length");
+ assert.sameValue(log[5].args[0], undefined, "next args[0]");
+
+ assert.sameValue(log[6].name, "get next done (1)");
+ assert.sameValue(log[6].thisValue.name, "next-result-1", "get next done thisValue");
+
+ assert.sameValue(log[7].name, "get next value (1)");
+ assert.sameValue(log[7].thisValue.name, "next-result-1", "get next value thisValue");
+
+ assert.sameValue(v.value, "next-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 8, "log.length");
+
+ iter.next("next-arg-2").then(v => {
+ assert.sameValue(log[8].name, "call next");
+ assert.sameValue(log[8].thisValue.name, "syncIterator", "next thisValue");
+ assert.sameValue(log[8].args.length, 1, "next args.length");
+ assert.sameValue(log[8].args[0], "next-arg-2", "next args[0]");
+
+ assert.sameValue(log[9].name, "get next done (2)");
+ assert.sameValue(log[9].thisValue.name, "next-result-2", "get next done thisValue");
+
+ assert.sameValue(log[10].name, "get next value (2)");
+ assert.sameValue(log[10].thisValue.name, "next-result-2", "get next value thisValue");
+
+ assert.sameValue(log[11].name, "after yield*");
+ assert.sameValue(log[11].value, "next-value-2");
+
+ assert.sameValue(v.value, "return-value");
+ assert.sameValue(v.done, true);
+
+ assert.sameValue(log.length, 12, "log.length");
+ }).then($DONE, $DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-sync-return.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-sync-return.js
new file mode 100644
index 0000000000..707b4d6f5a
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-sync-return.js
@@ -0,0 +1,204 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-sync-return.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: execution order for yield* with sync iterator and return() (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, async-iteration, Symbol.asyncIterator]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ ...
+ 6. Repeat
+ ...
+ c. Else,
+ i. Assert: received.[[Type]] is return.
+ ii. Let return be ? GetMethod(iterator, "return").
+ iii. If return is undefined, return Completion(received).
+ iv. Let innerReturnResult be ? Call(return, iterator,
+ « received.[[Value]] »).
+ v. If generatorKind is async, then set innerReturnResult to
+ ? Await(innerReturnResult).
+ ...
+ vii. Let done be ? IteratorComplete(innerReturnResult).
+ viii. If done is true, then
+ 1. Let value be ? IteratorValue(innerReturnResult).
+ 2. Return Completion{[[Type]]: return, [[Value]]: value,
+ [[Target]]: empty}.
+ ix. Let received be GeneratorYield(innerResult).
+
+ %AsyncFromSyncIteratorPrototype%.return ( value )
+
+ 5. Let return be GetMethod(syncIterator, "return").
+ ...
+ ...
+ 8. Let returnResult be Call(return, syncIterator, « value »).
+ ...
+ 11. Let returnValue be IteratorValue(returnResult).
+ ..
+ 13. Let returnDone be IteratorComplete(returnResult).
+ ...
+ 16. Perform ! Call(valueWrapperCapability.[[Resolve]], undefined, « returnValue »).
+ ...
+ 18. Set onFulfilled.[[Done]] to returnDone.
+ 19. Perform ! PerformPromiseThen(valueWrapperCapability.[[Promise]],
+ onFulfilled, undefined, promiseCapability).
+ ...
+
+---*/
+var log = [];
+var obj = {
+ [Symbol.iterator]() {
+ var returnCount = 0;
+ return {
+ name: "syncIterator",
+ get next() {
+ log.push({ name: "get next" });
+ return function() {
+ return {
+ value: "next-value-1",
+ done: false
+ };
+ };
+ },
+ get return() {
+ log.push({
+ name: "get return",
+ thisValue: this
+ });
+ return function() {
+ log.push({
+ name: "call return",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ returnCount++;
+ if (returnCount == 1) {
+ return {
+ name: "return-result-1",
+ get value() {
+ log.push({
+ name: "get return value (1)",
+ thisValue: this
+ });
+ return "return-value-1";
+ },
+ get done() {
+ log.push({
+ name: "get return done (1)",
+ thisValue: this
+ });
+ return false;
+ }
+ };
+ }
+
+ return {
+ name: "return-result-2",
+ get value() {
+ log.push({
+ name: "get return value (2)",
+ thisValue: this
+ });
+ return "return-value-2";
+ },
+ get done() {
+ log.push({
+ name: "get return done (2)",
+ thisValue: this
+ });
+ return true;
+ }
+ };
+ };
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ log.push({ name: "before yield*" });
+ yield* obj;
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+assert.sameValue(log.length, 0, "log.length");
+
+iter.next().then(v => {
+ assert.sameValue(log[0].name, "before yield*");
+
+ assert.sameValue(log[1].name, "get next");
+
+ assert.sameValue(v.value, "next-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 2, "log.length");
+
+ iter.return("return-arg-1").then(v => {
+ assert.sameValue(log[2].name, "get return");
+ assert.sameValue(log[2].thisValue.name, "syncIterator", "get return thisValue");
+
+ assert.sameValue(log[3].name, "call return");
+ assert.sameValue(log[3].thisValue.name, "syncIterator", "return thisValue");
+ assert.sameValue(log[3].args.length, 1, "return args.length");
+ assert.sameValue(log[3].args[0], "return-arg-1", "return args[0]");
+
+ assert.sameValue(log[4].name, "get return done (1)");
+ assert.sameValue(log[4].thisValue.name, "return-result-1", "get return done thisValue");
+
+ assert.sameValue(log[5].name, "get return value (1)");
+ assert.sameValue(log[5].thisValue.name, "return-result-1", "get return value thisValue");
+
+ assert.sameValue(v.value, "return-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 6, "log.length");
+
+ iter.return().then(v => {
+ assert.sameValue(log[6].name, "get return");
+ assert.sameValue(log[6].thisValue.name, "syncIterator", "get return thisValue");
+
+ assert.sameValue(log[7].name, "call return");
+ assert.sameValue(log[7].thisValue.name, "syncIterator", "get return thisValue");
+ assert.sameValue(log[7].args.length, 1, "return args.length");
+ assert.sameValue(log[7].args[0], undefined, "return args[0]");
+
+ assert.sameValue(log[8].name, "get return done (2)");
+ assert.sameValue(log[8].thisValue.name, "return-result-2", "get return done thisValue");
+
+ assert.sameValue(log[9].name, "get return value (2)");
+ assert.sameValue(log[9].thisValue.name, "return-result-2", "get return value thisValue");
+
+ assert.sameValue(v.value, "return-value-2");
+ assert.sameValue(v.done, true);
+
+ assert.sameValue(log.length, 10, "log.length");
+ }).then($DONE, $DONE);
+ }).catch($DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);
diff --git a/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-sync-throw.js b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-sync-throw.js
new file mode 100644
index 0000000000..4721201d4d
--- /dev/null
+++ b/js/src/tests/test262/language/statements/class/async-gen-method/yield-star-sync-throw.js
@@ -0,0 +1,210 @@
+// |reftest| async
+// This file was procedurally generated from the following sources:
+// - src/async-generators/yield-star-sync-throw.case
+// - src/async-generators/default/async-class-decl-method.template
+/*---
+description: execution order for yield* with sync iterator and throw() (Async Generator method as a ClassDeclaration element)
+esid: prod-AsyncGeneratorMethod
+features: [Symbol.iterator, async-iteration]
+flags: [generated, async]
+info: |
+ ClassElement :
+ MethodDefinition
+
+ MethodDefinition :
+ AsyncGeneratorMethod
+
+ Async Generator Function Definitions
+
+ AsyncGeneratorMethod :
+ async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
+
+
+ YieldExpression: yield * AssignmentExpression
+
+ ...
+ 6. Repeat
+ ...
+ b. Else if received.[[Type]] is throw, then
+ i. Let throw be ? GetMethod(iterator, "throw").
+ ii. If throw is not undefined, then
+ 1. Let innerResult be ? Call(throw, iterator, « received.[[Value]] »).
+ 2. If generatorKind is async, then set innerResult to
+ ? Await(innerResult).
+ ...
+ 5. Let done be ? IteratorComplete(innerResult).
+ 6. If done is true, then
+ a. Return ? IteratorValue(innerResult).
+ 7. Let received be GeneratorYield(innerResult).
+ ...
+
+ %AsyncFromSyncIteratorPrototype%.throw ( value )
+
+ ...
+ 5. Let throw be GetMethod(syncIterator, "throw").
+ ...
+ 8. Let throwResult be Call(throw, syncIterator, « value »).
+ ...
+ 11. Let throwValue be IteratorValue(throwResult).
+ ...
+ 13. Let throwDone be IteratorComplete(throwResult).
+ ...
+ 16. Perform ! Call(valueWrapperCapability.[[Resolve]], undefined,
+ « throwValue »).
+ ...
+ 18. Set onFulfilled.[[Done]] to throwDone.
+ 19. Perform ! PerformPromiseThen(valueWrapperCapability.[[Promise]],
+ onFulfilled, undefined, promiseCapability).
+ ...
+
+---*/
+var log = [];
+var obj = {
+ [Symbol.iterator]() {
+ var throwCount = 0;
+ return {
+ name: "syncIterator",
+ get next() {
+ log.push({ name: "get next" });
+ return function() {
+ return {
+ value: "next-value-1",
+ done: false
+ };
+ };
+ },
+ get throw() {
+ log.push({
+ name: "get throw",
+ thisValue: this
+ });
+ return function() {
+ log.push({
+ name: "call throw",
+ thisValue: this,
+ args: [...arguments]
+ });
+
+ throwCount++;
+ if (throwCount == 1) {
+ return {
+ name: "throw-result-1",
+ get value() {
+ log.push({
+ name: "get throw value (1)",
+ thisValue: this
+ });
+ return "throw-value-1";
+ },
+ get done() {
+ log.push({
+ name: "get throw done (1)",
+ thisValue: this
+ });
+ return false;
+ }
+ };
+ }
+
+ return {
+ name: "throw-result-2",
+ get value() {
+ log.push({
+ name: "get throw value (2)",
+ thisValue: this
+ });
+ return "throw-value-2";
+ },
+ get done() {
+ log.push({
+ name: "get throw done (2)",
+ thisValue: this
+ });
+ return true;
+ }
+ };
+ };
+ }
+ };
+ }
+};
+
+
+
+var callCount = 0;
+
+class C { async *gen() {
+ callCount += 1;
+ log.push({ name: "before yield*" });
+ var v = yield* obj;
+ log.push({
+ name: "after yield*",
+ value: v
+ });
+ return "return-value";
+
+}}
+
+var gen = C.prototype.gen;
+
+var iter = gen();
+
+assert.sameValue(log.length, 0, "log.length");
+
+iter.next().then(v => {
+ assert.sameValue(log[0].name, "before yield*");
+
+ assert.sameValue(log[1].name, "get next");
+
+ assert.sameValue(v.value, "next-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 2, "log.length");
+
+ iter.throw("throw-arg-1").then(v => {
+ assert.sameValue(log[2].name, "get throw");
+ assert.sameValue(log[2].thisValue.name, "syncIterator", "get throw thisValue");
+
+ assert.sameValue(log[3].name, "call throw");
+ assert.sameValue(log[3].thisValue.name, "syncIterator", "throw thisValue");
+ assert.sameValue(log[3].args.length, 1, "throw args.length");
+ assert.sameValue(log[3].args[0], "throw-arg-1", "throw args[0]");
+
+ assert.sameValue(log[4].name, "get throw done (1)");
+ assert.sameValue(log[4].thisValue.name, "throw-result-1", "get throw done thisValue");
+
+ assert.sameValue(log[5].name, "get throw value (1)");
+ assert.sameValue(log[5].thisValue.name, "throw-result-1", "get throw value thisValue");
+
+ assert.sameValue(v.value, "throw-value-1");
+ assert.sameValue(v.done, false);
+
+ assert.sameValue(log.length, 6, "log.length");
+
+ iter.throw().then(v => {
+ assert.sameValue(log[6].name, "get throw");
+ assert.sameValue(log[6].thisValue.name, "syncIterator", "get throw thisValue");
+
+ assert.sameValue(log[7].name, "call throw");
+ assert.sameValue(log[7].thisValue.name, "syncIterator", "throw thisValue");
+ assert.sameValue(log[7].args.length, 1, "throw args.length");
+ assert.sameValue(log[7].args[0], undefined, "throw args[0]");
+
+ assert.sameValue(log[8].name, "get throw done (2)");
+ assert.sameValue(log[8].thisValue.name, "throw-result-2", "get throw done thisValue");
+
+ assert.sameValue(log[9].name, "get throw value (2)");
+ assert.sameValue(log[9].thisValue.name, "throw-result-2", "get throw value thisValue");
+
+ assert.sameValue(log[10].name, "after yield*");
+ assert.sameValue(log[10].value, "throw-value-2");
+
+ assert.sameValue(v.value, "return-value");
+ assert.sameValue(v.done, true);
+
+ assert.sameValue(log.length, 11, "log.length");
+ }).then($DONE, $DONE);
+ }).catch($DONE);
+}).catch($DONE);
+
+assert.sameValue(callCount, 1);