diff --git a/src/identifier-names/default/arrow-fn-assignment-identifier.template b/src/identifier-names/default/arrow-fn-assignment-identifier.template new file mode 100644 index 0000000000..b08b6ac605 --- /dev/null +++ b/src/identifier-names/default/arrow-fn-assignment-identifier.template @@ -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 }*/ }) => {}; diff --git a/src/identifier-names/default/obj-assignment-identifier.template b/src/identifier-names/default/obj-assignment-identifier.template new file mode 100644 index 0000000000..5bea8fd50f --- /dev/null +++ b/src/identifier-names/default/obj-assignment-identifier.template @@ -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 }; diff --git a/src/identifier-names/default/obj-assignment-prop-name.template b/src/identifier-names/default/obj-assignment-prop-name.template index 19ec8b0ddc..048c2585ac 100644 --- a/src/identifier-names/default/obj-assignment-prop-name.template +++ b/src/identifier-names/default/obj-assignment-prop-name.template @@ -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'); diff --git a/src/identifier-names/future-reserved-words/arrow-fn-assignment-identifier.template b/src/identifier-names/future-reserved-words/arrow-fn-assignment-identifier.template new file mode 100644 index 0000000000..f4970c7446 --- /dev/null +++ b/src/identifier-names/future-reserved-words/arrow-fn-assignment-identifier.template @@ -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 }*/ }) => {}; diff --git a/src/identifier-names/future-reserved-words/class-expression-method-def.template b/src/identifier-names/future-reserved-words/class-expression-method-def.template new file mode 100644 index 0000000000..f14c1b0b59 --- /dev/null +++ b/src/identifier-names/future-reserved-words/class-expression-method-def.template @@ -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'); diff --git a/src/identifier-names/future-reserved-words/class-statement-method-def.template b/src/identifier-names/future-reserved-words/class-statement-method-def.template new file mode 100644 index 0000000000..7d00fa309b --- /dev/null +++ b/src/identifier-names/future-reserved-words/class-statement-method-def.template @@ -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'); diff --git a/src/identifier-names/future-reserved-words/covered-obj-prop-name.template b/src/identifier-names/future-reserved-words/covered-obj-prop-name.template new file mode 100644 index 0000000000..4a47dd61b9 --- /dev/null +++ b/src/identifier-names/future-reserved-words/covered-obj-prop-name.template @@ -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'); diff --git a/src/identifier-names/future-reserved-words/member-expr.template b/src/identifier-names/future-reserved-words/member-expr.template new file mode 100644 index 0000000000..fa15c0a785 --- /dev/null +++ b/src/identifier-names/future-reserved-words/member-expr.template @@ -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'); diff --git a/src/identifier-names/future-reserved-words/obj-assignment-identifier.template b/src/identifier-names/future-reserved-words/obj-assignment-identifier.template new file mode 100644 index 0000000000..574763c167 --- /dev/null +++ b/src/identifier-names/future-reserved-words/obj-assignment-identifier.template @@ -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 }; diff --git a/src/identifier-names/future-reserved-words/obj-assignment-prop-name.template b/src/identifier-names/future-reserved-words/obj-assignment-prop-name.template new file mode 100644 index 0000000000..311e13e6a4 --- /dev/null +++ b/src/identifier-names/future-reserved-words/obj-assignment-prop-name.template @@ -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'); diff --git a/src/identifier-names/future-reserved-words/obj-method-definition.template b/src/identifier-names/future-reserved-words/obj-method-definition.template new file mode 100644 index 0000000000..ab2ec739d8 --- /dev/null +++ b/src/identifier-names/future-reserved-words/obj-method-definition.template @@ -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'); diff --git a/src/identifier-names/future-reserved-words/obj-prop-name.template b/src/identifier-names/future-reserved-words/obj-prop-name.template new file mode 100644 index 0000000000..02db39b0a6 --- /dev/null +++ b/src/identifier-names/future-reserved-words/obj-prop-name.template @@ -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'); diff --git a/src/identifier-names/implements-escaped.case b/src/identifier-names/implements-escaped.case index 3fd2360a6a..f32c4bd314 100644 --- a/src/identifier-names/implements-escaped.case +++ b/src/identifier-names/implements-escaped.case @@ -3,7 +3,7 @@ /*--- desc: implements is a valid identifier name, using escape -template: default +template: future-reserved-words ---*/ //- declareWith diff --git a/src/identifier-names/instance-escaped.case b/src/identifier-names/instance-escaped.case deleted file mode 100644 index 47482bfca1..0000000000 --- a/src/identifier-names/instance-escaped.case +++ /dev/null @@ -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 diff --git a/src/identifier-names/await-escaped.case b/src/identifier-names/instanceof-escaped.case similarity index 69% rename from src/identifier-names/await-escaped.case rename to src/identifier-names/instanceof-escaped.case index 82454ad045..a0eaa4f28c 100644 --- a/src/identifier-names/await-escaped.case +++ b/src/identifier-names/instanceof-escaped.case @@ -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 diff --git a/src/identifier-names/interface-escaped.case b/src/identifier-names/interface-escaped.case index d5d2ddd90c..4914309f1d 100644 --- a/src/identifier-names/interface-escaped.case +++ b/src/identifier-names/interface-escaped.case @@ -3,7 +3,7 @@ /*--- desc: interface is a valid identifier name, using escape -template: default +template: future-reserved-words ---*/ //- declareWith diff --git a/src/identifier-names/let-escaped.case b/src/identifier-names/let-escaped.case index 69d62f71c9..f8e7176e98 100644 --- a/src/identifier-names/let-escaped.case +++ b/src/identifier-names/let-escaped.case @@ -3,7 +3,7 @@ /*--- desc: let is a valid identifier name, using escape -template: default +template: future-reserved-words ---*/ //- declareWith diff --git a/src/identifier-names/package-escaped.case b/src/identifier-names/package-escaped.case index b15a980aec..0f8a5de442 100644 --- a/src/identifier-names/package-escaped.case +++ b/src/identifier-names/package-escaped.case @@ -3,7 +3,7 @@ /*--- desc: package is a valid identifier name, using escape -template: default +template: future-reserved-words ---*/ //- declareWith diff --git a/src/identifier-names/private-escaped.case b/src/identifier-names/private-escaped.case index 5f0c9af94d..47058cbe92 100644 --- a/src/identifier-names/private-escaped.case +++ b/src/identifier-names/private-escaped.case @@ -3,7 +3,7 @@ /*--- desc: private is a valid identifier name, using escape -template: default +template: future-reserved-words ---*/ //- declareWith diff --git a/src/identifier-names/protected-escaped.case b/src/identifier-names/protected-escaped.case index 420c439643..e73898f389 100644 --- a/src/identifier-names/protected-escaped.case +++ b/src/identifier-names/protected-escaped.case @@ -3,7 +3,7 @@ /*--- desc: protected is a valid identifier name, using escape -template: default +template: future-reserved-words ---*/ //- declareWith diff --git a/src/identifier-names/public-escaped.case b/src/identifier-names/public-escaped.case index f3d6250a36..1b53c95b0a 100644 --- a/src/identifier-names/public-escaped.case +++ b/src/identifier-names/public-escaped.case @@ -3,7 +3,7 @@ /*--- desc: public is a valid identifier name, using escape -template: default +template: future-reserved-words ---*/ //- declareWith diff --git a/src/identifier-names/static-escaped.case b/src/identifier-names/static-escaped.case index bac1f7e03e..c4ffd3c9dc 100644 --- a/src/identifier-names/static-escaped.case +++ b/src/identifier-names/static-escaped.case @@ -3,7 +3,7 @@ /*--- desc: static is a valid identifier name, using escape -template: default +template: future-reserved-words ---*/ //- declareWith diff --git a/src/identifier-names/super-escaped.case b/src/identifier-names/super-escaped.case index 7463f1940b..4a7d7a8b07 100644 --- a/src/identifier-names/super-escaped.case +++ b/src/identifier-names/super-escaped.case @@ -7,6 +7,6 @@ template: default ---*/ //- declareWith -s\u0065per +sup\u0065r //- referenceWith super diff --git a/src/identifier-names/typeof-escaped.case b/src/identifier-names/typeof-escaped.case index ad0661e69f..2e925fb4e3 100644 --- a/src/identifier-names/typeof-escaped.case +++ b/src/identifier-names/typeof-escaped.case @@ -7,6 +7,6 @@ template: default ---*/ //- declareWith -t\u0068peof +typ\u0065of //- referenceWith typeof diff --git a/src/identifier-names/yield-escaped.case b/src/identifier-names/yield-escaped.case deleted file mode 100644 index f3f6ad54ce..0000000000 --- a/src/identifier-names/yield-escaped.case +++ /dev/null @@ -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