async-func-decl-dstr-array-elem-put-unresolvable-strict-strict.js (1609B)
1 // |reftest| async 2 'use strict'; 3 // This file was procedurally generated from the following sources: 4 // - src/dstr-assignment-for-await/array-elem-put-unresolvable-strict.case 5 // - src/dstr-assignment-for-await/default/async-func-decl.template 6 /*--- 7 description: In strict mode, if the the assignment target is an unresolvable reference, a ReferenceError should be thrown. (for-await-of statement in an async function declaration) 8 esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation 9 features: [destructuring-binding, async-iteration] 10 flags: [generated, onlyStrict, async] 11 info: | 12 IterationStatement : 13 for await ( LeftHandSideExpression of AssignmentExpression ) Statement 14 15 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« », 16 AssignmentExpression, iterate). 17 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement, 18 keyResult, assignment, labelSet). 19 20 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation 21 22 [...] 23 5. If destructuring is true and if lhsKind is assignment, then 24 a. Assert: lhs is a LeftHandSideExpression. 25 b. Let assignmentPattern be the parse of the source text corresponding to 26 lhs using AssignmentPattern as the goal symbol. 27 [...] 28 ---*/ 29 30 let iterCount = 0; 31 async function fn() { 32 for await ([ unresolvable ] of [[] 33 ]) { 34 35 iterCount += 1; 36 } 37 } 38 39 let promise = fn(); 40 41 promise.then(() => $DONE('Promise incorrectly fulfilled.'), ({ constructor }) => { 42 assert.sameValue(iterCount, 0); 43 assert.sameValue(constructor, ReferenceError); 44 }).then($DONE, $DONE);