async-gen-meth-static-dflt-ary-ptrn-elem-id-iter-val-err.js (2678B)
1 // This file was procedurally generated from the following sources: 2 // - src/dstr-binding/ary-ptrn-elem-id-iter-val-err.case 3 // - src/dstr-binding/error/cls-decl-async-gen-meth-static-dflt.template 4 /*--- 5 description: Error forwarding when IteratorValue returns an abrupt completion (static class expression async generator method (default parameter)) 6 esid: sec-runtime-semantics-bindingclassdeclarationevaluation 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 b. Else, 22 Let status be the result of performing PropertyDefinitionEvaluation for 23 m with arguments F and 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 43 SingleNameBinding : BindingIdentifier Initializeropt 44 45 [...] 46 4. If iteratorRecord.[[done]] is false, then 47 a. Let next be IteratorStep(iteratorRecord.[[iterator]]). 48 b. If next is an abrupt completion, set iteratorRecord.[[done]] to true. 49 c. ReturnIfAbrupt(next). 50 d. If next is false, set iteratorRecord.[[done]] to true. 51 e. Else, 52 i. Let v be IteratorValue(next). 53 ii. If v is an abrupt completion, set iteratorRecord.[[done]] to 54 true. 55 iii. ReturnIfAbrupt(v). 56 57 ---*/ 58 var poisonedValue = Object.defineProperty({}, 'value', { 59 get: function() { 60 throw new Test262Error(); 61 } 62 }); 63 var g = {}; 64 g[Symbol.iterator] = function() { 65 return { 66 next: function() { 67 return poisonedValue; 68 } 69 }; 70 }; 71 72 73 class C { 74 static async *method([x] = g) { 75 76 } 77 }; 78 79 var method = C.method; 80 81 assert.throws(Test262Error, function() { 82 method(); 83 }); 84 85 reportCompare(0, 0);