| 1 |
// This file was procedurally generated from the following sources: |
| 2 |
// - src/dstr-assignment/array-elem-put-obj-literal-prop-ref-init-active.case |
| 3 |
// - src/dstr-assignment/default/assignment-expr.template |
| 4 |
/*--- |
| 5 |
description: The DestructuringAssignmentTarget of an AssignmentElement can extend to LHSExpressions if it is neither an ObjectLiteral nor an ArrayLiteral and its AssignmentTargetTyp is simple. Using MemberExpression (ObjLiteral + identifier) with activated initializer. (AssignmentExpression) |
| 6 |
esid: sec-variable-statement-runtime-semantics-evaluation |
| 7 |
features: [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 |
Syntax |
| 19 |
|
| 20 |
AssignmentPattern : ArrayAssignmentPattern |
| 21 |
ArrayAssignmentPattern : [ AssignmentElementList ] |
| 22 |
AssignmentElementList : AssignmentElisionElement |
| 23 |
AssignmentElisionElement : Elision_opt AssignmentElement |
| 24 |
AssignmentElement : DestructuringAssignmentTarget Initializer_opt |
| 25 |
DestructuringAssignmentTarget : LeftHandSideExpression |
| 26 |
|
| 27 |
Static Semantics: Early Errors |
| 28 |
|
| 29 |
DestructuringAssignmentTarget : LeftHandSideExpression |
| 30 |
|
| 31 |
- It is a Syntax Error if LeftHandSideExpression is either an ObjectLiteral or an ArrayLiteral and if LeftHandSideExpression is not covering an AssignmentPattern. |
| 32 |
- It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and AssignmentTargetType(LeftHandSideExpression) is not simple. |
| 33 |
|
| 34 |
Runtime Semantics: DestructuringAssignmentEvaluation |
| 35 |
ArrayAssignmentPattern : [ AssignmentElementList ] |
| 36 |
|
| 37 |
1. Let iteratorRecord be ? GetIterator(value). |
| 38 |
2. Let result be IteratorDestructuringAssignmentEvaluation of AssignmentElementList with argument iteratorRecord. |
| 39 |
3. If iteratorRecord.[[Done]] is false, return ? IteratorClose(iteratorRecord, result). |
| 40 |
4. Return result. |
| 41 |
|
| 42 |
Runtime Semantics: IteratorDestructuringAssignmentEvaluation |
| 43 |
AssignmentElement : DestructuringAssignmentTarget Initializer |
| 44 |
|
| 45 |
1. If DestructuringAssignmentTarget is neither an ObjectLiteral nor an ArrayLiteral, then |
| 46 |
a. Let lref be the result of evaluating DestructuringAssignmentTarget. |
| 47 |
... |
| 48 |
7. Return ? PutValue(lref, v). |
| 49 |
|
| 50 |
---*/ |
| 51 |
var x, setValue; |
| 52 |
|
| 53 |
var result; |
| 54 |
var vals = [undefined]; |
| 55 |
|
| 56 |
result = [{ |
| 57 |
get y() { |
| 58 |
throw new Test262Error('The property should not be accessed.'); |
| 59 |
}, |
| 60 |
set y(val) { |
| 61 |
setValue = val; |
| 62 |
} |
| 63 |
}.y = 42] = vals; |
| 64 |
|
| 65 |
assert.sameValue(setValue, 42); |
| 66 |
|
| 67 |
|
| 68 |
assert.sameValue(result, vals); |
| 69 |
|
| 70 |
reportCompare(0, 0); |