From 3996741ca0dff3875e08c8f524d605f0be8d43c6 Mon Sep 17 00:00:00 2001 From: Rick Waldron Date: Mon, 30 Jul 2018 18:10:35 -0400 Subject: [PATCH] Class Fields: Remove templates that cause erroneous tests to be created. --- src/class-fields/propname-constructor.case | 18 -------- .../cls-decl-computed-name.template | 23 ---------- .../cls-decl-literal-name.template | 21 --------- .../cls-decl-string-name.template | 22 --------- .../cls-decl-variable-name.template | 22 --------- .../cls-expr-computed-name.template | 23 ---------- .../cls-expr-literal-name.template | 21 --------- .../cls-expr-string-name.template | 22 --------- .../cls-expr-variable-name.template | 22 --------- .../static-propname-constructor.case | 20 --------- .../static-propname-prototype.case | 20 --------- ...c-comp-name-init-err-contains-arguments.js | 35 +++++++++++++++ ...tatic-comp-name-init-err-contains-super.js | 28 ++++++++++++ ...tic-literal-init-err-contains-arguments.js | 34 ++++++++++++++ ...-static-literal-init-err-contains-super.js | 27 +++++++++++ ...tic-private-init-err-contains-arguments.js | 34 ++++++++++++++ ...-static-private-init-err-contains-super.js | 27 +++++++++++ .../class/fields-static-private-names.js | 45 +++++++++++++++++++ ...iteral-name-init-err-contains-arguments.js | 34 ++++++++++++++ ...ng-literal-name-init-err-contains-super.js | 27 +++++++++++ ...string-name-static-propname-constructor.js | 32 +++++++++++++ ...s-string-name-static-propname-prototype.js | 32 +++++++++++++ 22 files changed, 355 insertions(+), 234 deletions(-) delete mode 100644 src/class-fields/propname-constructor.case delete mode 100644 src/class-fields/propname-error/cls-decl-computed-name.template delete mode 100644 src/class-fields/propname-error/cls-decl-literal-name.template delete mode 100644 src/class-fields/propname-error/cls-decl-string-name.template delete mode 100644 src/class-fields/propname-error/cls-decl-variable-name.template delete mode 100644 src/class-fields/propname-error/cls-expr-computed-name.template delete mode 100644 src/class-fields/propname-error/cls-expr-literal-name.template delete mode 100644 src/class-fields/propname-error/cls-expr-string-name.template delete mode 100644 src/class-fields/propname-error/cls-expr-variable-name.template delete mode 100644 src/class-fields/static-propname-constructor.case delete mode 100644 src/class-fields/static-propname-prototype.case create mode 100644 test/language/statements/class/fields-static-comp-name-init-err-contains-arguments.js create mode 100644 test/language/statements/class/fields-static-comp-name-init-err-contains-super.js create mode 100644 test/language/statements/class/fields-static-literal-init-err-contains-arguments.js create mode 100644 test/language/statements/class/fields-static-literal-init-err-contains-super.js create mode 100644 test/language/statements/class/fields-static-private-init-err-contains-arguments.js create mode 100644 test/language/statements/class/fields-static-private-init-err-contains-super.js create mode 100644 test/language/statements/class/fields-static-private-names.js create mode 100644 test/language/statements/class/fields-static-string-literal-name-init-err-contains-arguments.js create mode 100644 test/language/statements/class/fields-static-string-literal-name-init-err-contains-super.js create mode 100644 test/language/statements/class/fields-string-name-static-propname-constructor.js create mode 100644 test/language/statements/class/fields-string-name-static-propname-prototype.js diff --git a/src/class-fields/propname-constructor.case b/src/class-fields/propname-constructor.case deleted file mode 100644 index 5254d7bf9e..0000000000 --- a/src/class-fields/propname-constructor.case +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (C) 2017 Valerie Young. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -desc: class fields forbid PropName 'constructor' -info: | - - // This test file tests the following early error: - Static Semantics: Early Errors - - ClassElement : FieldDefinition; - It is a Syntax Error if PropName of FieldDefinition is "constructor". -features: [class, class-fields-public] -template: propname-error ----*/ - -//- propname -constructor diff --git a/src/class-fields/propname-error/cls-decl-computed-name.template b/src/class-fields/propname-error/cls-decl-computed-name.template deleted file mode 100644 index 547750ae06..0000000000 --- a/src/class-fields/propname-error/cls-decl-computed-name.template +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (C) 2017 Valerie Young. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-class-definitions-static-semantics-early-errors -path: language/statements/class/fields-computed-name- -name: no early error -- PropName of ComputedPropertyName not forbidden value -info: | - Static Semantics: PropName - ... - ComputedPropertyName : [ AssignmentExpression ] - Return empty. ----*/ - -var x = "/*{ propname }*/"; -class C { - [x]; -} - -var c = new C(); - -assert.sameValue(c.hasOwnProperty("/*{ propname }*/"), true); -assert.sameValue(C.hasOwnProperty("/*{ propname }*/"), false); diff --git a/src/class-fields/propname-error/cls-decl-literal-name.template b/src/class-fields/propname-error/cls-decl-literal-name.template deleted file mode 100644 index 2d5b355929..0000000000 --- a/src/class-fields/propname-error/cls-decl-literal-name.template +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (C) 2017 Valerie Young. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-class-definitions-static-semantics-early-errors -path: language/statements/class/fields-literal-name- -name: early error -- PropName of IdentifierName is forbidden value -negative: - type: SyntaxError - phase: parse -info: | - Static Semantics: PropName - LiteralPropertyName : IdentifierName - Return StringValue of IdentifierName. ----*/ - -throw "Test262: This statement should not be evaluated."; - -class C { - /*{ propname }*/; -} diff --git a/src/class-fields/propname-error/cls-decl-string-name.template b/src/class-fields/propname-error/cls-decl-string-name.template deleted file mode 100644 index a18b8dd136..0000000000 --- a/src/class-fields/propname-error/cls-decl-string-name.template +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (C) 2017 Valerie Young. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-class-definitions-static-semantics-early-errors -path: language/statements/class/fields-string-name- -name: early error -- PropName of StringLiteral is forbidden value -negative: - type: SyntaxError - phase: parse -info: | - Static Semantics: PropName - ... - LiteralPropertyName : StringLiteral - Return the String value whose code units are the SV of the StringLiteral. ----*/ - -throw "Test262: This statement should not be evaluated."; - -class C { - '/*{ propname }*/'; -} diff --git a/src/class-fields/propname-error/cls-decl-variable-name.template b/src/class-fields/propname-error/cls-decl-variable-name.template deleted file mode 100644 index cbda5b8319..0000000000 --- a/src/class-fields/propname-error/cls-decl-variable-name.template +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (C) 2017 Valerie Young. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-class-definitions-static-semantics-early-errors -path: language/statements/class/fields-computed-variable-name- -name: no early error -- PropName of ComputedPropertyName not forbidden value -info: | - Static Semantics: PropName - ... - ComputedPropertyName : [ AssignmentExpression ] - Return empty. ----*/ - -var /*{ propname }*/ = 'foo'; -class C { - /*{ static }*/ [/*{ propname }*/]; -} - -var c = new C(); - -assert.sameValue(c.hasOwnProperty("foo"), true); diff --git a/src/class-fields/propname-error/cls-expr-computed-name.template b/src/class-fields/propname-error/cls-expr-computed-name.template deleted file mode 100644 index 2abdbb6d5b..0000000000 --- a/src/class-fields/propname-error/cls-expr-computed-name.template +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (C) 2017 Valerie Young. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-class-definitions-static-semantics-early-errors -path: language/expressions/class/fields-computed-name- -name: no early error -- PropName of ComputedPropertyName not forbidden value -info: | - Static Semantics: PropName - ... - ComputedPropertyName : [ AssignmentExpression ] - Return empty. ----*/ - -var x = "/*{ propname }*/"; -var C = class { - [x]; -}; - -var c = new C(); -assert.sameValue(c.hasOwnProperty("/*{ propname }*/"), true); - -assert.sameValue(C.hasOwnProperty("/*{ propname }*/"), false); diff --git a/src/class-fields/propname-error/cls-expr-literal-name.template b/src/class-fields/propname-error/cls-expr-literal-name.template deleted file mode 100644 index 6ef427ebd7..0000000000 --- a/src/class-fields/propname-error/cls-expr-literal-name.template +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (C) 2017 Valerie Young. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-class-definitions-static-semantics-early-errors -path: language/expressions/class/fields-literal-name- -name: early error -- PropName of IdentifierName is forbidden -negative: - type: SyntaxError - phase: parse -info: | - Static Semantics: PropName - LiteralPropertyName : IdentifierName - Return StringValue of IdentifierName. ----*/ - -throw "Test262: This statement should not be evaluated."; - -var C = class { - /*{ propname }*/; -}; diff --git a/src/class-fields/propname-error/cls-expr-string-name.template b/src/class-fields/propname-error/cls-expr-string-name.template deleted file mode 100644 index 3cb9c27281..0000000000 --- a/src/class-fields/propname-error/cls-expr-string-name.template +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (C) 2017 Valerie Young. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-class-definitions-static-semantics-early-errors -path: language/expressions/class/fields-string-name- -name: early error -- PropName of StringLiteral is forbidden -negative: - type: SyntaxError - phase: parse -info: | - Static Semantics: PropName - ... - LiteralPropertyName : StringLiteral - Return the String value whose code units are the SV of the StringLiteral. ----*/ - -throw "Test262: This statement should not be evaluated."; - -var C = class { - '/*{ propname }*/'; -}; diff --git a/src/class-fields/propname-error/cls-expr-variable-name.template b/src/class-fields/propname-error/cls-expr-variable-name.template deleted file mode 100644 index 50b255197f..0000000000 --- a/src/class-fields/propname-error/cls-expr-variable-name.template +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (C) 2017 Valerie Young. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -esid: sec-class-definitions-static-semantics-early-errors -path: language/expressions/class/fields-computed-variable-name- -name: no early error -- PropName of ComputedPropertyName not forbidden value -info: | - Static Semantics: PropName - ... - ComputedPropertyName : [ AssignmentExpression ] - Return empty. ----*/ - -var /*{ propname }*/ = 'foo'; -var C = class { - /*{ static }*/ [/*{ propname }*/]; -} - -var c = new C(); - -assert.sameValue(c.hasOwnProperty("foo"), true); diff --git a/src/class-fields/static-propname-constructor.case b/src/class-fields/static-propname-constructor.case deleted file mode 100644 index ff3d00af6a..0000000000 --- a/src/class-fields/static-propname-constructor.case +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (C) 2017 Valerie Young. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -desc: static class field forbid PropName 'constructor' -info: | - - // This test file tests the following early error: - Static Semantics: Early Errors - - ClassElement : staticFieldDefinition; - It is a Syntax Error if PropName of FieldDefinition is "prototype" or "constructor". -features: [class-fields] -template: propname-error ----*/ - -//- static -static -//- propname -constructor diff --git a/src/class-fields/static-propname-prototype.case b/src/class-fields/static-propname-prototype.case deleted file mode 100644 index 99d85ff64a..0000000000 --- a/src/class-fields/static-propname-prototype.case +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (C) 2017 Valerie Young. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -desc: static class fields forbid PropName 'prototype' -info: | - - // This test file tests the following early error: - Static Semantics: Early Errors - - ClassElement : staticFieldDefinition; - It is a Syntax Error if PropName of FieldDefinition is "prototype" or "constructor". -features: [class-fields] -template: propname-error ----*/ - -//- static -static -//- propname -prototype diff --git a/test/language/statements/class/fields-static-comp-name-init-err-contains-arguments.js b/test/language/statements/class/fields-static-comp-name-init-err-contains-arguments.js new file mode 100644 index 0000000000..666a41ca8b --- /dev/null +++ b/test/language/statements/class/fields-static-comp-name-init-err-contains-arguments.js @@ -0,0 +1,35 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/init-err-contains-arguments.case +// - src/class-fields/initializer-error/cls-decl-fields-static-comp-name.template +/*--- +description: Syntax error if `arguments` used in class field (static computed ClassElementName) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if ContainsArguments of Initializer is true. + + Static Semantics: ContainsArguments + IdentifierReference : Identifier + + 1. If the StringValue of Identifier is "arguments", return true. + ... + For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false. + +---*/ + + +throw "Test262: This statement should not be evaluated."; + +var x = "string"; +class C { + static [x] = arguments; +} diff --git a/test/language/statements/class/fields-static-comp-name-init-err-contains-super.js b/test/language/statements/class/fields-static-comp-name-init-err-contains-super.js new file mode 100644 index 0000000000..12d148d613 --- /dev/null +++ b/test/language/statements/class/fields-static-comp-name-init-err-contains-super.js @@ -0,0 +1,28 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/init-err-contains-super.case +// - src/class-fields/initializer-error/cls-decl-fields-static-comp-name.template +/*--- +description: Syntax error if `super()` used in class field (static computed ClassElementName) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true. + +---*/ + + +throw "Test262: This statement should not be evaluated."; + +var x = "string"; +class C { + static [x] = super(); +} diff --git a/test/language/statements/class/fields-static-literal-init-err-contains-arguments.js b/test/language/statements/class/fields-static-literal-init-err-contains-arguments.js new file mode 100644 index 0000000000..cd4f184292 --- /dev/null +++ b/test/language/statements/class/fields-static-literal-init-err-contains-arguments.js @@ -0,0 +1,34 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/init-err-contains-arguments.case +// - src/class-fields/initializer-error/cls-decl-fields-static-literal-name.template +/*--- +description: Syntax error if `arguments` used in class field (static literal ClassElementName) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if ContainsArguments of Initializer is true. + + Static Semantics: ContainsArguments + IdentifierReference : Identifier + + 1. If the StringValue of Identifier is "arguments", return true. + ... + For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false. + +---*/ + + +throw "Test262: This statement should not be evaluated."; + +class C { + static x = arguments; +} diff --git a/test/language/statements/class/fields-static-literal-init-err-contains-super.js b/test/language/statements/class/fields-static-literal-init-err-contains-super.js new file mode 100644 index 0000000000..64334ba094 --- /dev/null +++ b/test/language/statements/class/fields-static-literal-init-err-contains-super.js @@ -0,0 +1,27 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/init-err-contains-super.case +// - src/class-fields/initializer-error/cls-decl-fields-static-literal-name.template +/*--- +description: Syntax error if `super()` used in class field (static literal ClassElementName) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true. + +---*/ + + +throw "Test262: This statement should not be evaluated."; + +class C { + static x = super(); +} diff --git a/test/language/statements/class/fields-static-private-init-err-contains-arguments.js b/test/language/statements/class/fields-static-private-init-err-contains-arguments.js new file mode 100644 index 0000000000..dc4b9a96bd --- /dev/null +++ b/test/language/statements/class/fields-static-private-init-err-contains-arguments.js @@ -0,0 +1,34 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/init-err-contains-arguments.case +// - src/class-fields/initializer-error/cls-decl-fields-static-private-name.template +/*--- +description: Syntax error if `arguments` used in class field (static PrivateName) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if ContainsArguments of Initializer is true. + + Static Semantics: ContainsArguments + IdentifierReference : Identifier + + 1. If the StringValue of Identifier is "arguments", return true. + ... + For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false. + +---*/ + + +throw "Test262: This statement should not be evaluated."; + +class C { + static #x = arguments; +} diff --git a/test/language/statements/class/fields-static-private-init-err-contains-super.js b/test/language/statements/class/fields-static-private-init-err-contains-super.js new file mode 100644 index 0000000000..19423553ea --- /dev/null +++ b/test/language/statements/class/fields-static-private-init-err-contains-super.js @@ -0,0 +1,27 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/init-err-contains-super.case +// - src/class-fields/initializer-error/cls-decl-fields-static-private-name.template +/*--- +description: Syntax error if `super()` used in class field (static PrivateName) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true. + +---*/ + + +throw "Test262: This statement should not be evaluated."; + +class C { + static #x = super(); +} diff --git a/test/language/statements/class/fields-static-private-names.js b/test/language/statements/class/fields-static-private-names.js new file mode 100644 index 0000000000..4192939646 --- /dev/null +++ b/test/language/statements/class/fields-static-private-names.js @@ -0,0 +1,45 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-private-names.case +// - src/class-fields/default/cls-decl.template +/*--- +description: literal private names (field definitions in a class declaration) +esid: prod-FieldDefinition +features: [class, class-fields-public] +flags: [generated] +info: | + ClassElement: + ... + static FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PrivateName + + PrivateName: + # IdentifierName + +---*/ + + +class C { + static #x; static #y +} + +// Test the private fields do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 7"); +assert.sameValue(C.y(), 43, "test 8"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); diff --git a/test/language/statements/class/fields-static-string-literal-name-init-err-contains-arguments.js b/test/language/statements/class/fields-static-string-literal-name-init-err-contains-arguments.js new file mode 100644 index 0000000000..c44b995641 --- /dev/null +++ b/test/language/statements/class/fields-static-string-literal-name-init-err-contains-arguments.js @@ -0,0 +1,34 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/init-err-contains-arguments.case +// - src/class-fields/initializer-error/cls-decl-fields-static-string-literal-name.template +/*--- +description: Syntax error if `arguments` used in class field (static string literal ClassElementName) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if ContainsArguments of Initializer is true. + + Static Semantics: ContainsArguments + IdentifierReference : Identifier + + 1. If the StringValue of Identifier is "arguments", return true. + ... + For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false. + +---*/ + + +throw "Test262: This statement should not be evaluated."; + +class C { + static 'x' = arguments; +} diff --git a/test/language/statements/class/fields-static-string-literal-name-init-err-contains-super.js b/test/language/statements/class/fields-static-string-literal-name-init-err-contains-super.js new file mode 100644 index 0000000000..39cf2cb52a --- /dev/null +++ b/test/language/statements/class/fields-static-string-literal-name-init-err-contains-super.js @@ -0,0 +1,27 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/init-err-contains-super.case +// - src/class-fields/initializer-error/cls-decl-fields-static-string-literal-name.template +/*--- +description: Syntax error if `super()` used in class field (static string literal ClassElementName) +esid: sec-class-definitions-static-semantics-early-errors +features: [class, class-fields-public] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: Early Errors + + FieldDefinition: + PropertyNameInitializeropt + + - It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true. + +---*/ + + +throw "Test262: This statement should not be evaluated."; + +class C { + static 'x' = super(); +} diff --git a/test/language/statements/class/fields-string-name-static-propname-constructor.js b/test/language/statements/class/fields-string-name-static-propname-constructor.js new file mode 100644 index 0000000000..7013df4a70 --- /dev/null +++ b/test/language/statements/class/fields-string-name-static-propname-constructor.js @@ -0,0 +1,32 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-propname-constructor.case +// - src/class-fields/propname-error/cls-decl-string-name.template +/*--- +description: static class field forbid PropName 'constructor' (early error -- PropName of StringLiteral is forbidden value) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-fields] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: PropName + ... + LiteralPropertyName : StringLiteral + Return the String value whose code units are the SV of the StringLiteral. + + + // This test file tests the following early error: + Static Semantics: Early Errors + + ClassElement : staticFieldDefinition; + It is a Syntax Error if PropName of FieldDefinition is "prototype" or "constructor". + +---*/ + + +throw "Test262: This statement should not be evaluated."; + +class C { + 'constructor'; +} diff --git a/test/language/statements/class/fields-string-name-static-propname-prototype.js b/test/language/statements/class/fields-string-name-static-propname-prototype.js new file mode 100644 index 0000000000..a054249ef4 --- /dev/null +++ b/test/language/statements/class/fields-string-name-static-propname-prototype.js @@ -0,0 +1,32 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-propname-prototype.case +// - src/class-fields/propname-error/cls-decl-string-name.template +/*--- +description: static class fields forbid PropName 'prototype' (early error -- PropName of StringLiteral is forbidden value) +esid: sec-class-definitions-static-semantics-early-errors +features: [class-fields] +flags: [generated] +negative: + phase: parse + type: SyntaxError +info: | + Static Semantics: PropName + ... + LiteralPropertyName : StringLiteral + Return the String value whose code units are the SV of the StringLiteral. + + + // This test file tests the following early error: + Static Semantics: Early Errors + + ClassElement : staticFieldDefinition; + It is a Syntax Error if PropName of FieldDefinition is "prototype" or "constructor". + +---*/ + + +throw "Test262: This statement should not be evaluated."; + +class C { + 'prototype'; +}