mirror of https://github.com/tc39/test262.git
Add cases with assignment patterns
This commit is contained in:
parent
eff2850ca3
commit
99656c6da5
|
@ -0,0 +1,38 @@
|
|||
// Copyright (C) 2019 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
path: language/expressions/arrow-function/dstr/syntax-error-ident-ref-
|
||||
name: IdentiferReference in ObjectAssignmentPattern (Arrow Function) cannot be a ReservedWord
|
||||
esid: prod-AssignmentPattern
|
||||
info: |
|
||||
AssignmentPattern:
|
||||
ObjectAssignmentPattern
|
||||
|
||||
ObjectAssignmentPattern:
|
||||
{ AssignmentPropertyList }
|
||||
|
||||
AssignmentPropertyList:
|
||||
AssignmentProperty
|
||||
AssignmentPropertyList , AssignmentProperty
|
||||
|
||||
AssignmentProperty:
|
||||
IdentifierReference Initializer_opt
|
||||
PropertyName : AssignmentElement
|
||||
|
||||
IdentifierReference:
|
||||
Identifier
|
||||
[~Yield]yield
|
||||
[~Await]await
|
||||
|
||||
Identifier:
|
||||
IdentifierName but not ReservedWord
|
||||
negative:
|
||||
phase: parse
|
||||
type: SyntaxError
|
||||
features: [arrow-function, destructuring-assignment]
|
||||
---*/
|
||||
|
||||
$DONOTEVALUATE();
|
||||
|
||||
var x = ({ /*{ declareWith }*/ }) => {};
|
|
@ -0,0 +1,38 @@
|
|||
// Copyright (C) 2019 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
path: language/expressions/assignment/dstr/syntax-error-ident-ref-
|
||||
name: IdentiferReference in ObjectAssignmentPattern cannot be a ReservedWord
|
||||
esid: prod-AssignmentPattern
|
||||
info: |
|
||||
AssignmentPattern:
|
||||
ObjectAssignmentPattern
|
||||
|
||||
ObjectAssignmentPattern:
|
||||
{ AssignmentPropertyList }
|
||||
|
||||
AssignmentPropertyList:
|
||||
AssignmentProperty
|
||||
AssignmentPropertyList , AssignmentProperty
|
||||
|
||||
AssignmentProperty:
|
||||
IdentifierReference Initializer_opt
|
||||
PropertyName : AssignmentElement
|
||||
|
||||
IdentifierReference:
|
||||
Identifier
|
||||
[~Yield]yield
|
||||
[~Await]await
|
||||
|
||||
Identifier:
|
||||
IdentifierName but not ReservedWord
|
||||
negative:
|
||||
phase: parse
|
||||
type: SyntaxError
|
||||
features: [destructuring-assignment]
|
||||
---*/
|
||||
|
||||
$DONOTEVALUATE();
|
||||
|
||||
var x = { /*{ declareWith }*/ } = { /*{ referenceWith }*/: 42 };
|
|
@ -19,7 +19,7 @@ info: |
|
|||
AssignmentProperty:
|
||||
IdentifierReference Initializer_opt
|
||||
PropertyName : AssignmentElement
|
||||
|
||||
|
||||
PropertyName:
|
||||
LiteralPropertyName
|
||||
...
|
||||
|
@ -29,10 +29,13 @@ info: |
|
|||
...
|
||||
|
||||
Reserved Words
|
||||
|
||||
|
||||
A reserved word is an IdentifierName that cannot be used as an Identifier.
|
||||
features: [destructuring-assignment]
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
0, { /*{ declareWith }*/: x } = { /*{ referenceWith }*/: 42 };
|
||||
var y = { /*{ declareWith }*/: x } = { /*{ referenceWith }*/: 42 };
|
||||
|
||||
assert.sameValue(x, 42, 'property exists');
|
||||
assert.sameValue(y['/*{ referenceWith }*/'], 42, 'assignment successful');
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
// Copyright (C) 2019 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
path: language/expressions/arrow-function/dstr/syntax-error-ident-ref-
|
||||
name: IdentiferReference in ObjectAssignmentPattern (Arrow Function) cannot be a ReservedWord
|
||||
esid: prod-AssignmentPattern
|
||||
info: |
|
||||
AssignmentPattern:
|
||||
ObjectAssignmentPattern
|
||||
|
||||
ObjectAssignmentPattern:
|
||||
{ AssignmentPropertyList }
|
||||
|
||||
AssignmentPropertyList:
|
||||
AssignmentProperty
|
||||
AssignmentPropertyList , AssignmentProperty
|
||||
|
||||
AssignmentProperty:
|
||||
IdentifierReference Initializer_opt
|
||||
PropertyName : AssignmentElement
|
||||
|
||||
IdentifierReference:
|
||||
Identifier
|
||||
[~Yield]yield
|
||||
[~Await]await
|
||||
|
||||
Identifier:
|
||||
IdentifierName but not ReservedWord
|
||||
negative:
|
||||
phase: parse
|
||||
type: SyntaxError
|
||||
features: [arrow-function, destructuring-assignment]
|
||||
flags: [onlyStrict]
|
||||
---*/
|
||||
|
||||
$DONOTEVALUATE();
|
||||
|
||||
var x = ({ /*{ declareWith }*/ }) => {};
|
|
@ -0,0 +1,44 @@
|
|||
// Copyright (C) 2019 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
path: language/expressions/class/ident-name-method-def-
|
||||
name: MethodDefinition
|
||||
esid: prod-PropertyDefinition
|
||||
info: |
|
||||
ObjectLiteral :
|
||||
{ PropertyDefinitionList }
|
||||
{ PropertyDefinitionList , }
|
||||
|
||||
PropertyDefinitionList:
|
||||
PropertyDefinition
|
||||
PropertyDefinitionList , PropertyDefinition
|
||||
|
||||
PropertyDefinition:
|
||||
MethodDefinition
|
||||
...
|
||||
|
||||
MethodDefinition:
|
||||
PropertyName ( UniqueFormalParameters ){ FunctionBody }
|
||||
|
||||
PropertyName:
|
||||
LiteralPropertyName
|
||||
...
|
||||
|
||||
LiteralPropertyName:
|
||||
IdentifierName
|
||||
...
|
||||
|
||||
Reserved Words
|
||||
|
||||
A reserved word is an IdentifierName that cannot be used as an Identifier.
|
||||
features: [class]
|
||||
---*/
|
||||
|
||||
var C = class {
|
||||
/*{ declareWith }*/() { return 42; }
|
||||
}
|
||||
|
||||
var obj = new C();
|
||||
|
||||
assert.sameValue(obj['/*{ referenceWith }*/'](), 42, 'property exists');
|
|
@ -0,0 +1,44 @@
|
|||
// Copyright (C) 2019 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
path: language/statements/class/ident-name-method-def-
|
||||
name: MethodDefinition
|
||||
esid: prod-PropertyDefinition
|
||||
info: |
|
||||
ObjectLiteral :
|
||||
{ PropertyDefinitionList }
|
||||
{ PropertyDefinitionList , }
|
||||
|
||||
PropertyDefinitionList:
|
||||
PropertyDefinition
|
||||
PropertyDefinitionList , PropertyDefinition
|
||||
|
||||
PropertyDefinition:
|
||||
MethodDefinition
|
||||
...
|
||||
|
||||
MethodDefinition:
|
||||
PropertyName ( UniqueFormalParameters ){ FunctionBody }
|
||||
|
||||
PropertyName:
|
||||
LiteralPropertyName
|
||||
...
|
||||
|
||||
LiteralPropertyName:
|
||||
IdentifierName
|
||||
...
|
||||
|
||||
Reserved Words
|
||||
|
||||
A reserved word is an IdentifierName that cannot be used as an Identifier.
|
||||
features: [class]
|
||||
---*/
|
||||
|
||||
class C {
|
||||
/*{ declareWith }*/() { return 42; }
|
||||
}
|
||||
|
||||
var obj = new C();
|
||||
|
||||
assert.sameValue(obj['/*{ referenceWith }*/'](), 42, 'property exists');
|
|
@ -0,0 +1,38 @@
|
|||
// Copyright (C) 2019 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
path: language/expressions/object/covered-ident-name-prop-name-literal-
|
||||
name: PropertyName in a CoverParenthesizedExpressionAndArrowParameterList
|
||||
esid: prod-PropertyDefinition
|
||||
info: |
|
||||
ObjectLiteral :
|
||||
{ PropertyDefinitionList }
|
||||
{ PropertyDefinitionList , }
|
||||
|
||||
PropertyDefinitionList:
|
||||
PropertyDefinition
|
||||
PropertyDefinitionList , PropertyDefinition
|
||||
|
||||
PropertyDefinition:
|
||||
IdentifierReference
|
||||
PropertyName : AssignmentExpression
|
||||
MethodDefinition
|
||||
... AssignmentExpression
|
||||
...
|
||||
|
||||
PropertyName:
|
||||
LiteralPropertyName
|
||||
...
|
||||
|
||||
LiteralPropertyName:
|
||||
IdentifierName
|
||||
...
|
||||
|
||||
Reserved Words
|
||||
|
||||
A reserved word is an IdentifierName that cannot be used as an Identifier.
|
||||
---*/
|
||||
|
||||
var obj = ({ /*{ declareWith }*/: 42 });
|
||||
|
||||
assert.sameValue(obj['/*{ referenceWith }*/'], 42, 'property exists');
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2019 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
path: language/expressions/assignment/member-expr-ident-name-
|
||||
name: MemberExpression IdentifierName
|
||||
esid: prod-PropertyDefinition
|
||||
info: |
|
||||
MemberExpression:
|
||||
...
|
||||
MemberExpression . IdentifierName
|
||||
|
||||
Reserved Words
|
||||
|
||||
A reserved word is an IdentifierName that cannot be used as an Identifier.
|
||||
---*/
|
||||
|
||||
var obj = {};
|
||||
|
||||
obj./*{ declareWith }*/ = 42;
|
||||
|
||||
assert.sameValue(obj['/*{ referenceWith }*/'], 42, 'property exists');
|
|
@ -0,0 +1,39 @@
|
|||
// Copyright (C) 2019 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
path: language/expressions/assignment/dstr/syntax-error-ident-ref-
|
||||
name: IdentiferReference in ObjectAssignmentPattern cannot be a ReservedWord
|
||||
esid: prod-AssignmentPattern
|
||||
info: |
|
||||
AssignmentPattern:
|
||||
ObjectAssignmentPattern
|
||||
|
||||
ObjectAssignmentPattern:
|
||||
{ AssignmentPropertyList }
|
||||
|
||||
AssignmentPropertyList:
|
||||
AssignmentProperty
|
||||
AssignmentPropertyList , AssignmentProperty
|
||||
|
||||
AssignmentProperty:
|
||||
IdentifierReference Initializer_opt
|
||||
PropertyName : AssignmentElement
|
||||
|
||||
IdentifierReference:
|
||||
Identifier
|
||||
[~Yield]yield
|
||||
[~Await]await
|
||||
|
||||
Identifier:
|
||||
IdentifierName but not ReservedWord
|
||||
negative:
|
||||
phase: parse
|
||||
type: SyntaxError
|
||||
flags: [onlyStrict]
|
||||
features: [destructuring-assignment]
|
||||
---*/
|
||||
|
||||
$DONOTEVALUATE();
|
||||
|
||||
var x = { /*{ declareWith }*/ } = { /*{ referenceWith }*/: 42 };
|
|
@ -0,0 +1,41 @@
|
|||
// Copyright (C) 2019 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
path: language/expressions/assignment/dstr/ident-name-prop-name-literal-
|
||||
name: PropertyName of an ObjectAssignmentPattern
|
||||
esid: prod-AssignmentPattern
|
||||
info: |
|
||||
AssignmentPattern:
|
||||
ObjectAssignmentPattern
|
||||
|
||||
ObjectAssignmentPattern:
|
||||
{ AssignmentPropertyList }
|
||||
|
||||
AssignmentPropertyList:
|
||||
AssignmentProperty
|
||||
AssignmentPropertyList , AssignmentProperty
|
||||
|
||||
AssignmentProperty:
|
||||
IdentifierReference Initializer_opt
|
||||
PropertyName : AssignmentElement
|
||||
|
||||
PropertyName:
|
||||
LiteralPropertyName
|
||||
...
|
||||
|
||||
LiteralPropertyName:
|
||||
IdentifierName
|
||||
...
|
||||
|
||||
Reserved Words
|
||||
|
||||
A reserved word is an IdentifierName that cannot be used as an Identifier.
|
||||
features: [destructuring-assignment]
|
||||
flags: [noStrict]
|
||||
---*/
|
||||
|
||||
var y = { /*{ declareWith }*/: x } = { /*{ referenceWith }*/: 42 };
|
||||
|
||||
assert.sameValue(x, 42, 'property exists');
|
||||
assert.sameValue(y['/*{ referenceWith }*/'], 42, 'assignment successful');
|
|
@ -0,0 +1,41 @@
|
|||
// Copyright (C) 2019 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
path: language/expressions/object/ident-name-method-def-
|
||||
name: MethodDefinition
|
||||
esid: prod-PropertyDefinition
|
||||
info: |
|
||||
ObjectLiteral :
|
||||
{ PropertyDefinitionList }
|
||||
{ PropertyDefinitionList , }
|
||||
|
||||
PropertyDefinitionList:
|
||||
PropertyDefinition
|
||||
PropertyDefinitionList , PropertyDefinition
|
||||
|
||||
PropertyDefinition:
|
||||
MethodDefinition
|
||||
...
|
||||
|
||||
MethodDefinition:
|
||||
PropertyName ( UniqueFormalParameters ){ FunctionBody }
|
||||
|
||||
PropertyName:
|
||||
LiteralPropertyName
|
||||
...
|
||||
|
||||
LiteralPropertyName:
|
||||
IdentifierName
|
||||
...
|
||||
|
||||
Reserved Words
|
||||
|
||||
A reserved word is an IdentifierName that cannot be used as an Identifier.
|
||||
---*/
|
||||
|
||||
var obj = {
|
||||
/*{ declareWith }*/() { return 42; }
|
||||
};
|
||||
|
||||
assert.sameValue(obj['/*{ referenceWith }*/'](), 42, 'property exists');
|
|
@ -0,0 +1,40 @@
|
|||
// Copyright (C) 2019 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
/*---
|
||||
path: language/expressions/object/ident-name-prop-name-literal-
|
||||
name: PropertyName
|
||||
esid: prod-PropertyDefinition
|
||||
info: |
|
||||
ObjectLiteral :
|
||||
{ PropertyDefinitionList }
|
||||
{ PropertyDefinitionList , }
|
||||
|
||||
PropertyDefinitionList:
|
||||
PropertyDefinition
|
||||
PropertyDefinitionList , PropertyDefinition
|
||||
|
||||
PropertyDefinition:
|
||||
IdentifierReference
|
||||
PropertyName : AssignmentExpression
|
||||
MethodDefinition
|
||||
... AssignmentExpression
|
||||
...
|
||||
|
||||
PropertyName:
|
||||
LiteralPropertyName
|
||||
...
|
||||
|
||||
LiteralPropertyName:
|
||||
IdentifierName
|
||||
...
|
||||
|
||||
Reserved Words
|
||||
|
||||
A reserved word is an IdentifierName that cannot be used as an Identifier.
|
||||
---*/
|
||||
|
||||
var obj = {
|
||||
/*{ declareWith }*/: 42
|
||||
};
|
||||
|
||||
assert.sameValue(obj['/*{ referenceWith }*/'], 42, 'property exists');
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
/*---
|
||||
desc: implements is a valid identifier name, using escape
|
||||
template: default
|
||||
template: future-reserved-words
|
||||
---*/
|
||||
|
||||
//- declareWith
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
// Copyright (C) 2019 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
desc: instance is a valid identifier name, using escape
|
||||
template: default
|
||||
---*/
|
||||
|
||||
//- declareWith
|
||||
\u0069nstance
|
||||
//- referenceWith
|
||||
instance
|
|
@ -2,11 +2,11 @@
|
|||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
desc: await is a valid identifier name, using escape
|
||||
desc: instanceof is a valid identifier name, using escape
|
||||
template: default
|
||||
---*/
|
||||
|
||||
//- declareWith
|
||||
\u0061wait
|
||||
\u0069nstanceof
|
||||
//- referenceWith
|
||||
await
|
||||
instanceof
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
/*---
|
||||
desc: interface is a valid identifier name, using escape
|
||||
template: default
|
||||
template: future-reserved-words
|
||||
---*/
|
||||
|
||||
//- declareWith
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
/*---
|
||||
desc: let is a valid identifier name, using escape
|
||||
template: default
|
||||
template: future-reserved-words
|
||||
---*/
|
||||
|
||||
//- declareWith
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
/*---
|
||||
desc: package is a valid identifier name, using escape
|
||||
template: default
|
||||
template: future-reserved-words
|
||||
---*/
|
||||
|
||||
//- declareWith
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
/*---
|
||||
desc: private is a valid identifier name, using escape
|
||||
template: default
|
||||
template: future-reserved-words
|
||||
---*/
|
||||
|
||||
//- declareWith
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
/*---
|
||||
desc: protected is a valid identifier name, using escape
|
||||
template: default
|
||||
template: future-reserved-words
|
||||
---*/
|
||||
|
||||
//- declareWith
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
/*---
|
||||
desc: public is a valid identifier name, using escape
|
||||
template: default
|
||||
template: future-reserved-words
|
||||
---*/
|
||||
|
||||
//- declareWith
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
/*---
|
||||
desc: static is a valid identifier name, using escape
|
||||
template: default
|
||||
template: future-reserved-words
|
||||
---*/
|
||||
|
||||
//- declareWith
|
||||
|
|
|
@ -7,6 +7,6 @@ template: default
|
|||
---*/
|
||||
|
||||
//- declareWith
|
||||
s\u0065per
|
||||
sup\u0065r
|
||||
//- referenceWith
|
||||
super
|
||||
|
|
|
@ -7,6 +7,6 @@ template: default
|
|||
---*/
|
||||
|
||||
//- declareWith
|
||||
t\u0068peof
|
||||
typ\u0065of
|
||||
//- referenceWith
|
||||
typeof
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
// Copyright (C) 2019 Leo Balter. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
desc: yield is a valid identifier name, using escape
|
||||
template: default
|
||||
---*/
|
||||
|
||||
//- declareWith
|
||||
y\u0069eld
|
||||
//- referenceWith
|
||||
yield
|
Loading…
Reference in New Issue