mirror of https://github.com/tc39/test262.git
Add cases for Optional Expressions as DestructuringAssignmentTarget
This commit is contained in:
parent
ff9763729d
commit
29627e892b
|
@ -133,6 +133,10 @@ import.meta
|
|||
WeakRef
|
||||
FinalizationGroup
|
||||
|
||||
# Optional Chaining
|
||||
# https://github.com/tc39/proposal-optional-chaining
|
||||
optional-chaining
|
||||
|
||||
## Standard language features
|
||||
#
|
||||
# Language features that have been included in a published version of the
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
// 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: >
|
||||
It is a Syntax Error if LeftHandSideExpression of an DestructuringAssignmentTarget is neither an
|
||||
ObjectLiteral nor an ArrayLiteral and AssignmentTargetType(LeftHandSideExpression) is not simple
|
||||
Using Object
|
||||
(MemberExpression OptionalChain .IdentifierName Initializer)
|
||||
info: |
|
||||
Syntax
|
||||
|
||||
AssignmentElement : DestructuringAssignmentTarget Initializer_opt
|
||||
DestructuringAssignmentTarget : LeftHandSideExpression
|
||||
|
||||
Static Semantics: Early Errors
|
||||
|
||||
OptionalExpression:
|
||||
MemberExpression OptionalChain
|
||||
CallExpression OptionalChain
|
||||
OptionalExpression OptionalChain
|
||||
|
||||
OptionalChain:
|
||||
?. [ Expression ]
|
||||
?. IdentifierName
|
||||
?. Arguments
|
||||
?. TemplateLiteral
|
||||
OptionalChain [ Expression ]
|
||||
OptionalChain .IdentifierName
|
||||
OptionalChain Arguments
|
||||
OptionalChain TemplateLiteral
|
||||
|
||||
DestructuringAssignmentTarget : LeftHandSideExpression
|
||||
|
||||
- It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and IsValidSimpleAssignmentTarget(LeftHandSideExpression) is not true.
|
||||
|
||||
Static Semantics: IsValidSimpleAssignmentTarget
|
||||
|
||||
LeftHandSideExpression : OptionalExpression
|
||||
1. Return false.
|
||||
features: [optional-chaining]
|
||||
template: syntax
|
||||
negative:
|
||||
phase: parse
|
||||
type: SyntaxError
|
||||
---*/
|
||||
|
||||
//- setup
|
||||
$DONOTEVALUATE();
|
||||
var x = {};
|
||||
//- elems
|
||||
[x?.y = 42]
|
||||
//- vals
|
||||
[23]
|
|
@ -0,0 +1,55 @@
|
|||
// 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: >
|
||||
It is a Syntax Error if LeftHandSideExpression of an DestructuringAssignmentTarget is neither an
|
||||
ObjectLiteral nor an ArrayLiteral and AssignmentTargetType(LeftHandSideExpression) is not simple
|
||||
Using Object
|
||||
(MemberExpression OptionalChain .IdentifierName)
|
||||
info: |
|
||||
Syntax
|
||||
|
||||
AssignmentElement : DestructuringAssignmentTarget Initializer_opt
|
||||
DestructuringAssignmentTarget : LeftHandSideExpression
|
||||
|
||||
Static Semantics: Early Errors
|
||||
|
||||
OptionalExpression:
|
||||
MemberExpression OptionalChain
|
||||
CallExpression OptionalChain
|
||||
OptionalExpression OptionalChain
|
||||
|
||||
OptionalChain:
|
||||
?. [ Expression ]
|
||||
?. IdentifierName
|
||||
?. Arguments
|
||||
?. TemplateLiteral
|
||||
OptionalChain [ Expression ]
|
||||
OptionalChain .IdentifierName
|
||||
OptionalChain Arguments
|
||||
OptionalChain TemplateLiteral
|
||||
|
||||
DestructuringAssignmentTarget : LeftHandSideExpression
|
||||
|
||||
- It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and IsValidSimpleAssignmentTarget(LeftHandSideExpression) is not true.
|
||||
|
||||
Static Semantics: IsValidSimpleAssignmentTarget
|
||||
|
||||
LeftHandSideExpression : OptionalExpression
|
||||
1. Return false.
|
||||
features: [optional-chaining]
|
||||
template: syntax
|
||||
negative:
|
||||
phase: parse
|
||||
type: SyntaxError
|
||||
---*/
|
||||
|
||||
//- setup
|
||||
$DONOTEVALUATE();
|
||||
var x = {};
|
||||
//- elems
|
||||
[x?.y]
|
||||
//- vals
|
||||
[23]
|
|
@ -0,0 +1,57 @@
|
|||
// 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: >
|
||||
It is a Syntax Error if LeftHandSideExpression of an DestructuringAssignmentTarget is neither an
|
||||
ObjectLiteral nor an ArrayLiteral and AssignmentTargetType(LeftHandSideExpression) is not simple
|
||||
Using Object
|
||||
info: |
|
||||
Syntax
|
||||
|
||||
AssignmentElement : DestructuringAssignmentTarget Initializer_opt
|
||||
DestructuringAssignmentTarget : LeftHandSideExpression
|
||||
|
||||
Static Semantics: Early Errors
|
||||
|
||||
OptionalExpression:
|
||||
MemberExpression OptionalChain
|
||||
CallExpression OptionalChain
|
||||
OptionalExpression OptionalChain
|
||||
|
||||
OptionalChain:
|
||||
?. [ Expression ]
|
||||
?. IdentifierName
|
||||
?. Arguments
|
||||
?. TemplateLiteral
|
||||
OptionalChain [ Expression ]
|
||||
OptionalChain .IdentifierName
|
||||
OptionalChain Arguments
|
||||
OptionalChain TemplateLiteral
|
||||
|
||||
DestructuringAssignmentTarget : LeftHandSideExpression
|
||||
|
||||
- It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and IsValidSimpleAssignmentTarget(LeftHandSideExpression) is not true.
|
||||
|
||||
Static Semantics: IsValidSimpleAssignmentTarget
|
||||
|
||||
LeftHandSideExpression : OptionalExpression
|
||||
1. Return false.
|
||||
features: [optional-chaining]
|
||||
template: syntax
|
||||
negative:
|
||||
phase: parse
|
||||
type: SyntaxError
|
||||
---*/
|
||||
|
||||
//- setup
|
||||
$DONOTEVALUATE();
|
||||
//- elems
|
||||
[{
|
||||
set y(val) {
|
||||
throw new Test262Error('The property should not be accessed.');
|
||||
}
|
||||
}?.y = 42]
|
||||
//- vals
|
||||
[23]
|
|
@ -0,0 +1,57 @@
|
|||
// 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: >
|
||||
It is a Syntax Error if LeftHandSideExpression of an DestructuringAssignmentTarget is neither an
|
||||
ObjectLiteral nor an ArrayLiteral and AssignmentTargetType(LeftHandSideExpression) is not simple
|
||||
Using Object
|
||||
info: |
|
||||
Syntax
|
||||
|
||||
AssignmentElement : DestructuringAssignmentTarget Initializer_opt
|
||||
DestructuringAssignmentTarget : LeftHandSideExpression
|
||||
|
||||
Static Semantics: Early Errors
|
||||
|
||||
OptionalExpression:
|
||||
MemberExpression OptionalChain
|
||||
CallExpression OptionalChain
|
||||
OptionalExpression OptionalChain
|
||||
|
||||
OptionalChain:
|
||||
?. [ Expression ]
|
||||
?. IdentifierName
|
||||
?. Arguments
|
||||
?. TemplateLiteral
|
||||
OptionalChain [ Expression ]
|
||||
OptionalChain .IdentifierName
|
||||
OptionalChain Arguments
|
||||
OptionalChain TemplateLiteral
|
||||
|
||||
DestructuringAssignmentTarget : LeftHandSideExpression
|
||||
|
||||
- It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and IsValidSimpleAssignmentTarget(LeftHandSideExpression) is not true.
|
||||
|
||||
Static Semantics: IsValidSimpleAssignmentTarget
|
||||
|
||||
LeftHandSideExpression : OptionalExpression
|
||||
1. Return false.
|
||||
features: [optional-chaining]
|
||||
template: syntax
|
||||
negative:
|
||||
phase: parse
|
||||
type: SyntaxError
|
||||
---*/
|
||||
|
||||
//- setup
|
||||
$DONOTEVALUATE();
|
||||
//- elems
|
||||
[{
|
||||
set y(val) {
|
||||
throw new Test262Error('The property should not be accessed.');
|
||||
}
|
||||
}?.y]
|
||||
//- vals
|
||||
[23]
|
|
@ -0,0 +1,55 @@
|
|||
// 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: >
|
||||
It is a Syntax Error if LeftHandSideExpression of an DestructuringAssignmentTarget is neither an
|
||||
ObjectLiteral nor an ArrayLiteral and AssignmentTargetType(LeftHandSideExpression) is not simple
|
||||
Using Object
|
||||
(MemberExpression OptionalChain .IdentifierName Initializer)
|
||||
info: |
|
||||
Syntax
|
||||
|
||||
AssignmentElement : DestructuringAssignmentTarget Initializer_opt
|
||||
DestructuringAssignmentTarget : LeftHandSideExpression
|
||||
|
||||
Static Semantics: Early Errors
|
||||
|
||||
OptionalExpression:
|
||||
MemberExpression OptionalChain
|
||||
CallExpression OptionalChain
|
||||
OptionalExpression OptionalChain
|
||||
|
||||
OptionalChain:
|
||||
?. [ Expression ]
|
||||
?. IdentifierName
|
||||
?. Arguments
|
||||
?. TemplateLiteral
|
||||
OptionalChain [ Expression ]
|
||||
OptionalChain .IdentifierName
|
||||
OptionalChain Arguments
|
||||
OptionalChain TemplateLiteral
|
||||
|
||||
DestructuringAssignmentTarget : LeftHandSideExpression
|
||||
|
||||
- It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and IsValidSimpleAssignmentTarget(LeftHandSideExpression) is not true.
|
||||
|
||||
Static Semantics: IsValidSimpleAssignmentTarget
|
||||
|
||||
LeftHandSideExpression : OptionalExpression
|
||||
1. Return false.
|
||||
features: [optional-chaining]
|
||||
template: syntax
|
||||
negative:
|
||||
phase: parse
|
||||
type: SyntaxError
|
||||
---*/
|
||||
|
||||
//- setup
|
||||
$DONOTEVALUATE();
|
||||
var y = {};
|
||||
//- elems
|
||||
{ x: y?.z = 42 }
|
||||
//- vals
|
||||
{ x: 23 }
|
|
@ -0,0 +1,55 @@
|
|||
// 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: >
|
||||
It is a Syntax Error if LeftHandSideExpression of an DestructuringAssignmentTarget is neither an
|
||||
ObjectLiteral nor an ArrayLiteral and AssignmentTargetType(LeftHandSideExpression) is not simple
|
||||
Using Object
|
||||
(MemberExpression OptionalChain .IdentifierName)
|
||||
info: |
|
||||
Syntax
|
||||
|
||||
AssignmentElement : DestructuringAssignmentTarget Initializer_opt
|
||||
DestructuringAssignmentTarget : LeftHandSideExpression
|
||||
|
||||
Static Semantics: Early Errors
|
||||
|
||||
OptionalExpression:
|
||||
MemberExpression OptionalChain
|
||||
CallExpression OptionalChain
|
||||
OptionalExpression OptionalChain
|
||||
|
||||
OptionalChain:
|
||||
?. [ Expression ]
|
||||
?. IdentifierName
|
||||
?. Arguments
|
||||
?. TemplateLiteral
|
||||
OptionalChain [ Expression ]
|
||||
OptionalChain .IdentifierName
|
||||
OptionalChain Arguments
|
||||
OptionalChain TemplateLiteral
|
||||
|
||||
DestructuringAssignmentTarget : LeftHandSideExpression
|
||||
|
||||
- It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and IsValidSimpleAssignmentTarget(LeftHandSideExpression) is not true.
|
||||
|
||||
Static Semantics: IsValidSimpleAssignmentTarget
|
||||
|
||||
LeftHandSideExpression : OptionalExpression
|
||||
1. Return false.
|
||||
features: [optional-chaining]
|
||||
template: syntax
|
||||
negative:
|
||||
phase: parse
|
||||
type: SyntaxError
|
||||
---*/
|
||||
|
||||
//- setup
|
||||
$DONOTEVALUATE();
|
||||
var y = {};
|
||||
//- elems
|
||||
{ x: y?.z }
|
||||
//- vals
|
||||
{ x: 23 }
|
|
@ -0,0 +1,57 @@
|
|||
// 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: >
|
||||
It is a Syntax Error if LeftHandSideExpression of an DestructuringAssignmentTarget is neither an
|
||||
ObjectLiteral nor an ArrayLiteral and AssignmentTargetType(LeftHandSideExpression) is not simple
|
||||
Using Object
|
||||
info: |
|
||||
Syntax
|
||||
|
||||
AssignmentElement : DestructuringAssignmentTarget Initializer_opt
|
||||
DestructuringAssignmentTarget : LeftHandSideExpression
|
||||
|
||||
Static Semantics: Early Errors
|
||||
|
||||
OptionalExpression:
|
||||
MemberExpression OptionalChain
|
||||
CallExpression OptionalChain
|
||||
OptionalExpression OptionalChain
|
||||
|
||||
OptionalChain:
|
||||
?. [ Expression ]
|
||||
?. IdentifierName
|
||||
?. Arguments
|
||||
?. TemplateLiteral
|
||||
OptionalChain [ Expression ]
|
||||
OptionalChain .IdentifierName
|
||||
OptionalChain Arguments
|
||||
OptionalChain TemplateLiteral
|
||||
|
||||
DestructuringAssignmentTarget : LeftHandSideExpression
|
||||
|
||||
- It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and IsValidSimpleAssignmentTarget(LeftHandSideExpression) is not true.
|
||||
|
||||
Static Semantics: IsValidSimpleAssignmentTarget
|
||||
|
||||
LeftHandSideExpression : OptionalExpression
|
||||
1. Return false.
|
||||
features: [optional-chaining]
|
||||
template: syntax
|
||||
negative:
|
||||
phase: parse
|
||||
type: SyntaxError
|
||||
---*/
|
||||
|
||||
//- setup
|
||||
$DONOTEVALUATE();
|
||||
//- elems
|
||||
{ x: {
|
||||
set y(val) {
|
||||
throw new Test262Error('The property should not be accessed.');
|
||||
}
|
||||
}?.y = 42}
|
||||
//- vals
|
||||
{x: 42}
|
|
@ -0,0 +1,57 @@
|
|||
// 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: >
|
||||
It is a Syntax Error if LeftHandSideExpression of an DestructuringAssignmentTarget is neither an
|
||||
ObjectLiteral nor an ArrayLiteral and AssignmentTargetType(LeftHandSideExpression) is not simple
|
||||
Using Object
|
||||
info: |
|
||||
Syntax
|
||||
|
||||
AssignmentElement : DestructuringAssignmentTarget Initializer_opt
|
||||
DestructuringAssignmentTarget : LeftHandSideExpression
|
||||
|
||||
Static Semantics: Early Errors
|
||||
|
||||
OptionalExpression:
|
||||
MemberExpression OptionalChain
|
||||
CallExpression OptionalChain
|
||||
OptionalExpression OptionalChain
|
||||
|
||||
OptionalChain:
|
||||
?. [ Expression ]
|
||||
?. IdentifierName
|
||||
?. Arguments
|
||||
?. TemplateLiteral
|
||||
OptionalChain [ Expression ]
|
||||
OptionalChain .IdentifierName
|
||||
OptionalChain Arguments
|
||||
OptionalChain TemplateLiteral
|
||||
|
||||
DestructuringAssignmentTarget : LeftHandSideExpression
|
||||
|
||||
- It is a Syntax Error if LeftHandSideExpression is neither an ObjectLiteral nor an ArrayLiteral and IsValidSimpleAssignmentTarget(LeftHandSideExpression) is not true.
|
||||
|
||||
Static Semantics: IsValidSimpleAssignmentTarget
|
||||
|
||||
LeftHandSideExpression : OptionalExpression
|
||||
1. Return false.
|
||||
features: [optional-chaining]
|
||||
template: syntax
|
||||
negative:
|
||||
phase: parse
|
||||
type: SyntaxError
|
||||
---*/
|
||||
|
||||
//- setup
|
||||
$DONOTEVALUATE();
|
||||
//- elems
|
||||
{ x: {
|
||||
set y(val) {
|
||||
throw new Test262Error('The property should not be accessed.');
|
||||
}
|
||||
}?.y}
|
||||
//- vals
|
||||
{x: 42}
|
Loading…
Reference in New Issue