From d50c33a5b32362a3640bc28cd309e9f3fc39f2b2 Mon Sep 17 00:00:00 2001 From: Daniel Ehrenberg <littledan@chromium.org> Date: Thu, 21 Dec 2017 16:57:31 +0100 Subject: [PATCH] Remove static fields tests Static fields were broken up from instance fields and demoted to Stage 2 in the November 2017 TC39 meeting. This patch removes the test262 tests which test static class fields. --- .../computed-name-referenceerror.case | 3 - .../computed-name-toprimitive-err.case | 3 - ...ed-name-toprimitive-returns-noncallable.js | 3 - ...uted-name-toprimitive-returns-nonobject.js | 3 - .../computed-name-toprimitive-symbol.case | 3 - .../computed-name-toprimitive.case | 3 - .../computed-name-tostring-err.case | 3 - .../computed-name-valueof-err.case | 3 - src/class-fields/computed-names.case | 11 +- src/class-fields/info.txt | 3 +- src/class-fields/init-value-incremental.case | 30 ++---- .../cls-decl-fields-comp-name.template | 15 --- .../cls-decl-fields-static-comp-name.template | 15 --- ...s-decl-fields-static-literal-name.template | 14 --- ...s-decl-fields-static-private-name.template | 15 --- ...fields-static-string-literal-name.template | 14 --- .../cls-expr-fields-static-comp-name.template | 15 --- ...s-expr-fields-static-literal-name.template | 14 --- ...s-expr-fields-static-private-name.template | 15 --- ...fields-static-string-literal-name.template | 14 --- .../cls-decl-static-literal-name.template | 21 ---- .../cls-decl-static-string-name.template | 22 ---- .../cls-decl-static-variable-name.template | 23 ---- .../cls-expr-static-literal-name.template | 21 ---- .../cls-expr-static-string-name.template | 22 ---- .../cls-expr-static-variable-name.template | 23 ---- ...atic-computed-name-toprimitive-symbol.case | 102 ------------------ .../static-computed-name-toprimitive.case | 99 ----------------- src/class-fields/static-computed-names.case | 39 ------- .../static-computed-symbol-names.case | 54 ---------- src/class-fields/static-literal-names.case | 56 ---------- src/class-fields/static-private-names.case | 51 --------- .../static-propname-constructor.case | 18 ---- .../static-propname-prototype.case | 18 ---- .../static-redeclaration-symbol.case | 47 -------- src/class-fields/static-redeclaration.case | 47 -------- ...mputed-name-static-propname-constructor.js | 32 ------ ...computed-name-static-propname-prototype.js | 58 ---------- ...mputed-name-static-propname-constructor.js | 32 ------ ...computed-name-static-propname-prototype.js | 58 ---------- ...atic-classelementname-abrupt-completion.js | 42 -------- ...efinition-initializer-abrupt-completion.js | 42 -------- 42 files changed, 9 insertions(+), 1117 deletions(-) delete mode 100644 src/class-fields/initializer-error/cls-decl-fields-comp-name.template delete mode 100644 src/class-fields/initializer-error/cls-decl-fields-static-comp-name.template delete mode 100644 src/class-fields/initializer-error/cls-decl-fields-static-literal-name.template delete mode 100644 src/class-fields/initializer-error/cls-decl-fields-static-private-name.template delete mode 100644 src/class-fields/initializer-error/cls-decl-fields-static-string-literal-name.template delete mode 100644 src/class-fields/initializer-error/cls-expr-fields-static-comp-name.template delete mode 100644 src/class-fields/initializer-error/cls-expr-fields-static-literal-name.template delete mode 100644 src/class-fields/initializer-error/cls-expr-fields-static-private-name.template delete mode 100644 src/class-fields/initializer-error/cls-expr-fields-static-string-literal-name.template delete mode 100644 src/class-fields/propname-error-static/cls-decl-static-literal-name.template delete mode 100644 src/class-fields/propname-error-static/cls-decl-static-string-name.template delete mode 100644 src/class-fields/propname-error-static/cls-decl-static-variable-name.template delete mode 100644 src/class-fields/propname-error-static/cls-expr-static-literal-name.template delete mode 100644 src/class-fields/propname-error-static/cls-expr-static-string-name.template delete mode 100644 src/class-fields/propname-error-static/cls-expr-static-variable-name.template delete mode 100644 src/class-fields/static-computed-name-toprimitive-symbol.case delete mode 100644 src/class-fields/static-computed-name-toprimitive.case delete mode 100644 src/class-fields/static-computed-names.case delete mode 100644 src/class-fields/static-computed-symbol-names.case delete mode 100644 src/class-fields/static-literal-names.case delete mode 100644 src/class-fields/static-private-names.case delete mode 100644 src/class-fields/static-propname-constructor.case delete mode 100644 src/class-fields/static-propname-prototype.case delete mode 100644 src/class-fields/static-redeclaration-symbol.case delete mode 100644 src/class-fields/static-redeclaration.case delete mode 100644 test/language/expressions/class/fields-computed-name-static-propname-constructor.js delete mode 100644 test/language/expressions/class/fields-computed-name-static-propname-prototype.js delete mode 100644 test/language/statements/class/fields-computed-name-static-propname-constructor.js delete mode 100644 test/language/statements/class/fields-computed-name-static-propname-prototype.js delete mode 100644 test/language/statements/class/static-classelementname-abrupt-completion.js delete mode 100644 test/language/statements/class/static-fielddefinition-initializer-abrupt-completion.js diff --git a/src/class-fields/computed-name-referenceerror.case b/src/class-fields/computed-name-referenceerror.case index 95447eff00..6717a2889e 100644 --- a/src/class-fields/computed-name-referenceerror.case +++ b/src/class-fields/computed-name-referenceerror.case @@ -20,9 +20,6 @@ info: | Runtime Semantics: ClassElementEvaluation - ClassElement: static FieldDefinition; - Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter true and object. - ClassElement: FieldDefinition; Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter false and object. diff --git a/src/class-fields/computed-name-toprimitive-err.case b/src/class-fields/computed-name-toprimitive-err.case index 07b991c494..026d93f78b 100644 --- a/src/class-fields/computed-name-toprimitive-err.case +++ b/src/class-fields/computed-name-toprimitive-err.case @@ -20,9 +20,6 @@ info: | Runtime Semantics: ClassElementEvaluation - ClassElement: static FieldDefinition; - Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter true and object. - ClassElement: FieldDefinition; Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter false and object. diff --git a/src/class-fields/computed-name-toprimitive-returns-noncallable.js b/src/class-fields/computed-name-toprimitive-returns-noncallable.js index 6a69776c2a..0a45416bae 100644 --- a/src/class-fields/computed-name-toprimitive-returns-noncallable.js +++ b/src/class-fields/computed-name-toprimitive-returns-noncallable.js @@ -20,9 +20,6 @@ info: | Runtime Semantics: ClassElementEvaluation - ClassElement: static FieldDefinition; - Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter true and object. - ClassElement: FieldDefinition; Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter false and object. diff --git a/src/class-fields/computed-name-toprimitive-returns-nonobject.js b/src/class-fields/computed-name-toprimitive-returns-nonobject.js index 0fa3ec95af..eae5ce14e6 100644 --- a/src/class-fields/computed-name-toprimitive-returns-nonobject.js +++ b/src/class-fields/computed-name-toprimitive-returns-nonobject.js @@ -20,9 +20,6 @@ info: | Runtime Semantics: ClassElementEvaluation - ClassElement: static FieldDefinition; - Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter true and object. - ClassElement: FieldDefinition; Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter false and object. diff --git a/src/class-fields/computed-name-toprimitive-symbol.case b/src/class-fields/computed-name-toprimitive-symbol.case index daee6c76f5..708cbd62b1 100644 --- a/src/class-fields/computed-name-toprimitive-symbol.case +++ b/src/class-fields/computed-name-toprimitive-symbol.case @@ -20,9 +20,6 @@ info: | Runtime Semantics: ClassElementEvaluation - ClassElement: static FieldDefinition; - Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter true and object. - ClassElement: FieldDefinition; Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter false and object. diff --git a/src/class-fields/computed-name-toprimitive.case b/src/class-fields/computed-name-toprimitive.case index a8c859b9c5..025e158f0d 100644 --- a/src/class-fields/computed-name-toprimitive.case +++ b/src/class-fields/computed-name-toprimitive.case @@ -20,9 +20,6 @@ info: | Runtime Semantics: ClassElementEvaluation - ClassElement: static FieldDefinition; - Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter true and object. - ClassElement: FieldDefinition; Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter false and object. diff --git a/src/class-fields/computed-name-tostring-err.case b/src/class-fields/computed-name-tostring-err.case index b6d81c06b2..fd3c6949d2 100644 --- a/src/class-fields/computed-name-tostring-err.case +++ b/src/class-fields/computed-name-tostring-err.case @@ -20,9 +20,6 @@ info: | Runtime Semantics: ClassElementEvaluation - ClassElement: static FieldDefinition; - Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter true and object. - ClassElement: FieldDefinition; Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter false and object. diff --git a/src/class-fields/computed-name-valueof-err.case b/src/class-fields/computed-name-valueof-err.case index 232e3c1e9e..f91cca77bf 100644 --- a/src/class-fields/computed-name-valueof-err.case +++ b/src/class-fields/computed-name-valueof-err.case @@ -20,9 +20,6 @@ info: | Runtime Semantics: ClassElementEvaluation - ClassElement: static FieldDefinition; - Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter true and object. - ClassElement: FieldDefinition; Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter false and object. diff --git a/src/class-fields/computed-names.case b/src/class-fields/computed-names.case index d0ff46c7b0..318b5b5ada 100644 --- a/src/class-fields/computed-names.case +++ b/src/class-fields/computed-names.case @@ -22,17 +22,8 @@ features: [computed-property-names] var x = "b"; //- fields -static ["a"] = 39; [x] = 42; [10] = "meep"; ["not initialized"] +[x] = 42; [10] = "meep"; ["not initialized"] //- assertions -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); -assert.sameValue(Object.hasOwnProperty.call(c, "a"), false); - -verifyProperty(C, "a", { - value: 39, - enumerable: true, - writable: true, - configurable: true -}); assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); diff --git a/src/class-fields/info.txt b/src/class-fields/info.txt index 236a9a1488..4ec25960e3 100644 --- a/src/class-fields/info.txt +++ b/src/class-fields/info.txt @@ -2,7 +2,6 @@ MethodDefinition static MethodDefinition FieldDefinition ; - static FieldDefinition ; ; FieldDefinition: @@ -13,4 +12,4 @@ PrivateName PrivateName :: - # IdentifierName \ No newline at end of file + # IdentifierName diff --git a/src/class-fields/init-value-incremental.case b/src/class-fields/init-value-incremental.case index b3cd5a8c08..2a1ce00886 100644 --- a/src/class-fields/init-value-incremental.case +++ b/src/class-fields/init-value-incremental.case @@ -28,53 +28,37 @@ includes: [propertyHelper.js] ---*/ //- setup -var x = 0; +var x = 1; //- fields -static [x++] = x++; [x++] = x++; -static [x++] = x++; [x++] = x++; //- assertions var c1 = new C(); var c2 = new C(); -verifyProperty(C, "0", { - value: 4, - enumerable: true, - configurable: true, - writable: true, -}); - -verifyProperty(C, "2", { - value: 5, - enumerable: true, - configurable: true, - writable: true, -}); - verifyProperty(c1, "1", { - value: 6, + value: 3, enumerable: true, configurable: true, writable: true, }); -verifyProperty(c1, "3", { - value: 7, +verifyProperty(c1, "2", { + value: 4, enumerable: true, configurable: true, writable: true, }); verifyProperty(c2, "1", { - value: 8, + value: 5, enumerable: true, configurable: true, writable: true, }); -verifyProperty(c2, "3", { - value: 9, +verifyProperty(c2, "2", { + value: 6, enumerable: true, configurable: true, writable: true, diff --git a/src/class-fields/initializer-error/cls-decl-fields-comp-name.template b/src/class-fields/initializer-error/cls-decl-fields-comp-name.template deleted file mode 100644 index a922c25b80..0000000000 --- a/src/class-fields/initializer-error/cls-decl-fields-comp-name.template +++ /dev/null @@ -1,15 +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-comp-name- -name: computed ClassElementName ----*/ - -throw "Test262: This statement should not be evaluated."; - -var x = "string"; -class C { - static [x] = /*{ initializer }*/; -} diff --git a/src/class-fields/initializer-error/cls-decl-fields-static-comp-name.template b/src/class-fields/initializer-error/cls-decl-fields-static-comp-name.template deleted file mode 100644 index b4eb238479..0000000000 --- a/src/class-fields/initializer-error/cls-decl-fields-static-comp-name.template +++ /dev/null @@ -1,15 +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-static-comp-name- -name: static computed ClassElementName ----*/ - -throw "Test262: This statement should not be evaluated."; - -var x = "string"; -class C { - static [x] = /*{ initializer }*/; -} diff --git a/src/class-fields/initializer-error/cls-decl-fields-static-literal-name.template b/src/class-fields/initializer-error/cls-decl-fields-static-literal-name.template deleted file mode 100644 index 335d76793f..0000000000 --- a/src/class-fields/initializer-error/cls-decl-fields-static-literal-name.template +++ /dev/null @@ -1,14 +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-static-literal- -name: static literal ClassElementName ----*/ - -throw "Test262: This statement should not be evaluated."; - -class C { - static x = /*{ initializer }*/; -} diff --git a/src/class-fields/initializer-error/cls-decl-fields-static-private-name.template b/src/class-fields/initializer-error/cls-decl-fields-static-private-name.template deleted file mode 100644 index 0138ad7492..0000000000 --- a/src/class-fields/initializer-error/cls-decl-fields-static-private-name.template +++ /dev/null @@ -1,15 +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-static-private- -name: static PrivateName -features: [class, class-fields-private] ----*/ - -throw "Test262: This statement should not be evaluated."; - -class C { - static #x = /*{ initializer }*/; -} diff --git a/src/class-fields/initializer-error/cls-decl-fields-static-string-literal-name.template b/src/class-fields/initializer-error/cls-decl-fields-static-string-literal-name.template deleted file mode 100644 index 5fd801e187..0000000000 --- a/src/class-fields/initializer-error/cls-decl-fields-static-string-literal-name.template +++ /dev/null @@ -1,14 +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-static-string-literal-name- -name: static string literal ClassElementName ----*/ - -throw "Test262: This statement should not be evaluated."; - -class C { - static 'x' = /*{ initializer }*/; -} diff --git a/src/class-fields/initializer-error/cls-expr-fields-static-comp-name.template b/src/class-fields/initializer-error/cls-expr-fields-static-comp-name.template deleted file mode 100644 index cb44207f4e..0000000000 --- a/src/class-fields/initializer-error/cls-expr-fields-static-comp-name.template +++ /dev/null @@ -1,15 +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-static-comp-name- -name: static computed ClassElementName ----*/ - -throw "Test262: This statement should not be evaluated."; - -var x = "string"; -var C = class { - static [x] = /*{ initializer }*/; -} diff --git a/src/class-fields/initializer-error/cls-expr-fields-static-literal-name.template b/src/class-fields/initializer-error/cls-expr-fields-static-literal-name.template deleted file mode 100644 index 0a840e01ef..0000000000 --- a/src/class-fields/initializer-error/cls-expr-fields-static-literal-name.template +++ /dev/null @@ -1,14 +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-static-literal- -name: static literal ClassElementName ----*/ - -throw "Test262: This statement should not be evaluated."; - -var C = class { - static x = /*{ initializer }*/; -} diff --git a/src/class-fields/initializer-error/cls-expr-fields-static-private-name.template b/src/class-fields/initializer-error/cls-expr-fields-static-private-name.template deleted file mode 100644 index ea342167f1..0000000000 --- a/src/class-fields/initializer-error/cls-expr-fields-static-private-name.template +++ /dev/null @@ -1,15 +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-static-private- -name: static PrivateName -features: [class, class-fields-private] ----*/ - -throw "Test262: This statement should not be evaluated."; - -var C = class { - static #x = /*{ initializer }*/; -} diff --git a/src/class-fields/initializer-error/cls-expr-fields-static-string-literal-name.template b/src/class-fields/initializer-error/cls-expr-fields-static-string-literal-name.template deleted file mode 100644 index deed9b15e3..0000000000 --- a/src/class-fields/initializer-error/cls-expr-fields-static-string-literal-name.template +++ /dev/null @@ -1,14 +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-static-string-literal-name- -name: static string literal ClassElementName ----*/ - -throw "Test262: This statement should not be evaluated."; - -var C = class { - static 'x' = /*{ initializer }*/; -} diff --git a/src/class-fields/propname-error-static/cls-decl-static-literal-name.template b/src/class-fields/propname-error-static/cls-decl-static-literal-name.template deleted file mode 100644 index 30f68ad825..0000000000 --- a/src/class-fields/propname-error-static/cls-decl-static-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: early -info: | - Static Semantics: PropName - LiteralPropertyName : IdentifierName - Return StringValue of IdentifierName. ----*/ - -throw "Test262: This statement should not be evaluated."; - -class C { - static /*{ propname }*/; -} diff --git a/src/class-fields/propname-error-static/cls-decl-static-string-name.template b/src/class-fields/propname-error-static/cls-decl-static-string-name.template deleted file mode 100644 index f08d3cb349..0000000000 --- a/src/class-fields/propname-error-static/cls-decl-static-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: early -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 { - static '/*{ propname }*/'; -} diff --git a/src/class-fields/propname-error-static/cls-decl-static-variable-name.template b/src/class-fields/propname-error-static/cls-decl-static-variable-name.template deleted file mode 100644 index 1f9be8d27c..0000000000 --- a/src/class-fields/propname-error-static/cls-decl-static-variable-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-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 }*/]; -} - -assert.sameValue(C.hasOwnProperty("foo"), true); - -var c = new C(); -assert.sameValue(c.hasOwnProperty("foo"), false); diff --git a/src/class-fields/propname-error-static/cls-expr-static-literal-name.template b/src/class-fields/propname-error-static/cls-expr-static-literal-name.template deleted file mode 100644 index d11b9c43f3..0000000000 --- a/src/class-fields/propname-error-static/cls-expr-static-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: early -info: | - Static Semantics: PropName - LiteralPropertyName : IdentifierName - Return StringValue of IdentifierName. ----*/ - -throw "Test262: This statement should not be evaluated."; - -var C = class { - static /*{ propname }*/; -}; diff --git a/src/class-fields/propname-error-static/cls-expr-static-string-name.template b/src/class-fields/propname-error-static/cls-expr-static-string-name.template deleted file mode 100644 index 6c1a225ed8..0000000000 --- a/src/class-fields/propname-error-static/cls-expr-static-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: early -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 { - static '/*{ propname }*/'; -}; diff --git a/src/class-fields/propname-error-static/cls-expr-static-variable-name.template b/src/class-fields/propname-error-static/cls-expr-static-variable-name.template deleted file mode 100644 index 8821ead504..0000000000 --- a/src/class-fields/propname-error-static/cls-expr-static-variable-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-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 }*/]; -}; - -assert.sameValue(C.hasOwnProperty("foo"), true); - -var c = new C(); -assert.sameValue(c.hasOwnProperty("foo"), false); diff --git a/src/class-fields/static-computed-name-toprimitive-symbol.case b/src/class-fields/static-computed-name-toprimitive-symbol.case deleted file mode 100644 index 49fc61c491..0000000000 --- a/src/class-fields/static-computed-name-toprimitive-symbol.case +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (C) 2017 Leo Balter. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -desc: ToPrimitive evaluation in the ComputedPropertyName -info: | - Runtime Semantics: ClassDefinitionEvaluation - - ... - 27. For each ClassElement e in order from elements - a. If IsStatic of me is false, then - i. Let fields be the result of performing ClassElementEvaluation for e with arguments proto and false. - b. Else, - i. Let fields be the result of performing ClassElementEvaluation for e with arguments F and false. - c. If fields is an abrupt completion, then - i. Set the running execution context's LexicalEnvironment to lex. - ii. Set the running execution context's PrivateNameEnvironment to outerPrivateEnvironment. - iii. Return Completion(status). - ... - - Runtime Semantics: ClassElementEvaluation - - ClassElement: static FieldDefinition; - Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter true and object. - - ClassElement: FieldDefinition; - Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter false and object. - - Runtime Semantics: ClassFieldDefinitionEvaluation - With parameters isStatic and homeObject. - - 1. Let fieldName be the result of evaluating ClassElementName. - 2. ReturnIfAbrupt(fieldName). - ... - - Runtime Semantics: Evaluation - ComputedPropertyName: [ AssignmentExpression ] - - 1. Let exprValue be the result of evaluating AssignmentExpression. - 2. Let propName be ? GetValue(exprValue). - 3. Return ? ToPropertyKey(propName). -template: default -features: [computed-property-names, Symbol.toPrimitive, Symbol] -includes: [propertyHelper.js] ----*/ - -//- setup -var s1 = Symbol(); -var s2 = Symbol(); -var s3 = Symbol(); -var err = function() { throw new Test262Error(); }; -var obj1 = { - [Symbol.toPrimitive]: function() { return s1; }, - toString: err, - valueOf: err -}; - -var obj2 = { - toString: function() { return s2; }, - valueOf: err -}; - -var obj3 = { - toString: undefined, - valueOf: function() { return s3; } -}; - -//- fields -static [obj1] = 42; -static [obj2] = 43; -static [obj3] = 44; -//- assertions -assert.sameValue(Object.hasOwnProperty.call(C.prototype, s1), false); -assert.sameValue(Object.hasOwnProperty.call(C.prototype, s2), false); -assert.sameValue(Object.hasOwnProperty.call(C.prototype, s3), false); - -verifyProperty(C, s1, { - value: 42, - enumerable: true, - writable: true, - configurable: true -}); - -verifyProperty(C, s2, { - value: 43, - enumerable: true, - writable: true, - configurable: true -}); - -verifyProperty(C, s3, { - value: 44, - enumerable: true, - writable: true, - configurable: true -}); - -var c = new C(); - -assert.sameValue(Object.hasOwnProperty.call(c, s1), false); -assert.sameValue(Object.hasOwnProperty.call(c, s2), false); -assert.sameValue(Object.hasOwnProperty.call(c, s3), false); diff --git a/src/class-fields/static-computed-name-toprimitive.case b/src/class-fields/static-computed-name-toprimitive.case deleted file mode 100644 index 133eff72bd..0000000000 --- a/src/class-fields/static-computed-name-toprimitive.case +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (C) 2017 Leo Balter. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -desc: ToPrimitive evaluation in the ComputedPropertyName -info: | - Runtime Semantics: ClassDefinitionEvaluation - - ... - 27. For each ClassElement e in order from elements - a. If IsStatic of me is false, then - i. Let fields be the result of performing ClassElementEvaluation for e with arguments proto and false. - b. Else, - i. Let fields be the result of performing ClassElementEvaluation for e with arguments F and false. - c. If fields is an abrupt completion, then - i. Set the running execution context's LexicalEnvironment to lex. - ii. Set the running execution context's PrivateNameEnvironment to outerPrivateEnvironment. - iii. Return Completion(status). - ... - - Runtime Semantics: ClassElementEvaluation - - ClassElement: static FieldDefinition; - Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter true and object. - - ClassElement: FieldDefinition; - Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter false and object. - - Runtime Semantics: ClassFieldDefinitionEvaluation - With parameters isStatic and homeObject. - - 1. Let fieldName be the result of evaluating ClassElementName. - 2. ReturnIfAbrupt(fieldName). - ... - - Runtime Semantics: Evaluation - ComputedPropertyName: [ AssignmentExpression ] - - 1. Let exprValue be the result of evaluating AssignmentExpression. - 2. Let propName be ? GetValue(exprValue). - 3. Return ? ToPropertyKey(propName). -template: default -features: [computed-property-names, Symbol.toPrimitive] -includes: [propertyHelper.js] ----*/ - -//- setup -var err = function() { throw new Test262Error(); }; -var obj1 = { - [Symbol.toPrimitive]: function() { return "d"; }, - toString: err, - valueOf: err -}; - -var obj2 = { - toString: function() { return "e"; }, - valueOf: err -}; - -var obj3 = { - toString: undefined, - valueOf: function() { return "f"; } -}; - -//- fields -static [obj1] = 42; -static [obj2] = 43; -static [obj3] = 44; -//- assertions -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "d"), false); -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "e"), false); -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "f"), false); - -verifyProperty(C, "d", { - value: 42, - enumerable: true, - writable: true, - configurable: true -}); - -verifyProperty(C, "e", { - value: 43, - enumerable: true, - writable: true, - configurable: true -}); - -verifyProperty(C, "f", { - value: 44, - enumerable: true, - writable: true, - configurable: true -}); - -var c = new C(); - -assert.sameValue(Object.hasOwnProperty.call(c, "d"), false); -assert.sameValue(Object.hasOwnProperty.call(c, "e"), false); -assert.sameValue(Object.hasOwnProperty.call(c, "f"), false); diff --git a/src/class-fields/static-computed-names.case b/src/class-fields/static-computed-names.case deleted file mode 100644 index 74fb407b55..0000000000 --- a/src/class-fields/static-computed-names.case +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (C) 2017 the V8 project authors, 2017 Igalia S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -desc: Static Computed property names -info: | - ClassElement: - ... - FieldDefinition ; - static FieldDefinition ; - - FieldDefinition: - ClassElementName Initializer_opt - - ClassElementName: - PropertyName -template: productions -includes: [propertyHelper.js] -features: [computed-property-names] ----*/ - -//- fields -static ["a"] = 42; ["a"] = 39 -//- assertions -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); - -verifyProperty(C, "a", { - value: 42, - enumerable: true, - writable: true, - configurable: true -}); - -verifyProperty(c, "a", { - value: 39, - enumerable: true, - writable: true, - configurable: true -}); diff --git a/src/class-fields/static-computed-symbol-names.case b/src/class-fields/static-computed-symbol-names.case deleted file mode 100644 index 79ec1284cb..0000000000 --- a/src/class-fields/static-computed-symbol-names.case +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (C) 2017 the V8 project authors, 2017 Igalia S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -desc: Static computed property symbol names -info: | - ClassElement: - ... - FieldDefinition ; - - FieldDefinition: - ClassElementName Initializer_opt - - ClassElementName: - PropertyName -template: productions -includes: [propertyHelper.js] -features: [Symbol, computed-property-names] ----*/ - -//- setup -var x = Symbol(); -var y = Symbol(); - -//- fields -static [x]; static [y] = 42 -//- assertions -assert.sameValue(Object.hasOwnProperty.call(C.prototype, x), false); -assert.sameValue(Object.hasOwnProperty.call(c, x), false); - -verifyProperty(C, x, { - value: undefined, - enumerable: true, - writable: true, - configurable: true -}); - -assert.sameValue(Object.hasOwnProperty.call(C.prototype, y), false); -assert.sameValue(Object.hasOwnProperty.call(c, y), false); - -verifyProperty(C, y, { - value: 42, - enumerable: true, - writable: true, - configurable: true -}); - -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "x"), false); -assert.sameValue(Object.hasOwnProperty.call(C, "x"), false); -assert.sameValue(Object.hasOwnProperty.call(c, "x"), false); - -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "y"), false); -assert.sameValue(Object.hasOwnProperty.call(C, "y"), false); -assert.sameValue(Object.hasOwnProperty.call(c, "y"), false); diff --git a/src/class-fields/static-literal-names.case b/src/class-fields/static-literal-names.case deleted file mode 100644 index 9fd2327a4b..0000000000 --- a/src/class-fields/static-literal-names.case +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright (C) 2017 the V8 project authors, 2017 Igalia S.L. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -desc: Static literal property names -info: | - ClassElement: - ... - FieldDefinition ; - - FieldDefinition: - ClassElementName Initializer_opt - - ClassElementName: - PropertyName -template: productions -includes: [propertyHelper.js] ----*/ - -//- setup -const fn = function() {} - -//- fields -static a; b = 42; -static c = fn -//- assertions -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); -assert.sameValue(Object.hasOwnProperty.call(c, "a"), false); - -verifyProperty(C, "a", { - value: undefined, - enumerable: true, - writable: true, - configurable: true -}); - -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false); -assert.sameValue(Object.hasOwnProperty.call(C, "b"), false); - -verifyProperty(c, "b", { - value: 42, - enumerable: true, - writable: true, - configurable: true -}); - -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "c"), false); -assert.sameValue(Object.hasOwnProperty.call(c, "c"), false); - -verifyProperty(C, "c", { - value: fn, - enumerable: true, - writable: true, - configurable: true -}); - diff --git a/src/class-fields/static-private-names.case b/src/class-fields/static-private-names.case deleted file mode 100644 index 89f62976cd..0000000000 --- a/src/class-fields/static-private-names.case +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (C) 2017 Valerie Young. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -desc: literal private names -info: | - ClassElement: - ... - static FieldDefinition ; - - FieldDefinition: - ClassElementName Initializer_opt - - ClassElementName: - PrivateName - - PrivateName: - #IdentifierName -template: productions -features: [class-fields-private] ----*/ - -//- fields -static #x; static #y -//- privateinspectionfunctions - static x() { - this.#x = 42; - return this.#x; - } - static y() { - this.#y = 43; - return this.#y; - } -//- assertions - -// 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/src/class-fields/static-propname-constructor.case b/src/class-fields/static-propname-constructor.case deleted file mode 100644 index 3f3c845fc4..0000000000 --- a/src/class-fields/static-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: 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, class-fields-public] -template: propname-error-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 0a514572ed..0000000000 --- a/src/class-fields/static-propname-prototype.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: 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, class-fields-public] -template: propname-error-static ----*/ - -//- propname -prototype diff --git a/src/class-fields/static-redeclaration-symbol.case b/src/class-fields/static-redeclaration-symbol.case deleted file mode 100644 index cc811207d7..0000000000 --- a/src/class-fields/static-redeclaration-symbol.case +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (C) 2017 Leo Balter. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -desc: Redeclaration of public static fields with the same name -info: | - 2.13.2 Runtime Semantics: ClassDefinitionEvaluation - - ... - 30. Set the value of F's [[Fields]] internal slot to fieldRecords. - ... - 33. Let result be InitializeStaticFields(F). - - InitializeStaticFields(F) - - 3. Let fieldRecords be the value of F's [[Fields]] internal slot. - 4. For each item fieldRecord in order from fieldRecords, - a. If fieldRecord.[[static]] is true, then - i. Perform ? DefineField(F, fieldRecord). - -template: default -includes: [propertyHelper.js, compareArray.js] ----*/ - -//- setup -var x = []; -var y = Symbol(); -//- fields -static [y] = (x.push("a"), "old_value"); -static [y] = (x.push("b"), "same_value"); -static [y] = (x.push("c"), "same_value"); -//- assertions -assert.sameValue(Object.hasOwnProperty.call(C.prototype, y), false); - -verifyProperty(C, y, { - value: "same_value", - enumerable: true, - writable: true, - configurable: true -}); - -assert(compareArray(x, ["a", "b", "c"])); - -var c = new C(); -assert.sameValue(Object.hasOwnProperty.call(c, y), false); - -assert(compareArray(x, ["a", "b", "c"]), "static fields are not redefined on class instatiation"); diff --git a/src/class-fields/static-redeclaration.case b/src/class-fields/static-redeclaration.case deleted file mode 100644 index 46bfc9ddd3..0000000000 --- a/src/class-fields/static-redeclaration.case +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (C) 2017 Leo Balter. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -desc: Redeclaration of public static fields with the same name -info: | - 2.13.2 Runtime Semantics: ClassDefinitionEvaluation - - ... - 30. Set the value of F's [[Fields]] internal slot to fieldRecords. - ... - 33. Let result be InitializeStaticFields(F). - - InitializeStaticFields(F) - - 3. Let fieldRecords be the value of F's [[Fields]] internal slot. - 4. For each item fieldRecord in order from fieldRecords, - a. If fieldRecord.[[static]] is true, then - i. Perform ? DefineField(F, fieldRecord). - -template: default -includes: [propertyHelper.js, compareArray.js] ----*/ - -//- setup -var x = []; -//- fields -static y = (x.push("a"), "old_value"); -static ["y"] = (x.push("b"), "another_value"); -static "y" = (x.push("c"), "same_value"); -static y = (x.push("d"), "same_value"); -//- assertions -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "y"), false); - -verifyProperty(C, "y", { - value: "same_value", - enumerable: true, - writable: true, - configurable: true -}); - -assert(compareArray(x, ["a", "b", "c", "d"])); - -var c = new C(); -assert.sameValue(Object.hasOwnProperty.call(c, "y"), false); - -assert(compareArray(x, ["a", "b", "c", "d"]), "static fields are not redefined on class instatiation"); diff --git a/test/language/expressions/class/fields-computed-name-static-propname-constructor.js b/test/language/expressions/class/fields-computed-name-static-propname-constructor.js deleted file mode 100644 index 9cbd70502b..0000000000 --- a/test/language/expressions/class/fields-computed-name-static-propname-constructor.js +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (C) 2017 Valerie Young. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -description: > - static class fields forbid PropName 'constructor' (no early error for - ComputedPropertyName) -esid: sec-class-definitions-static-semantics-early-errors -features: [class, class-fields-public] -info: | - Static Semantics: PropName - ... - ComputedPropertyName : [ AssignmentExpression ] - Return empty. - - // This test file also tests the ComputedPropertyName won't trigger the - // following early error: - Static Semantics: Early Errors - - ClassElement : staticFieldDefinition; - It is a Syntax Error if PropName of FieldDefinition is "prototype" or - "constructor". ----*/ - -var C = class { - static ["constructor"]; -}; - -assert.sameValue(C.hasOwnProperty("constructor"), true); - -var c = new C(); -assert.sameValue(c.hasOwnProperty("constructor"), false); diff --git a/test/language/expressions/class/fields-computed-name-static-propname-prototype.js b/test/language/expressions/class/fields-computed-name-static-propname-prototype.js deleted file mode 100644 index 97edf0e44e..0000000000 --- a/test/language/expressions/class/fields-computed-name-static-propname-prototype.js +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (C) 2017 Valerie Young. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -description: > - Cannot redefine a non-configurable, non-writable "prototype" property -esid: runtime-semantics-class-definition-evaluation -features: [class, class-fields-public] -info: | - // This test file also tests the ComputedPropertyName won't trigger the - // following early error: - Static Semantics: Early Errors - - ClassElement : staticFieldDefinition; - It is a Syntax Error if PropName of FieldDefinition is "prototype" or - "constructor". - - 2.13.2 Runtime Semantics: ClassDefinitionEvaluation - - ... - 21. Perform MakeConstructor(F, false, proto). - ... - 25. Else, let elements be NonConstructorMethodDefinitions of ClassBody. - 26. Let fieldRecords be a new empty List. - 26. For each ClassElement me in order from elements - a. If IsStatic of me is false, then - i. Let fields be the result of performing ClassElementEvaluation for e - with arguments proto and false. - ... - 33. Let result be InitializeStaticFields(F). - ... - - // ClassElementEvaluation should evaluate the ComputedPropertyName - - 12.2.6.7 Runtime Semantics: Evaluation - - ComputedPropertyName:[AssignmentExpression] - - 1. Let exprValue be the result of evaluating AssignmentExpression. - 2. Let propName be ? GetValue(exprValue). - 3. Return ? ToPropertyKey(propName). - - // And the Static Fields should be defined to the class - - 2.8 InitializeStaticFields(F) - - ... - 3. Let fieldRecords be the value of F's [[Fields]] internal slot. - 4. For each item fieldRecord in order from fieldRecords, - a. If fieldRecord.[[static]] is true, then - i. Perform ? DefineField(F, fieldRecord). ----*/ - -assert.throws(TypeError, function() { - var C = class { - static ["prototype"]; - }; -}); diff --git a/test/language/statements/class/fields-computed-name-static-propname-constructor.js b/test/language/statements/class/fields-computed-name-static-propname-constructor.js deleted file mode 100644 index 760e89bef1..0000000000 --- a/test/language/statements/class/fields-computed-name-static-propname-constructor.js +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (C) 2017 Valerie Young. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -description: > - static class fields forbid PropName 'constructor' (no early error for - ComputedPropertyName) -esid: sec-class-definitions-static-semantics-early-errors -features: [class, class-fields-public] -info: | - Static Semantics: PropName - ... - ComputedPropertyName : [ AssignmentExpression ] - Return empty. - - // This test file also tests the ComputedPropertyName won't trigger the - // following early error: - Static Semantics: Early Errors - - ClassElement : staticFieldDefinition; - It is a Syntax Error if PropName of FieldDefinition is "prototype" or - "constructor". ----*/ - -class C { - static ["constructor"]; -} - -assert.sameValue(C.hasOwnProperty("constructor"), true); - -var c = new C(); -assert.sameValue(c.hasOwnProperty("constructor"), false); diff --git a/test/language/statements/class/fields-computed-name-static-propname-prototype.js b/test/language/statements/class/fields-computed-name-static-propname-prototype.js deleted file mode 100644 index df50d86154..0000000000 --- a/test/language/statements/class/fields-computed-name-static-propname-prototype.js +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (C) 2017 Valerie Young. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -description: > - Cannot redefine a non-configurable, non-writable "prototype" property -esid: runtime-semantics-class-definition-evaluation -features: [class, class-fields-public] -info: | - // This test file also tests the ComputedPropertyName won't trigger the - // following early error: - Static Semantics: Early Errors - - ClassElement : staticFieldDefinition; - It is a Syntax Error if PropName of FieldDefinition is "prototype" or - "constructor". - - 2.13.2 Runtime Semantics: ClassDefinitionEvaluation - - ... - 21. Perform MakeConstructor(F, false, proto). - ... - 25. Else, let elements be NonConstructorMethodDefinitions of ClassBody. - 26. Let fieldRecords be a new empty List. - 26. For each ClassElement me in order from elements - a. If IsStatic of me is false, then - i. Let fields be the result of performing ClassElementEvaluation for e - with arguments proto and false. - ... - 33. Let result be InitializeStaticFields(F). - ... - - // ClassElementEvaluation should evaluate the ComputedPropertyName - - 12.2.6.7 Runtime Semantics: Evaluation - - ComputedPropertyName:[AssignmentExpression] - - 1. Let exprValue be the result of evaluating AssignmentExpression. - 2. Let propName be ? GetValue(exprValue). - 3. Return ? ToPropertyKey(propName). - - // And the Static Fields should be defined to the class - - 2.8 InitializeStaticFields(F) - - ... - 3. Let fieldRecords be the value of F's [[Fields]] internal slot. - 4. For each item fieldRecord in order from fieldRecords, - a. If fieldRecord.[[static]] is true, then - i. Perform ? DefineField(F, fieldRecord). ----*/ - -assert.throws(TypeError, function() { - class C { - static ["prototype"]; - }; -}); diff --git a/test/language/statements/class/static-classelementname-abrupt-completion.js b/test/language/statements/class/static-classelementname-abrupt-completion.js deleted file mode 100644 index 77e10ed27b..0000000000 --- a/test/language/statements/class/static-classelementname-abrupt-completion.js +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (C) 2017 Valerie Young. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -description: Class definition should error if evaluation of static ClassElementName errors -esid: runtime-semantics-class-definition-evaluation -info: | - Runtime Semantics: ClassDefinitionEvaluation - ... - 27. For each ClassElement e in order from elements - a. If IsStatic of e is false, then - i. Let fields be the result of performing ClassElementEvaluation for e with arguments proto and false. - b. Else, - i. Let fields be the result of performing ClassElementEvaluation for e with arguments F and false. - c. If fields is an abrupt completion, then - i. Set the running execution context's LexicalEnvironment to lex. - ii. Set the running execution context's PrivateNameEnvironment to outerPrivateEnvironment. - iii. Return Completion(status). - - Runtime Semantics: ClassElementEvaluation - ... - ClassElement : static FieldDefinition ; - 1. Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter true and object. - - Runtime Semantics: ClassFieldDefinitionEvaluation - With parameters isStatic and homeObject. - FieldDefinition : ClassElementNameInitializer - 1. Let fieldName be the result of evaluating ClassElementName. - 2. ReturnIfAbrupt(fieldName). - -features: [class, class-fields-public] ----*/ - -function f() { - throw new Test262Error(); -} - -assert.throws(Test262Error, function() { - class C { - static [f()] - } -}); diff --git a/test/language/statements/class/static-fielddefinition-initializer-abrupt-completion.js b/test/language/statements/class/static-fielddefinition-initializer-abrupt-completion.js deleted file mode 100644 index 93ae753081..0000000000 --- a/test/language/statements/class/static-fielddefinition-initializer-abrupt-completion.js +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (C) 2017 Valerie Young. All rights reserved. -// This code is governed by the BSD license found in the LICENSE file. - -/*--- -description: Class construction should error if evaluation of static field initializer errors -esid: runtime-semantics-class-definition-evaluation -info: | - Runtime Semantics: ClassDefinitionEvaluation - ... - 33. Let result be InitializeStaticFields(F). - 34. If result is an abrupt completion, then - a. Set the running execution context's LexicalEnvironment to lex. - b. Return Completion(result). - - InitializeStaticFields(F) - 1. Assert: Type(F) is Object. - 2. Assert: F is an ECMAScript function object. - 3. Let fieldRecords be the value of F's [[Fields]] internal slot. - 4. For each item fieldRecord in order from fieldRecords, - a. If fieldRecord.[[static]] is true, then - i. Perform ? DefineField(F, fieldRecord). - - DefineField(receiver, fieldRecord) - 1. Assert: Type(receiver) is Object. - 2. Assert: fieldRecord is a Record as created by ClassFieldDefinitionEvaluation. - 3. Let fieldName be fieldRecord.[[Name]]. - 4. Let initializer be fieldRecord.[[Initializer]]. - 5. If initializer is not empty, then - a. Let initValue be ? Call(initializer, receiver). - -features: [class, class-fields-public] ----*/ - -function f() { - throw new Test262Error(); -} - -assert.throws(Test262Error, function() { - class C { - static x = f(); - } -}) -- GitLab