array-rest-nested-obj-yield-expr.js (1339B)
1 // This file was procedurally generated from the following sources: 2 // - src/dstr-assignment/array-rest-nested-obj-yield-expr.case 3 // - src/dstr-assignment/default/assignment-expr.template 4 /*--- 5 description: When a `yield` token appears within the Initializer of a nested destructuring assignment and within a generator function body, it should behave as a YieldExpression. (AssignmentExpression) 6 esid: sec-variable-statement-runtime-semantics-evaluation 7 features: [generators, destructuring-binding] 8 flags: [generated] 9 info: | 10 VariableDeclaration : BindingPattern Initializer 11 12 1. Let rhs be the result of evaluating Initializer. 13 2. Let rval be GetValue(rhs). 14 3. ReturnIfAbrupt(rval). 15 4. Return the result of performing BindingInitialization for 16 BindingPattern passing rval and undefined as arguments. 17 ---*/ 18 var iterationResult, iter, x; 19 20 iter = (function*() { 21 22 var result; 23 var vals = [{}]; 24 25 result = [...{ x = yield }] = vals; 26 27 28 29 assert.sameValue(result, vals); 30 31 }()); 32 33 iterationResult = iter.next(); 34 35 assert.sameValue(iterationResult.value, undefined); 36 assert.sameValue(iterationResult.done, false); 37 assert.sameValue(x, undefined); 38 39 iterationResult = iter.next(4); 40 41 assert.sameValue(iterationResult.value, undefined); 42 assert.sameValue(iterationResult.done, true); 43 assert.sameValue(x, 4); 44 45 reportCompare(0, 0);