| 1 |
// This file was procedurally generated from the following sources: |
| 2 |
// - src/dstr-assignment/obj-prop-elem-target-obj-literal-prop-ref.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). (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 : ObjectAssignmentPattern |
| 21 |
ObjectAssignmentPattern : { AssignmentPropertyList } |
| 22 |
AssignmentPropertyList : AssignmentProperty |
| 23 |
AssignmentProperty : PropertyName : 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 |
ObjectAssignmentPattern : { AssignmentPropertyList } |
| 36 |
|
| 37 |
1. Perform ? RequireObjectCoercible(value). |
| 38 |
2. Perform ? PropertyDestructuringAssignmentEvaluation for AssignmentPropertyList using value as the argument. |
| 39 |
3. Return NormalCompletion(empty). |
| 40 |
|
| 41 |
Runtime Semantics: PropertyDestructuringAssignmentEvaluation |
| 42 |
|
| 43 |
AssignmentProperty : PropertyName : AssignmentElement |
| 44 |
|
| 45 |
1. Let name be the result of evaluating PropertyName. |
| 46 |
2. ReturnIfAbrupt(name). |
| 47 |
3. Perform ? KeyedDestructuringAssignmentEvaluation of AssignmentElement with value and name as the arguments. |
| 48 |
4. Return a new List containing name. |
| 49 |
|
| 50 |
Runtime Semantics: KeyedDestructuringAssignmentEvaluation |
| 51 |
|
| 52 |
AssignmentElement : DestructuringAssignmentTarget Initializer |
| 53 |
|
| 54 |
1. If DestructuringAssignmentTarget is neither an ObjectLiteral nor an ArrayLiteral, then |
| 55 |
a. Let lref be the result of evaluating DestructuringAssignmentTarget. |
| 56 |
... |
| 57 |
|
| 58 |
---*/ |
| 59 |
var setValue; |
| 60 |
|
| 61 |
var result; |
| 62 |
var vals = {x: 23}; |
| 63 |
|
| 64 |
result = { x: { |
| 65 |
get y() { |
| 66 |
throw new Test262Error('The property should not be accessed.'); |
| 67 |
}, |
| 68 |
set y(val) { |
| 69 |
setValue = val; |
| 70 |
} |
| 71 |
}.y} = vals; |
| 72 |
|
| 73 |
assert.sameValue(setValue, 23); |
| 74 |
|
| 75 |
|
| 76 |
assert.sameValue(result, vals); |
| 77 |
|
| 78 |
reportCompare(0, 0); |