mirror of
https://github.com/tc39/test262.git
synced 2025-11-13 18:29:44 +01:00
69 lines
2.4 KiB
Plaintext
69 lines
2.4 KiB
Plaintext
// Copyright (C) 2019 Leo Balter. All rights reserved.
|
|
// This code is governed by the BSD license found in the LICENSE file.
|
|
|
|
/*---
|
|
esid: prod-DestructuringAssignmentTarget
|
|
desc: >
|
|
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 initializer.
|
|
info: |
|
|
Syntax
|
|
|
|
AssignmentPattern : ObjectAssignmentPattern
|
|
ObjectAssignmentPattern : { AssignmentPropertyList }
|
|
AssignmentPropertyList : AssignmentProperty
|
|
AssignmentProperty : PropertyName : AssignmentElement
|
|
AssignmentElement : DestructuringAssignmentTarget Initializer_opt
|
|
DestructuringAssignmentTarget : LeftHandSideExpression
|
|
|
|
Static Semantics: Early Errors
|
|
|
|
DestructuringAssignmentTarget : LeftHandSideExpression
|
|
|
|
- It is a Syntax Error if LeftHandSideExpression is either an ObjectLiteral or an ArrayLiteral and if LeftHandSideExpression is not covering an AssignmentPattern.
|
|
- It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and AssignmentTargetType(LeftHandSideExpression) is not simple.
|
|
|
|
Runtime Semantics: DestructuringAssignmentEvaluation
|
|
ObjectAssignmentPattern : { AssignmentPropertyList }
|
|
|
|
1. Perform ? RequireObjectCoercible(value).
|
|
2. Perform ? PropertyDestructuringAssignmentEvaluation for AssignmentPropertyList using value as the argument.
|
|
3. Return NormalCompletion(empty).
|
|
|
|
Runtime Semantics: PropertyDestructuringAssignmentEvaluation
|
|
|
|
AssignmentProperty : PropertyName : AssignmentElement
|
|
|
|
1. Let name be the result of evaluating PropertyName.
|
|
2. ReturnIfAbrupt(name).
|
|
3. Perform ? KeyedDestructuringAssignmentEvaluation of AssignmentElement with value and name as the arguments.
|
|
4. Return a new List containing name.
|
|
|
|
Runtime Semantics: KeyedDestructuringAssignmentEvaluation
|
|
|
|
AssignmentElement : DestructuringAssignmentTarget Initializer
|
|
|
|
1. If DestructuringAssignmentTarget is neither an ObjectLiteral nor an ArrayLiteral, then
|
|
a. Let lref be the result of evaluating DestructuringAssignmentTarget.
|
|
...
|
|
template: default
|
|
---*/
|
|
|
|
//- setup
|
|
var setValue;
|
|
//- elems
|
|
{ x: {
|
|
get y() {
|
|
throw new Test262Error('The property should not be accessed.');
|
|
},
|
|
set y(val) {
|
|
setValue = val;
|
|
}
|
|
}.y = 42}
|
|
//- vals
|
|
{x: 23}
|
|
//- body
|
|
assert.sameValue(setValue, 23);
|
|
|