tests/auto/qml/ecmascripttests/test262/test/language/statements/class/dstr-async-gen-meth-dflt-ary-ptrn-rest-id-iter-val-err.js
raw symbols SCIP| 1 | // This file was procedurally generated from the following sources: |
| 2 | // - src/dstr-binding/ary-ptrn-rest-id-iter-val-err.case |
| 3 | // - src/dstr-binding/error/cls-decl-async-gen-meth-dflt.template |
| 4 | /*--- |
| 5 | description: Error forwarding when IteratorValue returns an abrupt completion (class expression async generator method (default parameters)) |
| 6 | esid: sec-class-definitions-runtime-semantics-evaluation |
| 7 | features: [Symbol.iterator, async-iteration] |
| 8 | flags: [generated] |
| 9 | info: | |
| 10 | ClassDeclaration : class BindingIdentifier ClassTail |
| 11 | |
| 12 | 1. Let className be StringValue of BindingIdentifier. |
| 13 | 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with |
| 14 | argument className. |
| 15 | [...] |
| 16 | |
| 17 | 14.5.14 Runtime Semantics: ClassDefinitionEvaluation |
| 18 | |
| 19 | 21. For each ClassElement m in order from methods |
| 20 | a. If IsStatic of m is false, then |
| 21 | i. Let status be the result of performing |
| 22 | PropertyDefinitionEvaluation for m with arguments proto and |
| 23 | false. |
| 24 | [...] |
| 25 | |
| 26 | Runtime Semantics: PropertyDefinitionEvaluation |
| 27 | |
| 28 | AsyncGeneratorMethod : |
| 29 | async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) |
| 30 | { AsyncGeneratorBody } |
| 31 | |
| 32 | 1. Let propKey be the result of evaluating PropertyName. |
| 33 | 2. ReturnIfAbrupt(propKey). |
| 34 | 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. |
| 35 | Otherwise let strict be false. |
| 36 | 4. Let scope be the running execution context's LexicalEnvironment. |
| 37 | 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, |
| 38 | AsyncGeneratorBody, scope, strict). |
| 39 | [...] |
| 40 | |
| 41 | 13.3.3.6 Runtime Semantics: IteratorBindingInitialization |
| 42 | BindingRestElement : ... BindingIdentifier |
| 43 | 1. Let lhs be ResolveBinding(StringValue of BindingIdentifier, |
| 44 | environment). |
| 45 | 2. ReturnIfAbrupt(lhs). 3. Let A be ArrayCreate(0). 4. Let n=0. 5. Repeat, |
| 46 | [...] |
| 47 | c. Let nextValue be IteratorValue(next). |
| 48 | d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to |
| 49 | true. |
| 50 | e. ReturnIfAbrupt(nextValue). |
| 51 | |
| 52 | ---*/ |
| 53 | var poisonedValue = Object.defineProperty({}, 'value', { |
| 54 | get: function() { |
| 55 | throw new Test262Error(); |
| 56 | } |
| 57 | }); |
| 58 | var iter = {}; |
| 59 | iter[Symbol.iterator] = function() { |
| 60 | return { |
| 61 | next: function() { |
| 62 | return poisonedValue; |
| 63 | } |
| 64 | }; |
| 65 | }; |
| 66 | |
| 67 | |
| 68 | class C { |
| 69 | async *method([...x] = iter) { |
| 70 | |
| 71 | } |
| 72 | }; |
| 73 | |
| 74 | var method = C.prototype.method; |
| 75 | |
| 76 | assert.throws(Test262Error, function() { |
| 77 | method(); |
| 78 | }); |