async-func-decl-dstr-array-elem-target-yield-invalid-strict.js (1495B)
1 // |reftest| error:SyntaxError 2 'use strict'; 3 // This file was procedurally generated from the following sources: 4 // - src/dstr-assignment-for-await/array-elem-target-yield-invalid.case 5 // - src/dstr-assignment-for-await/error-async-function-syntax/async-func-decl.template 6 /*--- 7 description: When a `yield` token appears within the DestructuringAssignmentTarget of an AssignmentElement and outside of a generator function body, it behaves as an IdentifierReference. (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] 11 negative: 12 phase: parse 13 type: SyntaxError 14 info: | 15 IterationStatement : 16 for await ( LeftHandSideExpression of AssignmentExpression ) Statement 17 18 1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« », 19 AssignmentExpression, iterate). 20 2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement, 21 keyResult, assignment, labelSet). 22 23 13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation 24 25 [...] 26 5. If destructuring is true and if lhsKind is assignment, then 27 a. Assert: lhs is a LeftHandSideExpression. 28 b. Let assignmentPattern be the parse of the source text corresponding to 29 lhs using AssignmentPattern as the goal symbol. 30 [...] 31 ---*/ 32 $DONOTEVALUATE(); 33 34 async function fn() { 35 for await ([ x[yield] ] of [[]]) {} 36 }