From 6499fa67943f21c3dd9de1cea1580e36561829c9 Mon Sep 17 00:00:00 2001 From: Caio Lima Date: Mon, 30 Mar 2020 16:30:34 -0300 Subject: [PATCH] Adding missing cases of instance field without assignment and static field with assignment --- ...atic-as-valid-instance-field-assigned.case | 32 +++++++++++++++++ .../static-as-valid-instance-field.case | 4 +-- ...static-as-valid-static-field-assigned.case | 24 +++++++++++++ ...static-as-valid-instance-field-assigned.js | 36 +++++++++++++++++++ .../static-as-valid-instance-field.js | 4 +-- .../static-as-valid-static-field-assigned.js | 28 +++++++++++++++ ...static-as-valid-instance-field-assigned.js | 36 +++++++++++++++++++ .../static-as-valid-instance-field.js | 4 +-- .../static-as-valid-static-field-assigned.js | 28 +++++++++++++++ 9 files changed, 190 insertions(+), 6 deletions(-) create mode 100644 src/class-elements/static-as-valid-instance-field-assigned.case create mode 100644 src/class-elements/static-as-valid-static-field-assigned.case create mode 100644 test/language/expressions/class/elements/static-as-valid-instance-field-assigned.js create mode 100644 test/language/expressions/class/elements/static-as-valid-static-field-assigned.js create mode 100644 test/language/statements/class/elements/static-as-valid-instance-field-assigned.js create mode 100644 test/language/statements/class/elements/static-as-valid-static-field-assigned.js diff --git a/src/class-elements/static-as-valid-instance-field-assigned.case b/src/class-elements/static-as-valid-instance-field-assigned.case new file mode 100644 index 0000000000..729f452cfe --- /dev/null +++ b/src/class-elements/static-as-valid-instance-field-assigned.case @@ -0,0 +1,32 @@ +// Copyright (C) 2020 Igalia S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +desc: static is a valid name of an instance field +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName +template: default +includes: [propertyHelper.js] +features: [class-fields-public] +---*/ + +//- elements +static = "foo"; +//- assertions +let c = new C(); + +verifyProperty(c, "static", { + value: "foo", + enumerable: true, + writable: true, + configurable: true +}); + diff --git a/src/class-elements/static-as-valid-instance-field.case b/src/class-elements/static-as-valid-instance-field.case index 729f452cfe..2fd0139e08 100644 --- a/src/class-elements/static-as-valid-instance-field.case +++ b/src/class-elements/static-as-valid-instance-field.case @@ -19,12 +19,12 @@ features: [class-fields-public] ---*/ //- elements -static = "foo"; +static; //- assertions let c = new C(); verifyProperty(c, "static", { - value: "foo", + value: undefined, enumerable: true, writable: true, configurable: true diff --git a/src/class-elements/static-as-valid-static-field-assigned.case b/src/class-elements/static-as-valid-static-field-assigned.case new file mode 100644 index 0000000000..9f003461e8 --- /dev/null +++ b/src/class-elements/static-as-valid-static-field-assigned.case @@ -0,0 +1,24 @@ +// Copyright (C) 2020 Igalia S.L. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +desc: static is a valid name of a static field +info: | + ClassElement: + ... + static FieldDefinition ; +template: default +includes: [propertyHelper.js] +features: [class-static-fields-public] +---*/ + +//- elements +static static = "test262"; +//- assertions +verifyProperty(C, "static", { + value: "test262", + enumerable: true, + writable: true, + configurable: true +}); + diff --git a/test/language/expressions/class/elements/static-as-valid-instance-field-assigned.js b/test/language/expressions/class/elements/static-as-valid-instance-field-assigned.js new file mode 100644 index 0000000000..55e5ba82b0 --- /dev/null +++ b/test/language/expressions/class/elements/static-as-valid-instance-field-assigned.js @@ -0,0 +1,36 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/static-as-valid-instance-field-assigned.case +// - src/class-elements/default/cls-expr.template +/*--- +description: static is a valid name of an instance field (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + static = "foo"; +} + +let c = new C(); + +verifyProperty(c, "static", { + value: "foo", + enumerable: true, + writable: true, + configurable: true +}); + diff --git a/test/language/expressions/class/elements/static-as-valid-instance-field.js b/test/language/expressions/class/elements/static-as-valid-instance-field.js index 66e1a693ab..355703f06b 100644 --- a/test/language/expressions/class/elements/static-as-valid-instance-field.js +++ b/test/language/expressions/class/elements/static-as-valid-instance-field.js @@ -22,13 +22,13 @@ info: | var C = class { - static = "foo"; + static; } let c = new C(); verifyProperty(c, "static", { - value: "foo", + value: undefined, enumerable: true, writable: true, configurable: true diff --git a/test/language/expressions/class/elements/static-as-valid-static-field-assigned.js b/test/language/expressions/class/elements/static-as-valid-static-field-assigned.js new file mode 100644 index 0000000000..e3f30a63e4 --- /dev/null +++ b/test/language/expressions/class/elements/static-as-valid-static-field-assigned.js @@ -0,0 +1,28 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/static-as-valid-static-field-assigned.case +// - src/class-elements/default/cls-expr.template +/*--- +description: static is a valid name of a static field (field definitions in a class expression) +esid: prod-FieldDefinition +features: [class-static-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + static FieldDefinition ; + +---*/ + + +var C = class { + static static = "test262"; +} + +verifyProperty(C, "static", { + value: "test262", + enumerable: true, + writable: true, + configurable: true +}); + diff --git a/test/language/statements/class/elements/static-as-valid-instance-field-assigned.js b/test/language/statements/class/elements/static-as-valid-instance-field-assigned.js new file mode 100644 index 0000000000..a88860f3fb --- /dev/null +++ b/test/language/statements/class/elements/static-as-valid-instance-field-assigned.js @@ -0,0 +1,36 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/static-as-valid-instance-field-assigned.case +// - src/class-elements/default/cls-decl.template +/*--- +description: static is a valid name of an instance field (field definitions in a class declaration) +esid: prod-FieldDefinition +features: [class-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +class C { + static = "foo"; +} + +let c = new C(); + +verifyProperty(c, "static", { + value: "foo", + enumerable: true, + writable: true, + configurable: true +}); + diff --git a/test/language/statements/class/elements/static-as-valid-instance-field.js b/test/language/statements/class/elements/static-as-valid-instance-field.js index b1844783f6..0abf7334b6 100644 --- a/test/language/statements/class/elements/static-as-valid-instance-field.js +++ b/test/language/statements/class/elements/static-as-valid-instance-field.js @@ -22,13 +22,13 @@ info: | class C { - static = "foo"; + static; } let c = new C(); verifyProperty(c, "static", { - value: "foo", + value: undefined, enumerable: true, writable: true, configurable: true diff --git a/test/language/statements/class/elements/static-as-valid-static-field-assigned.js b/test/language/statements/class/elements/static-as-valid-static-field-assigned.js new file mode 100644 index 0000000000..24d6d085bf --- /dev/null +++ b/test/language/statements/class/elements/static-as-valid-static-field-assigned.js @@ -0,0 +1,28 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/static-as-valid-static-field-assigned.case +// - src/class-elements/default/cls-decl.template +/*--- +description: static is a valid name of a static field (field definitions in a class declaration) +esid: prod-FieldDefinition +features: [class-static-fields-public, class] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + static FieldDefinition ; + +---*/ + + +class C { + static static = "test262"; +} + +verifyProperty(C, "static", { + value: "test262", + enumerable: true, + writable: true, + configurable: true +}); +