From 432adbb61edc351b832192f8b77ed5cb5555adb2 Mon Sep 17 00:00:00 2001 From: Caio Lima Date: Sat, 28 Mar 2020 14:47:56 -0300 Subject: [PATCH] Adding case where 'static' is used as a field name --- .../static-as-valid-instance-field.case | 32 +++++++++++++++++ .../static-as-valid-instance-field.js | 36 +++++++++++++++++++ .../static-as-valid-instance-field.js | 36 +++++++++++++++++++ 3 files changed, 104 insertions(+) create mode 100644 src/class-elements/static-as-valid-instance-field.case create mode 100644 test/language/expressions/class/elements/static-as-valid-instance-field.js create mode 100644 test/language/statements/class/elements/static-as-valid-instance-field.js 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 +}); +