mirror of https://github.com/tc39/test262.git
Add cases for dstr assignment w/ inner edgy LHSExpressions
This commit is contained in:
parent
8893f7a684
commit
8e5820fce7
|
@ -0,0 +1,60 @@
|
||||||
|
// 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 activated initializer.
|
||||||
|
info: |
|
||||||
|
Syntax
|
||||||
|
|
||||||
|
AssignmentPattern : ArrayAssignmentPattern
|
||||||
|
ArrayAssignmentPattern : [ AssignmentElementList ]
|
||||||
|
AssignmentElementList : AssignmentElisionElement
|
||||||
|
AssignmentElisionElement : Elision_opt 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
|
||||||
|
ArrayAssignmentPattern : [ AssignmentElementList ]
|
||||||
|
|
||||||
|
1. Let iteratorRecord be ? GetIterator(value).
|
||||||
|
2. Let result be IteratorDestructuringAssignmentEvaluation of AssignmentElementList with argument iteratorRecord.
|
||||||
|
3. If iteratorRecord.[[Done]] is false, return ? IteratorClose(iteratorRecord, result).
|
||||||
|
4. Return result.
|
||||||
|
|
||||||
|
Runtime Semantics: IteratorDestructuringAssignmentEvaluation
|
||||||
|
AssignmentElement : DestructuringAssignmentTarget Initializer
|
||||||
|
|
||||||
|
1. If DestructuringAssignmentTarget is neither an ObjectLiteral nor an ArrayLiteral, then
|
||||||
|
a. Let lref be the result of evaluating DestructuringAssignmentTarget.
|
||||||
|
...
|
||||||
|
7. Return ? PutValue(lref, v).
|
||||||
|
template: default
|
||||||
|
---*/
|
||||||
|
|
||||||
|
//- setup
|
||||||
|
var x, setValue;
|
||||||
|
//- elems
|
||||||
|
[{
|
||||||
|
get y() {
|
||||||
|
throw new Test262Error('The property should not be accessed.');
|
||||||
|
},
|
||||||
|
set y(val) {
|
||||||
|
setValue = val;
|
||||||
|
}
|
||||||
|
}.y = 42]
|
||||||
|
//- vals
|
||||||
|
[undefined]
|
||||||
|
//- body
|
||||||
|
assert.sameValue(setValue, 42);
|
||||||
|
|
|
@ -0,0 +1,60 @@
|
||||||
|
// 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 : ArrayAssignmentPattern
|
||||||
|
ArrayAssignmentPattern : [ AssignmentElementList ]
|
||||||
|
AssignmentElementList : AssignmentElisionElement
|
||||||
|
AssignmentElisionElement : Elision_opt 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
|
||||||
|
ArrayAssignmentPattern : [ AssignmentElementList ]
|
||||||
|
|
||||||
|
1. Let iteratorRecord be ? GetIterator(value).
|
||||||
|
2. Let result be IteratorDestructuringAssignmentEvaluation of AssignmentElementList with argument iteratorRecord.
|
||||||
|
3. If iteratorRecord.[[Done]] is false, return ? IteratorClose(iteratorRecord, result).
|
||||||
|
4. Return result.
|
||||||
|
|
||||||
|
Runtime Semantics: IteratorDestructuringAssignmentEvaluation
|
||||||
|
AssignmentElement : DestructuringAssignmentTarget Initializer
|
||||||
|
|
||||||
|
1. If DestructuringAssignmentTarget is neither an ObjectLiteral nor an ArrayLiteral, then
|
||||||
|
a. Let lref be the result of evaluating DestructuringAssignmentTarget.
|
||||||
|
...
|
||||||
|
7. Return ? PutValue(lref, v).
|
||||||
|
template: default
|
||||||
|
---*/
|
||||||
|
|
||||||
|
//- setup
|
||||||
|
var x, setValue;
|
||||||
|
//- elems
|
||||||
|
[{
|
||||||
|
get y() {
|
||||||
|
throw new Test262Error('The property should not be accessed.');
|
||||||
|
},
|
||||||
|
set y(val) {
|
||||||
|
setValue = val;
|
||||||
|
}
|
||||||
|
}.y = 42]
|
||||||
|
//- vals
|
||||||
|
[23]
|
||||||
|
//- body
|
||||||
|
assert.sameValue(setValue, 23);
|
||||||
|
|
|
@ -0,0 +1,60 @@
|
||||||
|
// 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).
|
||||||
|
info: |
|
||||||
|
Syntax
|
||||||
|
|
||||||
|
AssignmentPattern : ArrayAssignmentPattern
|
||||||
|
ArrayAssignmentPattern : [ AssignmentElementList ]
|
||||||
|
AssignmentElementList : AssignmentElisionElement
|
||||||
|
AssignmentElisionElement : Elision_opt 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
|
||||||
|
ArrayAssignmentPattern : [ AssignmentElementList ]
|
||||||
|
|
||||||
|
1. Let iteratorRecord be ? GetIterator(value).
|
||||||
|
2. Let result be IteratorDestructuringAssignmentEvaluation of AssignmentElementList with argument iteratorRecord.
|
||||||
|
3. If iteratorRecord.[[Done]] is false, return ? IteratorClose(iteratorRecord, result).
|
||||||
|
4. Return result.
|
||||||
|
|
||||||
|
Runtime Semantics: IteratorDestructuringAssignmentEvaluation
|
||||||
|
AssignmentElement : DestructuringAssignmentTarget Initializer
|
||||||
|
|
||||||
|
1. If DestructuringAssignmentTarget is neither an ObjectLiteral nor an ArrayLiteral, then
|
||||||
|
a. Let lref be the result of evaluating DestructuringAssignmentTarget.
|
||||||
|
...
|
||||||
|
7. Return ? PutValue(lref, v).
|
||||||
|
template: default
|
||||||
|
---*/
|
||||||
|
|
||||||
|
//- setup
|
||||||
|
var x, setValue;
|
||||||
|
//- elems
|
||||||
|
[{
|
||||||
|
get y() {
|
||||||
|
throw new Test262Error('The property should not be accessed.');
|
||||||
|
},
|
||||||
|
set y(val) {
|
||||||
|
setValue = val;
|
||||||
|
}
|
||||||
|
}.y]
|
||||||
|
//- vals
|
||||||
|
[23]
|
||||||
|
//- body
|
||||||
|
assert.sameValue(setValue, 23);
|
||||||
|
|
|
@ -0,0 +1,68 @@
|
||||||
|
// 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 active 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: undefined}
|
||||||
|
//- body
|
||||||
|
assert.sameValue(setValue, 42);
|
||||||
|
|
|
@ -0,0 +1,68 @@
|
||||||
|
// 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);
|
||||||
|
|
|
@ -0,0 +1,68 @@
|
||||||
|
// 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).
|
||||||
|
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}
|
||||||
|
//- vals
|
||||||
|
{x: 23}
|
||||||
|
//- body
|
||||||
|
assert.sameValue(setValue, 23);
|
||||||
|
|
Loading…
Reference in New Issue