diff --git a/src/class-elements/static-as-valid-instance-field.case b/src/class-elements/static-as-valid-instance-field.case new file mode 100644 index 0000000000..729f452cfe --- /dev/null +++ b/src/class-elements/static-as-valid-instance-field.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/test/language/expressions/class/elements/static-as-valid-instance-field.js b/test/language/expressions/class/elements/static-as-valid-instance-field.js new file mode 100644 index 0000000000..66e1a693ab --- /dev/null +++ b/test/language/expressions/class/elements/static-as-valid-instance-field.js @@ -0,0 +1,36 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/static-as-valid-instance-field.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/statements/class/elements/static-as-valid-instance-field.js b/test/language/statements/class/elements/static-as-valid-instance-field.js new file mode 100644 index 0000000000..b1844783f6 --- /dev/null +++ b/test/language/statements/class/elements/static-as-valid-instance-field.js @@ -0,0 +1,36 @@ +// This file was procedurally generated from the following sources: +// - src/class-elements/static-as-valid-instance-field.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 +}); +