-
Notifications
You must be signed in to change notification settings - Fork 473
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add cases for Optional Expressions as DestructuringAssignmentTarget #2270
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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] | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ☝️ does I think I would have assumed that this was an
|
||
//- vals | ||
[23] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same question as above, probably me failing to read this production properly. |
||
//- vals | ||
[23] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 } |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what purpose does
[23]
serve here?