diff --git a/features.txt b/features.txt index 62201f2d473bc2c1fc1a558bc6dd412f349e575a..0db12e018f2c3cfb420e0297b6d48f6c85ce38a8 100644 --- a/features.txt +++ b/features.txt @@ -11,6 +11,10 @@ # https://github.com/tc39/proposal-bigint BigInt +# Class Fields +# https://github.com/tc39/proposal-class-fields +class-fields + # Promise.prototype.finally # https://github.com/tc39/proposal-promise-finally Promise.prototype.finally @@ -62,6 +66,7 @@ arrow-function async-functions caller class +computed-property-names const DataView DataView.prototype.getFloat32 diff --git a/src/class-fields/computed-names.case b/src/class-fields/computed-names.case new file mode 100644 index 0000000000000000000000000000000000000000..fcfaf53219ad65e5eb1ab572fa23afc2546a0080 --- /dev/null +++ b/src/class-fields/computed-names.case @@ -0,0 +1,70 @@ +// 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. + +/*--- +esid: prod-FieldDefinition +desc: Computed property names +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName +template: default +includes: [propertyHelper.js] +features: [computed-property-names] +---*/ + +//- setup +var x = "b"; + +//- fields +static ["a"] = 39; [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); + +verifyProperty(c, "b", { + 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, "10"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + +verifyProperty(c, "not initialized", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); diff --git a/src/class-fields/computed-symbol-names.case b/src/class-fields/computed-symbol-names.case new file mode 100644 index 0000000000000000000000000000000000000000..9a7aec851816e08893f42c0d07c9ca0cb62e2a7f --- /dev/null +++ b/src/class-fields/computed-symbol-names.case @@ -0,0 +1,55 @@ +// 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. + +/*--- +esid: prod-FieldDefinition +desc: Computed property symbol names +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName +template: default +includes: [propertyHelper.js] +features: [Symbol, computed-property-names] +---*/ + +//- setup +var x = Symbol(); +var y = Symbol(); + +//- fields +[x]; [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/conventions.md b/src/class-fields/conventions.md new file mode 100644 index 0000000000000000000000000000000000000000..b7fbee91bc02ce56b308461a5a6bbf6f6c7e181e --- /dev/null +++ b/src/class-fields/conventions.md @@ -0,0 +1,8 @@ +# Conventions for the class fields templates and cases + +Templates should produce a class named `C` and instantiate it to an object named `c`. + +## Known template fields: + +* fields: it should contain the list of class fields, inserted in the class body. Please, avoid closing a field with a trailing semi-colon, this might prevent ASI checks properly. +* assertions: it should contain the assertions to run after the class object is instantiated. diff --git a/src/class-fields/default/cls-decl-after-same-line-async-gen.template b/src/class-fields/default/cls-decl-after-same-line-async-gen.template new file mode 100644 index 0000000000000000000000000000000000000000..49983da696ca3a2f91190f8340d49b03e7c4db07 --- /dev/null +++ b/src/class-fields/default/cls-decl-after-same-line-async-gen.template @@ -0,0 +1,30 @@ +// 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. + +/*--- +path: language/statements/class/fields-same-line-async-gen- +name: field definitions after an async generator in the same line +features: [class-fields, async-iteration] +flags: [async] +---*/ + +class C { + async *m() { return 42; } /*{ fields }*/; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +/*{ assertions }*/ + +c.m().next().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/src/class-fields/default/cls-decl-after-same-line-async-method.template b/src/class-fields/default/cls-decl-after-same-line-async-method.template new file mode 100644 index 0000000000000000000000000000000000000000..a261640ddfbc52335108f37f4f8b314d963ac070 --- /dev/null +++ b/src/class-fields/default/cls-decl-after-same-line-async-method.template @@ -0,0 +1,30 @@ +// 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. + +/*--- +path: language/statements/class/fields-same-line-async-method- +name: field definitions after an async method in the same line +features: [class-fields, async-functions] +flags: [async] +---*/ + +class C { + async m() { return 42; } /*{ fields }*/; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +/*{ assertions }*/ + +c.m().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/src/class-fields/default/cls-decl-after-same-line-gen.template b/src/class-fields/default/cls-decl-after-same-line-gen.template new file mode 100644 index 0000000000000000000000000000000000000000..e96d4e9ea1e20497937b8c33a6a448509f327925 --- /dev/null +++ b/src/class-fields/default/cls-decl-after-same-line-gen.template @@ -0,0 +1,26 @@ +// 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. + +/*--- +path: language/statements/class/fields-after-same-line-gen- +name: field definitions after a generator in the same line +features: [class-fields] +---*/ + +class C { + *m() { return 42; } /*{ fields }*/; +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +/*{ assertions }*/ diff --git a/src/class-fields/default/cls-decl-after-same-line-method.template b/src/class-fields/default/cls-decl-after-same-line-method.template new file mode 100644 index 0000000000000000000000000000000000000000..1ac0fa6ea6b5baef37482cc19f79055fd09ceb21 --- /dev/null +++ b/src/class-fields/default/cls-decl-after-same-line-method.template @@ -0,0 +1,26 @@ +// 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. + +/*--- +path: language/statements/class/fields-after-same-line-method- +name: field definitions after a method in the same line +features: [class-fields] +---*/ + +class C { + m() { return 42; } /*{ fields }*/; +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +/*{ assertions }*/ diff --git a/src/class-fields/default/cls-decl-after-same-line-static-async-gen.template b/src/class-fields/default/cls-decl-after-same-line-static-async-gen.template new file mode 100644 index 0000000000000000000000000000000000000000..5d5ad3f3e6b60f6354a7998c22986bcd9b4a4a0a --- /dev/null +++ b/src/class-fields/default/cls-decl-after-same-line-static-async-gen.template @@ -0,0 +1,30 @@ +// 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. + +/*--- +path: language/statements/class/fields-after-same-line-static-async-gen- +name: field definitions after a static async generator in the same line +features: [class-fields, async-iteration] +flags: [async] +---*/ + +class C { + static async *m() { return 42; } /*{ fields }*/; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +/*{ assertions }*/ + +C.m().next().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/src/class-fields/default/cls-decl-after-same-line-static-async-method.template b/src/class-fields/default/cls-decl-after-same-line-static-async-method.template new file mode 100644 index 0000000000000000000000000000000000000000..f83605e6131abc5a7847f2983ee711e9bf742994 --- /dev/null +++ b/src/class-fields/default/cls-decl-after-same-line-static-async-method.template @@ -0,0 +1,30 @@ +// 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. + +/*--- +path: language/statements/class/fields-after-same-line-static-async-method- +name: field definitions after a static async method in the same line +features: [class-fields, async-functions] +flags: [async] +---*/ + +class C { + static async m() { return 42; } /*{ fields }*/; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +/*{ assertions }*/ + +C.m().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/src/class-fields/default/cls-decl-after-same-line-static-gen.template b/src/class-fields/default/cls-decl-after-same-line-static-gen.template new file mode 100644 index 0000000000000000000000000000000000000000..31f7ac67833ec11f11fbcf2e24e02051f68aa6cf --- /dev/null +++ b/src/class-fields/default/cls-decl-after-same-line-static-gen.template @@ -0,0 +1,26 @@ +// 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. + +/*--- +path: language/statements/class/fields-after-same-line-static-gen- +name: field definitions after a static generator in the same line +features: [class-fields] +---*/ + +class C { + static *m() { return 42; } /*{ fields }*/; +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +/*{ assertions }*/ diff --git a/src/class-fields/default/cls-decl-after-same-line-static-method.template b/src/class-fields/default/cls-decl-after-same-line-static-method.template new file mode 100644 index 0000000000000000000000000000000000000000..5b828cc60007b4e8cb5d17c572fbb415e8c67119 --- /dev/null +++ b/src/class-fields/default/cls-decl-after-same-line-static-method.template @@ -0,0 +1,26 @@ +// 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. + +/*--- +path: language/statements/class/fields-after-same-line-static-method- +name: field definitions after a static method in the same line +features: [class-fields] +---*/ + +class C { + static m() { return 42; } /*{ fields }*/; +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +/*{ assertions }*/ diff --git a/src/class-fields/default/cls-decl-multiple-definitions.template b/src/class-fields/default/cls-decl-multiple-definitions.template new file mode 100644 index 0000000000000000000000000000000000000000..4aaa9f3069990ed5d400f3ea24794952fe54fee8 --- /dev/null +++ b/src/class-fields/default/cls-decl-multiple-definitions.template @@ -0,0 +1,62 @@ +// 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. + +/*--- +path: language/statements/class/fields-multiple-definitions- +name: multiple fields definitions +features: [class-fields] +---*/ + +class C { + foo = "foobar"; + m() { return 42 } + /*{ fields }*/ + m2() { return 39 } + bar = "barbaz"; +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: false, + configurable: true, + writable: true, +}); + +/*{ assertions }*/ diff --git a/src/class-fields/default/cls-decl-multiple-stacked-definitions.template b/src/class-fields/default/cls-decl-multiple-stacked-definitions.template new file mode 100644 index 0000000000000000000000000000000000000000..d078ed5c05225ce8e5b2f268126d1cf5ba027e53 --- /dev/null +++ b/src/class-fields/default/cls-decl-multiple-stacked-definitions.template @@ -0,0 +1,44 @@ +// 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. + +/*--- +path: language/statements/class/fields-multiple-stacked-definitions- +name: multiple stacked fields definitions through ASI +features: [class-fields] +---*/ + +class C { + /*{ fields }*/ + foo = "foobar" + bar = "barbaz"; +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: false, + configurable: true, + writable: true, +}); + +/*{ assertions }*/ diff --git a/src/class-fields/default/cls-decl-new-no-sc-line-method.template b/src/class-fields/default/cls-decl-new-no-sc-line-method.template new file mode 100644 index 0000000000000000000000000000000000000000..a33cab62e5ae064bf6405220eead172ec946e7d3 --- /dev/null +++ b/src/class-fields/default/cls-decl-new-no-sc-line-method.template @@ -0,0 +1,27 @@ +// 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. + +/*--- +path: language/statements/class/fields-new-no-sc-line-method- +name: field definitions followed by a method in a new line without a semicolon +features: [class-fields] +---*/ + +class C { + /*{ fields }*/ + m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +/*{ assertions }*/ diff --git a/src/class-fields/default/cls-decl-new-sc-line-generator.template b/src/class-fields/default/cls-decl-new-sc-line-generator.template new file mode 100644 index 0000000000000000000000000000000000000000..c124d126e09d4b98bc3481c7a9ab2517f3551c43 --- /dev/null +++ b/src/class-fields/default/cls-decl-new-sc-line-generator.template @@ -0,0 +1,27 @@ +// 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. + +/*--- +path: language/statements/class/fields-new-sc-line-gen- +name: field definitions followed by a method in a new line with a semicolon +features: [class-fields, generators] +---*/ + +class C { + /*{ fields }*/; + *m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.g().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +/*{ assertions }*/ diff --git a/src/class-fields/default/cls-decl-new-sc-line-method.template b/src/class-fields/default/cls-decl-new-sc-line-method.template new file mode 100644 index 0000000000000000000000000000000000000000..27349f228044d2b88037d5b36791763c531b52c5 --- /dev/null +++ b/src/class-fields/default/cls-decl-new-sc-line-method.template @@ -0,0 +1,27 @@ +// 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. + +/*--- +path: language/statements/class/fields-new-sc-line-method- +name: field definitions followed by a method in a new line with a semicolon +features: [class-fields] +---*/ + +class C { + /*{ fields }*/; + m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +/*{ assertions }*/ diff --git a/src/class-fields/default/cls-decl-regular-definitions.template b/src/class-fields/default/cls-decl-regular-definitions.template new file mode 100644 index 0000000000000000000000000000000000000000..1ba379ad27ddbe6c380e1123db492468517673ce --- /dev/null +++ b/src/class-fields/default/cls-decl-regular-definitions.template @@ -0,0 +1,16 @@ +// 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. + +/*--- +path: language/statements/class/fields-regular-definitions- +name: regular fields defintion +features: [class-fields] +---*/ + +class C { + /*{ fields }*/ +} + +var c = new C(); + +/*{ assertions }*/ diff --git a/src/class-fields/default/cls-decl-same-line-generator.template b/src/class-fields/default/cls-decl-same-line-generator.template new file mode 100644 index 0000000000000000000000000000000000000000..c7067477e4ab0e11827db875ae35151690177bdc --- /dev/null +++ b/src/class-fields/default/cls-decl-same-line-generator.template @@ -0,0 +1,26 @@ +// 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. + +/*--- +path: language/statements/class/fields-same-line-gen- +name: field definitions followed by a generator method in the same line +features: [class-fields, generators] +---*/ + +class C { + /*{ fields }*/; *m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +/*{ assertions }*/ diff --git a/src/class-fields/default/cls-decl-same-line-method.template b/src/class-fields/default/cls-decl-same-line-method.template new file mode 100644 index 0000000000000000000000000000000000000000..2c1eb9bfa78f7aa078c62f31d418aaf0402ad9c3 --- /dev/null +++ b/src/class-fields/default/cls-decl-same-line-method.template @@ -0,0 +1,26 @@ +// 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. + +/*--- +path: language/statements/class/fields-same-line-method- +name: field definitions followed by a method in the same line +features: [class-fields] +---*/ + +class C { + /*{ fields }*/; m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +/*{ assertions }*/ diff --git a/src/class-fields/default/cls-decl-wrapped-in-sc.template b/src/class-fields/default/cls-decl-wrapped-in-sc.template new file mode 100644 index 0000000000000000000000000000000000000000..421f4b4adf4b5bea1f86d91bd4b3969c618d84c5 --- /dev/null +++ b/src/class-fields/default/cls-decl-wrapped-in-sc.template @@ -0,0 +1,18 @@ +// 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. + +/*--- +path: language/statements/class/fields-wrapped-in-sc- +name: fields definition wrapped in semicolons +features: [class-fields] +---*/ + +class C { + ;;;; + ;;;;;;/*{ fields }*/;;;;;;; + ;;;; +} + +var c = new C(); + +/*{ assertions }*/ diff --git a/src/class-fields/default/cls-expr-after-same-line-async-gen.template b/src/class-fields/default/cls-expr-after-same-line-async-gen.template new file mode 100644 index 0000000000000000000000000000000000000000..4d5b119677e7fd81f861105b7a2a30c61d65c75b --- /dev/null +++ b/src/class-fields/default/cls-expr-after-same-line-async-gen.template @@ -0,0 +1,30 @@ +// 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. + +/*--- +path: language/expressions/class/fields-same-line-async-gen- +name: field definitions after an async generator in the same line +features: [class-fields, async-iteration] +flags: [async] +---*/ + +var C = class { + async *m() { return 42; } /*{ fields }*/; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +/*{ assertions }*/ + +c.m().next().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/src/class-fields/default/cls-expr-after-same-line-async-method.template b/src/class-fields/default/cls-expr-after-same-line-async-method.template new file mode 100644 index 0000000000000000000000000000000000000000..52a8356a9b7e25dade9d5109e1b6e5d6b741491a --- /dev/null +++ b/src/class-fields/default/cls-expr-after-same-line-async-method.template @@ -0,0 +1,30 @@ +// 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. + +/*--- +path: language/expressions/class/fields-same-line-async-method- +name: field definitions after an async method in the same line +features: [class-fields, async-functions] +flags: [async] +---*/ + +var C = class { + async m() { return 42; } /*{ fields }*/; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +/*{ assertions }*/ + +c.m().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/src/class-fields/default/cls-expr-after-same-line-gen.template b/src/class-fields/default/cls-expr-after-same-line-gen.template new file mode 100644 index 0000000000000000000000000000000000000000..5fc7c64863c8ef4ebf631ce8b8fc16294f20a059 --- /dev/null +++ b/src/class-fields/default/cls-expr-after-same-line-gen.template @@ -0,0 +1,26 @@ +// 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. + +/*--- +path: language/expressions/class/fields-after-same-line-gen- +name: field definitions after a generator in the same line +features: [class-fields] +---*/ + +var C = class { + *m() { return 42; } /*{ fields }*/; +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +/*{ assertions }*/ diff --git a/src/class-fields/default/cls-expr-after-same-line-method.template b/src/class-fields/default/cls-expr-after-same-line-method.template new file mode 100644 index 0000000000000000000000000000000000000000..89c59504e6da9e3a8d6b596b859a58ef82f65469 --- /dev/null +++ b/src/class-fields/default/cls-expr-after-same-line-method.template @@ -0,0 +1,26 @@ +// 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. + +/*--- +path: language/expressions/class/fields-after-same-line-method- +name: field definitions after a method in the same line +features: [class-fields] +---*/ + +var C = class { + m() { return 42; } /*{ fields }*/; +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +/*{ assertions }*/ diff --git a/src/class-fields/default/cls-expr-after-same-line-static-async-gen.template b/src/class-fields/default/cls-expr-after-same-line-static-async-gen.template new file mode 100644 index 0000000000000000000000000000000000000000..f1fdb4f45de65ae8bfe677f78916a95ddb364320 --- /dev/null +++ b/src/class-fields/default/cls-expr-after-same-line-static-async-gen.template @@ -0,0 +1,30 @@ +// 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. + +/*--- +path: language/expressions/class/fields-after-same-line-static-async-gen- +name: field definitions after a static async generator in the same line +features: [class-fields, async-iteration] +flags: [async] +---*/ + +var C = class { + static async *m() { return 42; } /*{ fields }*/; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +/*{ assertions }*/ + +C.m().next().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/src/class-fields/default/cls-expr-after-same-line-static-async-method.template b/src/class-fields/default/cls-expr-after-same-line-static-async-method.template new file mode 100644 index 0000000000000000000000000000000000000000..caa1f2f234e0aa3c1bbcc5ffdbc8eb3992ef87dc --- /dev/null +++ b/src/class-fields/default/cls-expr-after-same-line-static-async-method.template @@ -0,0 +1,30 @@ +// 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. + +/*--- +path: language/expressions/class/fields-after-same-line-static-async-method- +name: field definitions after a static async method in the same line +features: [class-fields, async-functions] +flags: [async] +---*/ + +var C = class { + static async m() { return 42; } /*{ fields }*/; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +/*{ assertions }*/ + +C.m().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/src/class-fields/default/cls-expr-after-same-line-static-gen.template b/src/class-fields/default/cls-expr-after-same-line-static-gen.template new file mode 100644 index 0000000000000000000000000000000000000000..0caf1c6925d6d808f8e646f655132bdddf901a42 --- /dev/null +++ b/src/class-fields/default/cls-expr-after-same-line-static-gen.template @@ -0,0 +1,26 @@ +// 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. + +/*--- +path: language/expressions/class/fields-after-same-line-static-gen- +name: field definitions after a static generator in the same line +features: [class-fields] +---*/ + +var C = class { + static *m() { return 42; } /*{ fields }*/; +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +/*{ assertions }*/ diff --git a/src/class-fields/default/cls-expr-after-same-line-static-method.template b/src/class-fields/default/cls-expr-after-same-line-static-method.template new file mode 100644 index 0000000000000000000000000000000000000000..1512059bb6a2c513ebfe0b1eaef7f831a131e233 --- /dev/null +++ b/src/class-fields/default/cls-expr-after-same-line-static-method.template @@ -0,0 +1,26 @@ +// 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. + +/*--- +path: language/expressions/class/fields-after-same-line-static-method- +name: field definitions after a static method in the same line +features: [class-fields] +---*/ + +var C = class { + static m() { return 42; } /*{ fields }*/; +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +/*{ assertions }*/ diff --git a/src/class-fields/default/cls-expr-multiple-definitions.template b/src/class-fields/default/cls-expr-multiple-definitions.template new file mode 100644 index 0000000000000000000000000000000000000000..a5440f6265e4ab71482c346968e6c8ee98acdb99 --- /dev/null +++ b/src/class-fields/default/cls-expr-multiple-definitions.template @@ -0,0 +1,62 @@ +// 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. + +/*--- +path: language/expressions/class/fields-multiple-definitions- +name: multiple fields definitions +features: [class-fields] +---*/ + +var C = class { + foo = "foobar"; + m() { return 42 } + /*{ fields }*/ + m2() { return 39 } + bar = "barbaz"; +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: false, + configurable: true, + writable: true, +}); + +/*{ assertions }*/ diff --git a/src/class-fields/default/cls-expr-multiple-stacked-definitions.template b/src/class-fields/default/cls-expr-multiple-stacked-definitions.template new file mode 100644 index 0000000000000000000000000000000000000000..bd0d63c784dc66d25941db2e373273382100df97 --- /dev/null +++ b/src/class-fields/default/cls-expr-multiple-stacked-definitions.template @@ -0,0 +1,44 @@ +// 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. + +/*--- +path: language/expressions/class/fields-multiple-stacked-definitions- +name: multiple stacked fields definitions through ASI +features: [class-fields] +---*/ + +var C = class { + /*{ fields }*/ + foo = "foobar" + bar = "barbaz"; +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: false, + configurable: true, + writable: true, +}); + +/*{ assertions }*/ diff --git a/src/class-fields/default/cls-expr-new-no-sc-line-method.template b/src/class-fields/default/cls-expr-new-no-sc-line-method.template new file mode 100644 index 0000000000000000000000000000000000000000..62ba2d6d567376f51cca87ec2fcb8bffd3fde334 --- /dev/null +++ b/src/class-fields/default/cls-expr-new-no-sc-line-method.template @@ -0,0 +1,27 @@ +// 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. + +/*--- +path: language/expressions/class/fields-new-no-sc-line-method- +name: field definitions followed by a method in a new line without a semicolon +features: [class-fields] +---*/ + +var C = class { + /*{ fields }*/ + m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +/*{ assertions }*/ diff --git a/src/class-fields/default/cls-expr-new-sc-line-generator.template b/src/class-fields/default/cls-expr-new-sc-line-generator.template new file mode 100644 index 0000000000000000000000000000000000000000..5ddf98c7cd39b808fcd66f974b1353e581ffcfb5 --- /dev/null +++ b/src/class-fields/default/cls-expr-new-sc-line-generator.template @@ -0,0 +1,27 @@ +// 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. + +/*--- +path: language/expressions/class/fields-new-sc-line-gen- +name: field definitions followed by a method in a new line with a semicolon +features: [class-fields, generators] +---*/ + +var C = class { + /*{ fields }*/; + *m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.g().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +/*{ assertions }*/ diff --git a/src/class-fields/default/cls-expr-new-sc-line-method.template b/src/class-fields/default/cls-expr-new-sc-line-method.template new file mode 100644 index 0000000000000000000000000000000000000000..f8e2e9c3bfe312ecd56653b871dd0e0afa69e6e6 --- /dev/null +++ b/src/class-fields/default/cls-expr-new-sc-line-method.template @@ -0,0 +1,27 @@ +// 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. + +/*--- +path: language/expressions/class/fields-new-sc-line-method- +name: field definitions followed by a method in a new line with a semicolon +features: [class-fields] +---*/ + +var C = class { + /*{ fields }*/; + m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +/*{ assertions }*/ diff --git a/src/class-fields/default/cls-expr-regular-definitions.template b/src/class-fields/default/cls-expr-regular-definitions.template new file mode 100644 index 0000000000000000000000000000000000000000..b00b9f3ff38738599fc7d09a27df8fe530c6256f --- /dev/null +++ b/src/class-fields/default/cls-expr-regular-definitions.template @@ -0,0 +1,16 @@ +// 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. + +/*--- +path: language/expressions/class/fields-regular-definitions- +name: regular fields defintion +features: [class-fields] +---*/ + +var C = class { + /*{ fields }*/ +} + +var c = new C(); + +/*{ assertions }*/ diff --git a/src/class-fields/default/cls-expr-same-line-generator.template b/src/class-fields/default/cls-expr-same-line-generator.template new file mode 100644 index 0000000000000000000000000000000000000000..7ac2f513a75064479418f290721eb14e855fb804 --- /dev/null +++ b/src/class-fields/default/cls-expr-same-line-generator.template @@ -0,0 +1,26 @@ +// 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. + +/*--- +path: language/expressions/class/fields-same-line-gen- +name: field definitions followed by a generator method in the same line +features: [class-fields, generators] +---*/ + +var C = class { + /*{ fields }*/; *m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +/*{ assertions }*/ diff --git a/src/class-fields/default/cls-expr-same-line-method.template b/src/class-fields/default/cls-expr-same-line-method.template new file mode 100644 index 0000000000000000000000000000000000000000..ac26e16fb0a29799cd0c74f68a9ad175cf34389a --- /dev/null +++ b/src/class-fields/default/cls-expr-same-line-method.template @@ -0,0 +1,26 @@ +// 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. + +/*--- +path: language/expressions/class/fields-same-line-method- +name: field definitions followed by a method in the same line +features: [class-fields] +---*/ + +var C = class { + /*{ fields }*/; m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +/*{ assertions }*/ diff --git a/src/class-fields/default/cls-expr-wrapped-in-sc.template b/src/class-fields/default/cls-expr-wrapped-in-sc.template new file mode 100644 index 0000000000000000000000000000000000000000..648d384961ec8cbfef04cd8acd6ca7a5afaa94bb --- /dev/null +++ b/src/class-fields/default/cls-expr-wrapped-in-sc.template @@ -0,0 +1,18 @@ +// 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. + +/*--- +path: language/expressions/class/fields-wrapped-in-sc- +name: fields definition wrapped in semicolons +features: [class-fields] +---*/ + +var C = class { + ;;;; + ;;;;;;/*{ fields }*/;;;;;;; + ;;;; +} + +var c = new C(); + +/*{ assertions }*/ diff --git a/src/class-fields/error/cls-decl-new-no-sc-line-generator.template b/src/class-fields/error/cls-decl-new-no-sc-line-generator.template new file mode 100644 index 0000000000000000000000000000000000000000..c7aebcdef8b385f1b9cd12bdcc71982df7c6526c --- /dev/null +++ b/src/class-fields/error/cls-decl-new-no-sc-line-generator.template @@ -0,0 +1,16 @@ +// 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. + +/*--- +path: language/statements/class/fields-new-no-sc-line-gen- +name: ASI prevents a following generator method +features: [class-fields, generators] +negative: + type: SyntaxError + phase: early +---*/ + +class C { + /*{ fields }*/ + *m() { return 42; } +} diff --git a/src/class-fields/info.txt b/src/class-fields/info.txt new file mode 100644 index 0000000000000000000000000000000000000000..236a9a1488cf8581ef97540748ef8e042683db38 --- /dev/null +++ b/src/class-fields/info.txt @@ -0,0 +1,16 @@ + ClassElement: + MethodDefinition + static MethodDefinition + FieldDefinition ; + static FieldDefinition ; + ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + PrivateName + + PrivateName :: + # IdentifierName \ No newline at end of file diff --git a/src/class-fields/literal-names.case b/src/class-fields/literal-names.case new file mode 100644 index 0000000000000000000000000000000000000000..9237fd9893a661849e5f691c67f3488b97c57780 --- /dev/null +++ b/src/class-fields/literal-names.case @@ -0,0 +1,57 @@ +// 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. + +/*--- +esid: prod-FieldDefinition +desc: Literal property names +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName +template: default +includes: [propertyHelper.js] +---*/ + +//- setup +const fn = function() {} + +//- fields +a; b = 42; +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-computed-names.case b/src/class-fields/static-computed-names.case new file mode 100644 index 0000000000000000000000000000000000000000..25905f004a19a642deb90899dab7539c410713bf --- /dev/null +++ b/src/class-fields/static-computed-names.case @@ -0,0 +1,40 @@ +// 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. + +/*--- +esid: prod-FieldDefinition +desc: Static Computed property names +info: | + ClassElement: + ... + FieldDefinition ; + static FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName +template: default +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 new file mode 100644 index 0000000000000000000000000000000000000000..32e10a3685bfb4fc7b38efd9a8879a0331285c69 --- /dev/null +++ b/src/class-fields/static-computed-symbol-names.case @@ -0,0 +1,55 @@ +// 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. + +/*--- +esid: prod-FieldDefinition +desc: Static computed property symbol names +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName +template: default +includes: [propertyHelper.js] +features: [Symbol, computed-property-names] +---*/ + +//- setup +var x = Symbol(); +var y = Symbol(); + +//- fields +[x]; [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 new file mode 100644 index 0000000000000000000000000000000000000000..0bd040ed42aef8586e583b7b153e66d045b5c254 --- /dev/null +++ b/src/class-fields/static-literal-names.case @@ -0,0 +1,57 @@ +// 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. + +/*--- +esid: prod-FieldDefinition +desc: Static literal property names +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName +template: default +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/string-literal-names.case b/src/class-fields/string-literal-names.case new file mode 100644 index 0000000000000000000000000000000000000000..98e37d5d083392bf81925e40a56db148cb9a2d3f --- /dev/null +++ b/src/class-fields/string-literal-names.case @@ -0,0 +1,33 @@ +// 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. + +/*--- +esid: prod-FieldDefinition +desc: String literal names +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName +template: default +includes: [propertyHelper.js] +---*/ + +//- fields +'a'; "b"; 'c' = 39; +"d" = 42 +//- assertions +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/expressions/class/fields-after-same-line-gen-computed-names.js b/test/language/expressions/class/fields-after-same-line-gen-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..491a1ce0b5a069e1caeb5190a3623659f808d3ca --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-gen-computed-names.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-names.case +// - src/class-fields/default/cls-expr-after-same-line-gen.template +/*--- +description: Computed property names (field definitions after a generator in the same line) +features: [computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = "b"; + + + +var C = class { + *m() { return 42; } static ["a"] = 39; [x] = 42; [10] = "meep"; ["not initialized"]; +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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); + +verifyProperty(c, "b", { + 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, "10"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + +verifyProperty(c, "not initialized", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/expressions/class/fields-after-same-line-gen-computed-symbol-names.js b/test/language/expressions/class/fields-after-same-line-gen-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..0c499e62f0196fc0725ca363b6f7b51094599bbf --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-gen-computed-symbol-names.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-symbol-names.case +// - src/class-fields/default/cls-expr-after-same-line-gen.template +/*--- +description: Computed property symbol names (field definitions after a generator in the same line) +features: [Symbol, computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +var C = class { + *m() { return 42; } [x]; [y] = 42; +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-after-same-line-gen-literal-names.js b/test/language/expressions/class/fields-after-same-line-gen-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..aa218f25cd00123e0455896aea8ad32933f59d68 --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-gen-literal-names.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names.case +// - src/class-fields/default/cls-expr-after-same-line-gen.template +/*--- +description: Literal property names (field definitions after a generator in the same line) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +var C = class { + *m() { return 42; } a; b = 42; + c = fn; +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-after-same-line-gen-static-computed-names.js b/test/language/expressions/class/fields-after-same-line-gen-static-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..8d0b9c1f0733dbe24ccc9fcdcfbf40be135ec2da --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-gen-static-computed-names.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-names.case +// - src/class-fields/default/cls-expr-after-same-line-gen.template +/*--- +description: Static Computed property names (field definitions after a generator in the same line) +features: [computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + static FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + *m() { return 42; } static ["a"] = 42; ["a"] = 39; +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-after-same-line-gen-static-computed-symbol-names.js b/test/language/expressions/class/fields-after-same-line-gen-static-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..155dc4e4057aa30b0b4a2b609c4476df63cf1747 --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-gen-static-computed-symbol-names.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-symbol-names.case +// - src/class-fields/default/cls-expr-after-same-line-gen.template +/*--- +description: Static computed property symbol names (field definitions after a generator in the same line) +features: [Symbol, computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +var C = class { + *m() { return 42; } [x]; [y] = 42; +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-after-same-line-gen-static-literal-names.js b/test/language/expressions/class/fields-after-same-line-gen-static-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..d2ec567a152c7def635ea560aa640b0d435af839 --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-gen-static-literal-names.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-literal-names.case +// - src/class-fields/default/cls-expr-after-same-line-gen.template +/*--- +description: Static literal property names (field definitions after a generator in the same line) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +var C = class { + *m() { return 42; } static a; b = 42; + static c = fn; +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-after-same-line-gen-string-literal-names.js b/test/language/expressions/class/fields-after-same-line-gen-string-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..9f5829ef8543bf652fbbec0e5a069f87dfadbd04 --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-gen-string-literal-names.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/string-literal-names.case +// - src/class-fields/default/cls-expr-after-same-line-gen.template +/*--- +description: String literal names (field definitions after a generator in the same line) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + *m() { return 42; } 'a'; "b"; 'c' = 39; + "d" = 42; +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/expressions/class/fields-after-same-line-method-computed-names.js b/test/language/expressions/class/fields-after-same-line-method-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..66f1d7123d2373878db37038b06242c9dce75149 --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-method-computed-names.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-names.case +// - src/class-fields/default/cls-expr-after-same-line-method.template +/*--- +description: Computed property names (field definitions after a method in the same line) +features: [computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = "b"; + + + +var C = class { + m() { return 42; } static ["a"] = 39; [x] = 42; [10] = "meep"; ["not initialized"]; +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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); + +verifyProperty(c, "b", { + 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, "10"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + +verifyProperty(c, "not initialized", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/expressions/class/fields-after-same-line-method-computed-symbol-names.js b/test/language/expressions/class/fields-after-same-line-method-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..0a4e57f10bdab86b71fc7fa2d3319ac03932a1fa --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-method-computed-symbol-names.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-symbol-names.case +// - src/class-fields/default/cls-expr-after-same-line-method.template +/*--- +description: Computed property symbol names (field definitions after a method in the same line) +features: [Symbol, computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +var C = class { + m() { return 42; } [x]; [y] = 42; +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-after-same-line-method-literal-names.js b/test/language/expressions/class/fields-after-same-line-method-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..009163696f85098f854cfe574fd5a9629e402242 --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-method-literal-names.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names.case +// - src/class-fields/default/cls-expr-after-same-line-method.template +/*--- +description: Literal property names (field definitions after a method in the same line) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +var C = class { + m() { return 42; } a; b = 42; + c = fn; +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-after-same-line-method-static-computed-names.js b/test/language/expressions/class/fields-after-same-line-method-static-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..4865b6fe797334bdb78e2ea6bd4fada7ebbb231e --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-method-static-computed-names.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-names.case +// - src/class-fields/default/cls-expr-after-same-line-method.template +/*--- +description: Static Computed property names (field definitions after a method in the same line) +features: [computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + static FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + m() { return 42; } static ["a"] = 42; ["a"] = 39; +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-after-same-line-method-static-computed-symbol-names.js b/test/language/expressions/class/fields-after-same-line-method-static-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..8839e0ce1ed8521143baea31c0d0133e0a0229b0 --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-method-static-computed-symbol-names.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-symbol-names.case +// - src/class-fields/default/cls-expr-after-same-line-method.template +/*--- +description: Static computed property symbol names (field definitions after a method in the same line) +features: [Symbol, computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +var C = class { + m() { return 42; } [x]; [y] = 42; +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-after-same-line-method-static-literal-names.js b/test/language/expressions/class/fields-after-same-line-method-static-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..42b9016dd1265475b1c7d4683b82c3cf1bdf2dae --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-method-static-literal-names.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-literal-names.case +// - src/class-fields/default/cls-expr-after-same-line-method.template +/*--- +description: Static literal property names (field definitions after a method in the same line) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +var C = class { + m() { return 42; } static a; b = 42; + static c = fn; +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-after-same-line-method-string-literal-names.js b/test/language/expressions/class/fields-after-same-line-method-string-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..c14fcca44a8cc5782385acea74a89647ca39d6b4 --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-method-string-literal-names.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/string-literal-names.case +// - src/class-fields/default/cls-expr-after-same-line-method.template +/*--- +description: String literal names (field definitions after a method in the same line) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + m() { return 42; } 'a'; "b"; 'c' = 39; + "d" = 42; +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-gen-computed-names.js b/test/language/expressions/class/fields-after-same-line-static-async-gen-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..679fb40c39443fa1248d2f6660a12409ad26a86c --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-static-async-gen-computed-names.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-names.case +// - src/class-fields/default/cls-expr-after-same-line-static-async-gen.template +/*--- +description: Computed property names (field definitions after a static async generator in the same line) +features: [computed-property-names, class-fields, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = "b"; + + + +var C = class { + static async *m() { return 42; } static ["a"] = 39; [x] = 42; [10] = "meep"; ["not initialized"]; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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); + +verifyProperty(c, "b", { + 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, "10"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + +verifyProperty(c, "not initialized", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +C.m().next().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-gen-computed-symbol-names.js b/test/language/expressions/class/fields-after-same-line-static-async-gen-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..e7af43a6c71c692109ac59dde96a22988efeca1b --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-static-async-gen-computed-symbol-names.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-symbol-names.case +// - src/class-fields/default/cls-expr-after-same-line-static-async-gen.template +/*--- +description: Computed property symbol names (field definitions after a static async generator in the same line) +features: [Symbol, computed-property-names, class-fields, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +var C = class { + static async *m() { return 42; } [x]; [y] = 42; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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); + +C.m().next().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-gen-literal-names.js b/test/language/expressions/class/fields-after-same-line-static-async-gen-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..16404bf454529b8e7bca978cb192fd3b3b8d6c30 --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-static-async-gen-literal-names.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names.case +// - src/class-fields/default/cls-expr-after-same-line-static-async-gen.template +/*--- +description: Literal property names (field definitions after a static async generator in the same line) +features: [class-fields, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +var C = class { + static async *m() { return 42; } a; b = 42; + c = fn; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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 +}); + + +C.m().next().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-gen-static-computed-names.js b/test/language/expressions/class/fields-after-same-line-static-async-gen-static-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..8f3b53926157714c842735e37ba9291832c2bfd1 --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-static-async-gen-static-computed-names.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-names.case +// - src/class-fields/default/cls-expr-after-same-line-static-async-gen.template +/*--- +description: Static Computed property names (field definitions after a static async generator in the same line) +features: [computed-property-names, class-fields, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + static FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + static async *m() { return 42; } static ["a"] = 42; ["a"] = 39; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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 +}); + +C.m().next().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-gen-static-computed-symbol-names.js b/test/language/expressions/class/fields-after-same-line-static-async-gen-static-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..3181605459bcc9c99dc5bbce2fd7f6fa5a241c09 --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-static-async-gen-static-computed-symbol-names.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-symbol-names.case +// - src/class-fields/default/cls-expr-after-same-line-static-async-gen.template +/*--- +description: Static computed property symbol names (field definitions after a static async generator in the same line) +features: [Symbol, computed-property-names, class-fields, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +var C = class { + static async *m() { return 42; } [x]; [y] = 42; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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); + +C.m().next().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-gen-static-literal-names.js b/test/language/expressions/class/fields-after-same-line-static-async-gen-static-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..de54ebf1225b1f239fce6236b3fb6e59a11c544a --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-static-async-gen-static-literal-names.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-literal-names.case +// - src/class-fields/default/cls-expr-after-same-line-static-async-gen.template +/*--- +description: Static literal property names (field definitions after a static async generator in the same line) +features: [class-fields, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +var C = class { + static async *m() { return 42; } static a; b = 42; + static c = fn; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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 +}); + + +C.m().next().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-gen-string-literal-names.js b/test/language/expressions/class/fields-after-same-line-static-async-gen-string-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..02dabe035f4776705590e65c9e3ae73a27be6190 --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-static-async-gen-string-literal-names.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/string-literal-names.case +// - src/class-fields/default/cls-expr-after-same-line-static-async-gen.template +/*--- +description: String literal names (field definitions after a static async generator in the same line) +features: [class-fields, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + static async *m() { return 42; } 'a'; "b"; 'c' = 39; + "d" = 42; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +C.m().next().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-method-computed-names.js b/test/language/expressions/class/fields-after-same-line-static-async-method-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..8f44260cff19ffec71a4b38f98145ca7edebd256 --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-static-async-method-computed-names.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-names.case +// - src/class-fields/default/cls-expr-after-same-line-static-async-method.template +/*--- +description: Computed property names (field definitions after a static async method in the same line) +features: [computed-property-names, class-fields, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = "b"; + + + +var C = class { + static async m() { return 42; } static ["a"] = 39; [x] = 42; [10] = "meep"; ["not initialized"]; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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); + +verifyProperty(c, "b", { + 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, "10"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + +verifyProperty(c, "not initialized", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +C.m().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-method-computed-symbol-names.js b/test/language/expressions/class/fields-after-same-line-static-async-method-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..1375c6ab9ccdf9459424b2ebd7ed94357dbeeed2 --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-static-async-method-computed-symbol-names.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-symbol-names.case +// - src/class-fields/default/cls-expr-after-same-line-static-async-method.template +/*--- +description: Computed property symbol names (field definitions after a static async method in the same line) +features: [Symbol, computed-property-names, class-fields, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +var C = class { + static async m() { return 42; } [x]; [y] = 42; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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); + +C.m().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-method-literal-names.js b/test/language/expressions/class/fields-after-same-line-static-async-method-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..7dc6938cef30298aebd35c4c7f0db8410935477b --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-static-async-method-literal-names.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names.case +// - src/class-fields/default/cls-expr-after-same-line-static-async-method.template +/*--- +description: Literal property names (field definitions after a static async method in the same line) +features: [class-fields, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +var C = class { + static async m() { return 42; } a; b = 42; + c = fn; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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 +}); + + +C.m().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-method-static-computed-names.js b/test/language/expressions/class/fields-after-same-line-static-async-method-static-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..0237b05a4766bdde0ee8c51df5107b67932b2fcc --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-static-async-method-static-computed-names.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-names.case +// - src/class-fields/default/cls-expr-after-same-line-static-async-method.template +/*--- +description: Static Computed property names (field definitions after a static async method in the same line) +features: [computed-property-names, class-fields, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + static FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + static async m() { return 42; } static ["a"] = 42; ["a"] = 39; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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 +}); + +C.m().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-method-static-computed-symbol-names.js b/test/language/expressions/class/fields-after-same-line-static-async-method-static-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..836856c7e9a54ccf33a4ef9f57e83c40741bdc77 --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-static-async-method-static-computed-symbol-names.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-symbol-names.case +// - src/class-fields/default/cls-expr-after-same-line-static-async-method.template +/*--- +description: Static computed property symbol names (field definitions after a static async method in the same line) +features: [Symbol, computed-property-names, class-fields, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +var C = class { + static async m() { return 42; } [x]; [y] = 42; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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); + +C.m().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-method-static-literal-names.js b/test/language/expressions/class/fields-after-same-line-static-async-method-static-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..7c87e5a94d099f7467d6439452e900e434c08b7b --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-static-async-method-static-literal-names.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-literal-names.case +// - src/class-fields/default/cls-expr-after-same-line-static-async-method.template +/*--- +description: Static literal property names (field definitions after a static async method in the same line) +features: [class-fields, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +var C = class { + static async m() { return 42; } static a; b = 42; + static c = fn; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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 +}); + + +C.m().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-method-string-literal-names.js b/test/language/expressions/class/fields-after-same-line-static-async-method-string-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..ca6964e737d4a3cb027725dabf791d3d22501d0c --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-static-async-method-string-literal-names.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/string-literal-names.case +// - src/class-fields/default/cls-expr-after-same-line-static-async-method.template +/*--- +description: String literal names (field definitions after a static async method in the same line) +features: [class-fields, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + static async m() { return 42; } 'a'; "b"; 'c' = 39; + "d" = 42; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +C.m().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-gen-computed-names.js b/test/language/expressions/class/fields-after-same-line-static-gen-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..1debe00c79625cceaf81164ceb8b3fa4feaa2bb2 --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-static-gen-computed-names.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-names.case +// - src/class-fields/default/cls-expr-after-same-line-static-gen.template +/*--- +description: Computed property names (field definitions after a static generator in the same line) +features: [computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = "b"; + + + +var C = class { + static *m() { return 42; } static ["a"] = 39; [x] = 42; [10] = "meep"; ["not initialized"]; +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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); + +verifyProperty(c, "b", { + 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, "10"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + +verifyProperty(c, "not initialized", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/expressions/class/fields-after-same-line-static-gen-computed-symbol-names.js b/test/language/expressions/class/fields-after-same-line-static-gen-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..5154f6eaaa9dba3a1816b355024870f259ceb4b1 --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-static-gen-computed-symbol-names.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-symbol-names.case +// - src/class-fields/default/cls-expr-after-same-line-static-gen.template +/*--- +description: Computed property symbol names (field definitions after a static generator in the same line) +features: [Symbol, computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +var C = class { + static *m() { return 42; } [x]; [y] = 42; +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-after-same-line-static-gen-literal-names.js b/test/language/expressions/class/fields-after-same-line-static-gen-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..ff4fc340938dd514d785d307a2e95973811faa5b --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-static-gen-literal-names.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names.case +// - src/class-fields/default/cls-expr-after-same-line-static-gen.template +/*--- +description: Literal property names (field definitions after a static generator in the same line) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +var C = class { + static *m() { return 42; } a; b = 42; + c = fn; +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-after-same-line-static-gen-static-computed-names.js b/test/language/expressions/class/fields-after-same-line-static-gen-static-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..2244f51adfc6f693c9f1ea35be9a8196b576a6c0 --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-static-gen-static-computed-names.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-names.case +// - src/class-fields/default/cls-expr-after-same-line-static-gen.template +/*--- +description: Static Computed property names (field definitions after a static generator in the same line) +features: [computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + static FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + static *m() { return 42; } static ["a"] = 42; ["a"] = 39; +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-after-same-line-static-gen-static-computed-symbol-names.js b/test/language/expressions/class/fields-after-same-line-static-gen-static-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..aed7ddbe0872a0417d3d5fbf2d1c9cf69c0a2384 --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-static-gen-static-computed-symbol-names.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-symbol-names.case +// - src/class-fields/default/cls-expr-after-same-line-static-gen.template +/*--- +description: Static computed property symbol names (field definitions after a static generator in the same line) +features: [Symbol, computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +var C = class { + static *m() { return 42; } [x]; [y] = 42; +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-after-same-line-static-gen-static-literal-names.js b/test/language/expressions/class/fields-after-same-line-static-gen-static-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..7af011fd698dc085c0e7a6df073f9ac7de7ef064 --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-static-gen-static-literal-names.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-literal-names.case +// - src/class-fields/default/cls-expr-after-same-line-static-gen.template +/*--- +description: Static literal property names (field definitions after a static generator in the same line) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +var C = class { + static *m() { return 42; } static a; b = 42; + static c = fn; +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-after-same-line-static-gen-string-literal-names.js b/test/language/expressions/class/fields-after-same-line-static-gen-string-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..c5bf79226ddc3efe30c39d9d96154d56a1a22ec1 --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-static-gen-string-literal-names.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/string-literal-names.case +// - src/class-fields/default/cls-expr-after-same-line-static-gen.template +/*--- +description: String literal names (field definitions after a static generator in the same line) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + static *m() { return 42; } 'a'; "b"; 'c' = 39; + "d" = 42; +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/expressions/class/fields-after-same-line-static-method-computed-names.js b/test/language/expressions/class/fields-after-same-line-static-method-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..d081cad3de02ee0c88bcd0f7c92a4f5f544467f6 --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-static-method-computed-names.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-names.case +// - src/class-fields/default/cls-expr-after-same-line-static-method.template +/*--- +description: Computed property names (field definitions after a static method in the same line) +features: [computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = "b"; + + + +var C = class { + static m() { return 42; } static ["a"] = 39; [x] = 42; [10] = "meep"; ["not initialized"]; +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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); + +verifyProperty(c, "b", { + 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, "10"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + +verifyProperty(c, "not initialized", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/expressions/class/fields-after-same-line-static-method-computed-symbol-names.js b/test/language/expressions/class/fields-after-same-line-static-method-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..246b66937a6dddf8d06a9189b6344e43b1c62a0e --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-static-method-computed-symbol-names.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-symbol-names.case +// - src/class-fields/default/cls-expr-after-same-line-static-method.template +/*--- +description: Computed property symbol names (field definitions after a static method in the same line) +features: [Symbol, computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +var C = class { + static m() { return 42; } [x]; [y] = 42; +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-after-same-line-static-method-literal-names.js b/test/language/expressions/class/fields-after-same-line-static-method-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..377f87bd405f680bd6865d79b144f8846e985614 --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-static-method-literal-names.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names.case +// - src/class-fields/default/cls-expr-after-same-line-static-method.template +/*--- +description: Literal property names (field definitions after a static method in the same line) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +var C = class { + static m() { return 42; } a; b = 42; + c = fn; +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-after-same-line-static-method-static-computed-names.js b/test/language/expressions/class/fields-after-same-line-static-method-static-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..ab26d3ec918304b5c403f65b113c96b0bae83fed --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-static-method-static-computed-names.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-names.case +// - src/class-fields/default/cls-expr-after-same-line-static-method.template +/*--- +description: Static Computed property names (field definitions after a static method in the same line) +features: [computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + static FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + static m() { return 42; } static ["a"] = 42; ["a"] = 39; +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-after-same-line-static-method-static-computed-symbol-names.js b/test/language/expressions/class/fields-after-same-line-static-method-static-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..a90ed6a0d9e49adab3165b6d2fe5422924c8becd --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-static-method-static-computed-symbol-names.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-symbol-names.case +// - src/class-fields/default/cls-expr-after-same-line-static-method.template +/*--- +description: Static computed property symbol names (field definitions after a static method in the same line) +features: [Symbol, computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +var C = class { + static m() { return 42; } [x]; [y] = 42; +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-after-same-line-static-method-static-literal-names.js b/test/language/expressions/class/fields-after-same-line-static-method-static-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..ba6f33f52f7e6af82169ed2be4dcdf417d4aca58 --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-static-method-static-literal-names.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-literal-names.case +// - src/class-fields/default/cls-expr-after-same-line-static-method.template +/*--- +description: Static literal property names (field definitions after a static method in the same line) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +var C = class { + static m() { return 42; } static a; b = 42; + static c = fn; +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-after-same-line-static-method-string-literal-names.js b/test/language/expressions/class/fields-after-same-line-static-method-string-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..63258c1da65b996378fcaeac2022ecb39ca746d1 --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-static-method-string-literal-names.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/string-literal-names.case +// - src/class-fields/default/cls-expr-after-same-line-static-method.template +/*--- +description: String literal names (field definitions after a static method in the same line) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + static m() { return 42; } 'a'; "b"; 'c' = 39; + "d" = 42; +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/expressions/class/fields-multiple-definitions-computed-names.js b/test/language/expressions/class/fields-multiple-definitions-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..6f7b60ac1d4b2b1633d023e0889a242461933605 --- /dev/null +++ b/test/language/expressions/class/fields-multiple-definitions-computed-names.js @@ -0,0 +1,119 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-names.case +// - src/class-fields/default/cls-expr-multiple-definitions.template +/*--- +description: Computed property names (multiple fields definitions) +features: [computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = "b"; + + + +var C = class { + foo = "foobar"; + m() { return 42 } + static ["a"] = 39; [x] = 42; [10] = "meep"; ["not initialized"] + m2() { return 39 } + bar = "barbaz"; +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: false, + configurable: true, + writable: true, +}); + +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); + +verifyProperty(c, "b", { + 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, "10"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + +verifyProperty(c, "not initialized", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/expressions/class/fields-multiple-definitions-computed-symbol-names.js b/test/language/expressions/class/fields-multiple-definitions-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..db85c6797f8f8fa8289007f23bfd805e23f69f06 --- /dev/null +++ b/test/language/expressions/class/fields-multiple-definitions-computed-symbol-names.js @@ -0,0 +1,104 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-symbol-names.case +// - src/class-fields/default/cls-expr-multiple-definitions.template +/*--- +description: Computed property symbol names (multiple fields definitions) +features: [Symbol, computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +var C = class { + foo = "foobar"; + m() { return 42 } + [x]; [y] = 42 + m2() { return 39 } + bar = "barbaz"; +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-multiple-definitions-literal-names.js b/test/language/expressions/class/fields-multiple-definitions-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..0cafb2655570162c2ca2c81565e37ba434e43c07 --- /dev/null +++ b/test/language/expressions/class/fields-multiple-definitions-literal-names.js @@ -0,0 +1,107 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names.case +// - src/class-fields/default/cls-expr-multiple-definitions.template +/*--- +description: Literal property names (multiple fields definitions) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +var C = class { + foo = "foobar"; + m() { return 42 } + a; b = 42; + c = fn + m2() { return 39 } + bar = "barbaz"; +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-multiple-definitions-static-computed-names.js b/test/language/expressions/class/fields-multiple-definitions-static-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..fd2b7dab5f3c696c765550e446135a71dfcad2fe --- /dev/null +++ b/test/language/expressions/class/fields-multiple-definitions-static-computed-names.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-names.case +// - src/class-fields/default/cls-expr-multiple-definitions.template +/*--- +description: Static Computed property names (multiple fields definitions) +features: [computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + static FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + foo = "foobar"; + m() { return 42 } + static ["a"] = 42; ["a"] = 39 + m2() { return 39 } + bar = "barbaz"; +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-multiple-definitions-static-computed-symbol-names.js b/test/language/expressions/class/fields-multiple-definitions-static-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..4f4e35252b0619446c0596214869f0cf4f98718b --- /dev/null +++ b/test/language/expressions/class/fields-multiple-definitions-static-computed-symbol-names.js @@ -0,0 +1,104 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-symbol-names.case +// - src/class-fields/default/cls-expr-multiple-definitions.template +/*--- +description: Static computed property symbol names (multiple fields definitions) +features: [Symbol, computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +var C = class { + foo = "foobar"; + m() { return 42 } + [x]; [y] = 42 + m2() { return 39 } + bar = "barbaz"; +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-multiple-definitions-static-literal-names.js b/test/language/expressions/class/fields-multiple-definitions-static-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..2cdcf79833ef1afc90b2863caf033d4aa2ac1020 --- /dev/null +++ b/test/language/expressions/class/fields-multiple-definitions-static-literal-names.js @@ -0,0 +1,107 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-literal-names.case +// - src/class-fields/default/cls-expr-multiple-definitions.template +/*--- +description: Static literal property names (multiple fields definitions) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +var C = class { + foo = "foobar"; + m() { return 42 } + static a; b = 42; + static c = fn + m2() { return 39 } + bar = "barbaz"; +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-multiple-definitions-string-literal-names.js b/test/language/expressions/class/fields-multiple-definitions-string-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..3f903444cb639771b6daab0b63c56bb4d2bd6e11 --- /dev/null +++ b/test/language/expressions/class/fields-multiple-definitions-string-literal-names.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/string-literal-names.case +// - src/class-fields/default/cls-expr-multiple-definitions.template +/*--- +description: String literal names (multiple fields definitions) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + foo = "foobar"; + m() { return 42 } + 'a'; "b"; 'c' = 39; + "d" = 42 + m2() { return 39 } + bar = "barbaz"; +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/expressions/class/fields-multiple-stacked-definitions-computed-names.js b/test/language/expressions/class/fields-multiple-stacked-definitions-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..6ab20d6d424517fb7507f0d308b1261799efe73c --- /dev/null +++ b/test/language/expressions/class/fields-multiple-stacked-definitions-computed-names.js @@ -0,0 +1,101 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-names.case +// - src/class-fields/default/cls-expr-multiple-stacked-definitions.template +/*--- +description: Computed property names (multiple stacked fields definitions through ASI) +features: [computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = "b"; + + + +var C = class { + static ["a"] = 39; [x] = 42; [10] = "meep"; ["not initialized"] + foo = "foobar" + bar = "barbaz"; +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: false, + configurable: true, + writable: true, +}); + +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); + +verifyProperty(c, "b", { + 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, "10"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + +verifyProperty(c, "not initialized", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/expressions/class/fields-multiple-stacked-definitions-computed-symbol-names.js b/test/language/expressions/class/fields-multiple-stacked-definitions-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..5af36a0ba0d04091ce86fd3f5db54a718b219628 --- /dev/null +++ b/test/language/expressions/class/fields-multiple-stacked-definitions-computed-symbol-names.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-symbol-names.case +// - src/class-fields/default/cls-expr-multiple-stacked-definitions.template +/*--- +description: Computed property symbol names (multiple stacked fields definitions through ASI) +features: [Symbol, computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +var C = class { + [x]; [y] = 42 + foo = "foobar" + bar = "barbaz"; +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-multiple-stacked-definitions-literal-names.js b/test/language/expressions/class/fields-multiple-stacked-definitions-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..477c8b1a66d8722f5252049e8284d6a0217e3539 --- /dev/null +++ b/test/language/expressions/class/fields-multiple-stacked-definitions-literal-names.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names.case +// - src/class-fields/default/cls-expr-multiple-stacked-definitions.template +/*--- +description: Literal property names (multiple stacked fields definitions through ASI) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +var C = class { + a; b = 42; + c = fn + foo = "foobar" + bar = "barbaz"; +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-multiple-stacked-definitions-static-computed-names.js b/test/language/expressions/class/fields-multiple-stacked-definitions-static-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..d20ec86df5e5548396f60c2639b4fbd37095a306 --- /dev/null +++ b/test/language/expressions/class/fields-multiple-stacked-definitions-static-computed-names.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-names.case +// - src/class-fields/default/cls-expr-multiple-stacked-definitions.template +/*--- +description: Static Computed property names (multiple stacked fields definitions through ASI) +features: [computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + static FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + static ["a"] = 42; ["a"] = 39 + foo = "foobar" + bar = "barbaz"; +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-multiple-stacked-definitions-static-computed-symbol-names.js b/test/language/expressions/class/fields-multiple-stacked-definitions-static-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..499133499d59e562cdced6b363d58529f3b7a856 --- /dev/null +++ b/test/language/expressions/class/fields-multiple-stacked-definitions-static-computed-symbol-names.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-symbol-names.case +// - src/class-fields/default/cls-expr-multiple-stacked-definitions.template +/*--- +description: Static computed property symbol names (multiple stacked fields definitions through ASI) +features: [Symbol, computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +var C = class { + [x]; [y] = 42 + foo = "foobar" + bar = "barbaz"; +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-multiple-stacked-definitions-static-literal-names.js b/test/language/expressions/class/fields-multiple-stacked-definitions-static-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..f98eac3252b920c37f68650e1e37fc76da57221d --- /dev/null +++ b/test/language/expressions/class/fields-multiple-stacked-definitions-static-literal-names.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-literal-names.case +// - src/class-fields/default/cls-expr-multiple-stacked-definitions.template +/*--- +description: Static literal property names (multiple stacked fields definitions through ASI) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +var C = class { + static a; b = 42; + static c = fn + foo = "foobar" + bar = "barbaz"; +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-multiple-stacked-definitions-string-literal-names.js b/test/language/expressions/class/fields-multiple-stacked-definitions-string-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..019ed44b8005f18d1d8dc73d083ac981accaeed5 --- /dev/null +++ b/test/language/expressions/class/fields-multiple-stacked-definitions-string-literal-names.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/string-literal-names.case +// - src/class-fields/default/cls-expr-multiple-stacked-definitions.template +/*--- +description: String literal names (multiple stacked fields definitions through ASI) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + 'a'; "b"; 'c' = 39; + "d" = 42 + foo = "foobar" + bar = "barbaz"; +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/expressions/class/fields-new-no-sc-line-method-computed-names.js b/test/language/expressions/class/fields-new-no-sc-line-method-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..5b0cd0d30e563ca7fcb7f5312a10ab15fdd40a54 --- /dev/null +++ b/test/language/expressions/class/fields-new-no-sc-line-method-computed-names.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-names.case +// - src/class-fields/default/cls-expr-new-no-sc-line-method.template +/*--- +description: Computed property names (field definitions followed by a method in a new line without a semicolon) +features: [computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = "b"; + + + +var C = class { + static ["a"] = 39; [x] = 42; [10] = "meep"; ["not initialized"] + m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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); + +verifyProperty(c, "b", { + 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, "10"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + +verifyProperty(c, "not initialized", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/expressions/class/fields-new-no-sc-line-method-computed-symbol-names.js b/test/language/expressions/class/fields-new-no-sc-line-method-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..696ff2ee7affbe31e0170ca16482e5093bafb321 --- /dev/null +++ b/test/language/expressions/class/fields-new-no-sc-line-method-computed-symbol-names.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-symbol-names.case +// - src/class-fields/default/cls-expr-new-no-sc-line-method.template +/*--- +description: Computed property symbol names (field definitions followed by a method in a new line without a semicolon) +features: [Symbol, computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +var C = class { + [x]; [y] = 42 + m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-new-no-sc-line-method-literal-names.js b/test/language/expressions/class/fields-new-no-sc-line-method-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..2ab87c83529ad6aab59fc65bb8aa7c130077418c --- /dev/null +++ b/test/language/expressions/class/fields-new-no-sc-line-method-literal-names.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names.case +// - src/class-fields/default/cls-expr-new-no-sc-line-method.template +/*--- +description: Literal property names (field definitions followed by a method in a new line without a semicolon) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +var C = class { + a; b = 42; + c = fn + m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-new-no-sc-line-method-static-computed-names.js b/test/language/expressions/class/fields-new-no-sc-line-method-static-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..567ab498cdd8543c28515bc9238389a343d4a719 --- /dev/null +++ b/test/language/expressions/class/fields-new-no-sc-line-method-static-computed-names.js @@ -0,0 +1,55 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-names.case +// - src/class-fields/default/cls-expr-new-no-sc-line-method.template +/*--- +description: Static Computed property names (field definitions followed by a method in a new line without a semicolon) +features: [computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + static FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + static ["a"] = 42; ["a"] = 39 + m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-new-no-sc-line-method-static-computed-symbol-names.js b/test/language/expressions/class/fields-new-no-sc-line-method-static-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..48c591186d31dd1552e8de359ef8a25d0cc2e658 --- /dev/null +++ b/test/language/expressions/class/fields-new-no-sc-line-method-static-computed-symbol-names.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-symbol-names.case +// - src/class-fields/default/cls-expr-new-no-sc-line-method.template +/*--- +description: Static computed property symbol names (field definitions followed by a method in a new line without a semicolon) +features: [Symbol, computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +var C = class { + [x]; [y] = 42 + m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-new-no-sc-line-method-static-literal-names.js b/test/language/expressions/class/fields-new-no-sc-line-method-static-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..2d36d9e12ab718ad80ae31bac1a9087e7d8ff8a6 --- /dev/null +++ b/test/language/expressions/class/fields-new-no-sc-line-method-static-literal-names.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-literal-names.case +// - src/class-fields/default/cls-expr-new-no-sc-line-method.template +/*--- +description: Static literal property names (field definitions followed by a method in a new line without a semicolon) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +var C = class { + static a; b = 42; + static c = fn + m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-new-no-sc-line-method-string-literal-names.js b/test/language/expressions/class/fields-new-no-sc-line-method-string-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..e2edc73deecd9a4a62f1497ff0411559692266e5 --- /dev/null +++ b/test/language/expressions/class/fields-new-no-sc-line-method-string-literal-names.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/string-literal-names.case +// - src/class-fields/default/cls-expr-new-no-sc-line-method.template +/*--- +description: String literal names (field definitions followed by a method in a new line without a semicolon) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + 'a'; "b"; 'c' = 39; + "d" = 42 + m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/expressions/class/fields-new-sc-line-gen-computed-names.js b/test/language/expressions/class/fields-new-sc-line-gen-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..e75fbbe1099739ff275ecd64dba8032c64772371 --- /dev/null +++ b/test/language/expressions/class/fields-new-sc-line-gen-computed-names.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-names.case +// - src/class-fields/default/cls-expr-new-sc-line-generator.template +/*--- +description: Computed property names (field definitions followed by a method in a new line with a semicolon) +features: [computed-property-names, class-fields, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = "b"; + + + +var C = class { + static ["a"] = 39; [x] = 42; [10] = "meep"; ["not initialized"]; + *m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.g().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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); + +verifyProperty(c, "b", { + 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, "10"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + +verifyProperty(c, "not initialized", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/expressions/class/fields-new-sc-line-gen-computed-symbol-names.js b/test/language/expressions/class/fields-new-sc-line-gen-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..6c0aabf44ddfdcc59064a89912906290ddf2d915 --- /dev/null +++ b/test/language/expressions/class/fields-new-sc-line-gen-computed-symbol-names.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-symbol-names.case +// - src/class-fields/default/cls-expr-new-sc-line-generator.template +/*--- +description: Computed property symbol names (field definitions followed by a method in a new line with a semicolon) +features: [Symbol, computed-property-names, class-fields, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +var C = class { + [x]; [y] = 42; + *m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.g().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-new-sc-line-gen-literal-names.js b/test/language/expressions/class/fields-new-sc-line-gen-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..4a5db1fd98148de9eefd045288b69033d30a0495 --- /dev/null +++ b/test/language/expressions/class/fields-new-sc-line-gen-literal-names.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names.case +// - src/class-fields/default/cls-expr-new-sc-line-generator.template +/*--- +description: Literal property names (field definitions followed by a method in a new line with a semicolon) +features: [class-fields, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +var C = class { + a; b = 42; + c = fn; + *m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.g().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-new-sc-line-gen-static-computed-names.js b/test/language/expressions/class/fields-new-sc-line-gen-static-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..5f63c71e5daeab7d44031d77bea91f11824a9dae --- /dev/null +++ b/test/language/expressions/class/fields-new-sc-line-gen-static-computed-names.js @@ -0,0 +1,55 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-names.case +// - src/class-fields/default/cls-expr-new-sc-line-generator.template +/*--- +description: Static Computed property names (field definitions followed by a method in a new line with a semicolon) +features: [computed-property-names, class-fields, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + static FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + static ["a"] = 42; ["a"] = 39; + *m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.g().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-new-sc-line-gen-static-computed-symbol-names.js b/test/language/expressions/class/fields-new-sc-line-gen-static-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..1ea62fd0b30adf436b721e9eb12a1c080d0bac23 --- /dev/null +++ b/test/language/expressions/class/fields-new-sc-line-gen-static-computed-symbol-names.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-symbol-names.case +// - src/class-fields/default/cls-expr-new-sc-line-generator.template +/*--- +description: Static computed property symbol names (field definitions followed by a method in a new line with a semicolon) +features: [Symbol, computed-property-names, class-fields, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +var C = class { + [x]; [y] = 42; + *m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.g().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-new-sc-line-gen-static-literal-names.js b/test/language/expressions/class/fields-new-sc-line-gen-static-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..47c8b76ba192c7326a8954d89c37178e2aa6fd3a --- /dev/null +++ b/test/language/expressions/class/fields-new-sc-line-gen-static-literal-names.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-literal-names.case +// - src/class-fields/default/cls-expr-new-sc-line-generator.template +/*--- +description: Static literal property names (field definitions followed by a method in a new line with a semicolon) +features: [class-fields, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +var C = class { + static a; b = 42; + static c = fn; + *m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.g().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-new-sc-line-gen-string-literal-names.js b/test/language/expressions/class/fields-new-sc-line-gen-string-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..f3bc08f790f9433f3f80177967cca84678d6922b --- /dev/null +++ b/test/language/expressions/class/fields-new-sc-line-gen-string-literal-names.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/string-literal-names.case +// - src/class-fields/default/cls-expr-new-sc-line-generator.template +/*--- +description: String literal names (field definitions followed by a method in a new line with a semicolon) +features: [class-fields, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + 'a'; "b"; 'c' = 39; + "d" = 42; + *m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.g().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/expressions/class/fields-new-sc-line-method-computed-names.js b/test/language/expressions/class/fields-new-sc-line-method-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..8ce4baee4ca1c6bba696b2736977bd1f1b56df61 --- /dev/null +++ b/test/language/expressions/class/fields-new-sc-line-method-computed-names.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-names.case +// - src/class-fields/default/cls-expr-new-sc-line-method.template +/*--- +description: Computed property names (field definitions followed by a method in a new line with a semicolon) +features: [computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = "b"; + + + +var C = class { + static ["a"] = 39; [x] = 42; [10] = "meep"; ["not initialized"]; + m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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); + +verifyProperty(c, "b", { + 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, "10"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + +verifyProperty(c, "not initialized", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/expressions/class/fields-new-sc-line-method-computed-symbol-names.js b/test/language/expressions/class/fields-new-sc-line-method-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..365b13fa32adb249be6f01549de2b739d01136c0 --- /dev/null +++ b/test/language/expressions/class/fields-new-sc-line-method-computed-symbol-names.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-symbol-names.case +// - src/class-fields/default/cls-expr-new-sc-line-method.template +/*--- +description: Computed property symbol names (field definitions followed by a method in a new line with a semicolon) +features: [Symbol, computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +var C = class { + [x]; [y] = 42; + m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-new-sc-line-method-literal-names.js b/test/language/expressions/class/fields-new-sc-line-method-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..b1f5a672fbe8b81c332ec689973ea44c24156a29 --- /dev/null +++ b/test/language/expressions/class/fields-new-sc-line-method-literal-names.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names.case +// - src/class-fields/default/cls-expr-new-sc-line-method.template +/*--- +description: Literal property names (field definitions followed by a method in a new line with a semicolon) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +var C = class { + a; b = 42; + c = fn; + m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-new-sc-line-method-static-computed-names.js b/test/language/expressions/class/fields-new-sc-line-method-static-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..4a0808517a6fc7e09d27cf05876dda0d3a3ab5db --- /dev/null +++ b/test/language/expressions/class/fields-new-sc-line-method-static-computed-names.js @@ -0,0 +1,55 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-names.case +// - src/class-fields/default/cls-expr-new-sc-line-method.template +/*--- +description: Static Computed property names (field definitions followed by a method in a new line with a semicolon) +features: [computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + static FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + static ["a"] = 42; ["a"] = 39; + m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-new-sc-line-method-static-computed-symbol-names.js b/test/language/expressions/class/fields-new-sc-line-method-static-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..30192a74b7bf35e6f5c4267d3fb1a588deef18c2 --- /dev/null +++ b/test/language/expressions/class/fields-new-sc-line-method-static-computed-symbol-names.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-symbol-names.case +// - src/class-fields/default/cls-expr-new-sc-line-method.template +/*--- +description: Static computed property symbol names (field definitions followed by a method in a new line with a semicolon) +features: [Symbol, computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +var C = class { + [x]; [y] = 42; + m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-new-sc-line-method-static-literal-names.js b/test/language/expressions/class/fields-new-sc-line-method-static-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..8ca0cf3dc35917d73db74e7e5ba33e478e5825e0 --- /dev/null +++ b/test/language/expressions/class/fields-new-sc-line-method-static-literal-names.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-literal-names.case +// - src/class-fields/default/cls-expr-new-sc-line-method.template +/*--- +description: Static literal property names (field definitions followed by a method in a new line with a semicolon) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +var C = class { + static a; b = 42; + static c = fn; + m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-new-sc-line-method-string-literal-names.js b/test/language/expressions/class/fields-new-sc-line-method-string-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..93d601b363c6f59b9eadabaddd832cf68eef1625 --- /dev/null +++ b/test/language/expressions/class/fields-new-sc-line-method-string-literal-names.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/string-literal-names.case +// - src/class-fields/default/cls-expr-new-sc-line-method.template +/*--- +description: String literal names (field definitions followed by a method in a new line with a semicolon) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + 'a'; "b"; 'c' = 39; + "d" = 42; + m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/expressions/class/fields-regular-definitions-computed-names.js b/test/language/expressions/class/fields-regular-definitions-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..82d7b4d4c2c0771660f86d7f331ac6080d971017 --- /dev/null +++ b/test/language/expressions/class/fields-regular-definitions-computed-names.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-names.case +// - src/class-fields/default/cls-expr-regular-definitions.template +/*--- +description: Computed property names (regular fields defintion) +features: [computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = "b"; + + + +var C = class { + static ["a"] = 39; [x] = 42; [10] = "meep"; ["not initialized"] +} + +var c = new C(); + +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); + +verifyProperty(c, "b", { + 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, "10"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + +verifyProperty(c, "not initialized", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/expressions/class/fields-regular-definitions-computed-symbol-names.js b/test/language/expressions/class/fields-regular-definitions-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..7a2c8472ec5e8f67469b18d757ed8fe4fb0f4438 --- /dev/null +++ b/test/language/expressions/class/fields-regular-definitions-computed-symbol-names.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-symbol-names.case +// - src/class-fields/default/cls-expr-regular-definitions.template +/*--- +description: Computed property symbol names (regular fields defintion) +features: [Symbol, computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +var C = class { + [x]; [y] = 42 +} + +var c = new C(); + +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/test/language/expressions/class/fields-regular-definitions-literal-names.js b/test/language/expressions/class/fields-regular-definitions-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..b602dd30897540144ccb81b65c90b1a6a701154e --- /dev/null +++ b/test/language/expressions/class/fields-regular-definitions-literal-names.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names.case +// - src/class-fields/default/cls-expr-regular-definitions.template +/*--- +description: Literal property names (regular fields defintion) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +var C = class { + a; b = 42; + c = fn +} + +var c = new C(); + +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/test/language/expressions/class/fields-regular-definitions-static-computed-names.js b/test/language/expressions/class/fields-regular-definitions-static-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..bdc889479364a92ba0e4226470b505f4c03fc44c --- /dev/null +++ b/test/language/expressions/class/fields-regular-definitions-static-computed-names.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-names.case +// - src/class-fields/default/cls-expr-regular-definitions.template +/*--- +description: Static Computed property names (regular fields defintion) +features: [computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + static FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + static ["a"] = 42; ["a"] = 39 +} + +var c = new C(); + +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/test/language/expressions/class/fields-regular-definitions-static-computed-symbol-names.js b/test/language/expressions/class/fields-regular-definitions-static-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..8b6827fb5081f2b13661bf1531c0cef32b69c424 --- /dev/null +++ b/test/language/expressions/class/fields-regular-definitions-static-computed-symbol-names.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-symbol-names.case +// - src/class-fields/default/cls-expr-regular-definitions.template +/*--- +description: Static computed property symbol names (regular fields defintion) +features: [Symbol, computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +var C = class { + [x]; [y] = 42 +} + +var c = new C(); + +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/test/language/expressions/class/fields-regular-definitions-static-literal-names.js b/test/language/expressions/class/fields-regular-definitions-static-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..f3e61ced50720a2964058c9bfb138ea893b429d8 --- /dev/null +++ b/test/language/expressions/class/fields-regular-definitions-static-literal-names.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-literal-names.case +// - src/class-fields/default/cls-expr-regular-definitions.template +/*--- +description: Static literal property names (regular fields defintion) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +var C = class { + static a; b = 42; + static c = fn +} + +var c = new C(); + +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/test/language/expressions/class/fields-regular-definitions-string-literal-names.js b/test/language/expressions/class/fields-regular-definitions-string-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..d89374548120b4516ac3545a917c5154c6c859d0 --- /dev/null +++ b/test/language/expressions/class/fields-regular-definitions-string-literal-names.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/string-literal-names.case +// - src/class-fields/default/cls-expr-regular-definitions.template +/*--- +description: String literal names (regular fields defintion) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + 'a'; "b"; 'c' = 39; + "d" = 42 +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/expressions/class/fields-same-line-async-gen-computed-names.js b/test/language/expressions/class/fields-same-line-async-gen-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..b4d5d959d94ea5717e9ed7fa74073e6d71aa4c1d --- /dev/null +++ b/test/language/expressions/class/fields-same-line-async-gen-computed-names.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-names.case +// - src/class-fields/default/cls-expr-after-same-line-async-gen.template +/*--- +description: Computed property names (field definitions after an async generator in the same line) +features: [computed-property-names, class-fields, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = "b"; + + + +var C = class { + async *m() { return 42; } static ["a"] = 39; [x] = 42; [10] = "meep"; ["not initialized"]; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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); + +verifyProperty(c, "b", { + 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, "10"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + +verifyProperty(c, "not initialized", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +c.m().next().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-gen-computed-symbol-names.js b/test/language/expressions/class/fields-same-line-async-gen-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..ba9f077539be7ffc71453529b88bc701ab5d9713 --- /dev/null +++ b/test/language/expressions/class/fields-same-line-async-gen-computed-symbol-names.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-symbol-names.case +// - src/class-fields/default/cls-expr-after-same-line-async-gen.template +/*--- +description: Computed property symbol names (field definitions after an async generator in the same line) +features: [Symbol, computed-property-names, class-fields, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +var C = class { + async *m() { return 42; } [x]; [y] = 42; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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); + +c.m().next().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-gen-literal-names.js b/test/language/expressions/class/fields-same-line-async-gen-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..9ca9bb0ee6773f7e5bec1a6f0958c2ff520a1c9a --- /dev/null +++ b/test/language/expressions/class/fields-same-line-async-gen-literal-names.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names.case +// - src/class-fields/default/cls-expr-after-same-line-async-gen.template +/*--- +description: Literal property names (field definitions after an async generator in the same line) +features: [class-fields, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +var C = class { + async *m() { return 42; } a; b = 42; + c = fn; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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 +}); + + +c.m().next().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-gen-static-computed-names.js b/test/language/expressions/class/fields-same-line-async-gen-static-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..1564125bcdcae1f567311b4c267b077a5bdde4cb --- /dev/null +++ b/test/language/expressions/class/fields-same-line-async-gen-static-computed-names.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-names.case +// - src/class-fields/default/cls-expr-after-same-line-async-gen.template +/*--- +description: Static Computed property names (field definitions after an async generator in the same line) +features: [computed-property-names, class-fields, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + static FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + async *m() { return 42; } static ["a"] = 42; ["a"] = 39; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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 +}); + +c.m().next().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-gen-static-computed-symbol-names.js b/test/language/expressions/class/fields-same-line-async-gen-static-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..12e68a5022f142f9465a5ac4771d6b21d7112cc5 --- /dev/null +++ b/test/language/expressions/class/fields-same-line-async-gen-static-computed-symbol-names.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-symbol-names.case +// - src/class-fields/default/cls-expr-after-same-line-async-gen.template +/*--- +description: Static computed property symbol names (field definitions after an async generator in the same line) +features: [Symbol, computed-property-names, class-fields, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +var C = class { + async *m() { return 42; } [x]; [y] = 42; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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); + +c.m().next().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-gen-static-literal-names.js b/test/language/expressions/class/fields-same-line-async-gen-static-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..e1232602c3558f044338e9708c66717abb57530d --- /dev/null +++ b/test/language/expressions/class/fields-same-line-async-gen-static-literal-names.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-literal-names.case +// - src/class-fields/default/cls-expr-after-same-line-async-gen.template +/*--- +description: Static literal property names (field definitions after an async generator in the same line) +features: [class-fields, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +var C = class { + async *m() { return 42; } static a; b = 42; + static c = fn; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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 +}); + + +c.m().next().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-gen-string-literal-names.js b/test/language/expressions/class/fields-same-line-async-gen-string-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..1080c94d071daf806f271be084da2ac22c2d9611 --- /dev/null +++ b/test/language/expressions/class/fields-same-line-async-gen-string-literal-names.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/string-literal-names.case +// - src/class-fields/default/cls-expr-after-same-line-async-gen.template +/*--- +description: String literal names (field definitions after an async generator in the same line) +features: [class-fields, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + async *m() { return 42; } 'a'; "b"; 'c' = 39; + "d" = 42; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +c.m().next().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-method-computed-names.js b/test/language/expressions/class/fields-same-line-async-method-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..7f985aa810d8f17fb53bf1c37b165ffb48a16cdb --- /dev/null +++ b/test/language/expressions/class/fields-same-line-async-method-computed-names.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-names.case +// - src/class-fields/default/cls-expr-after-same-line-async-method.template +/*--- +description: Computed property names (field definitions after an async method in the same line) +features: [computed-property-names, class-fields, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = "b"; + + + +var C = class { + async m() { return 42; } static ["a"] = 39; [x] = 42; [10] = "meep"; ["not initialized"]; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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); + +verifyProperty(c, "b", { + 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, "10"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + +verifyProperty(c, "not initialized", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +c.m().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-method-computed-symbol-names.js b/test/language/expressions/class/fields-same-line-async-method-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..42033f8318242e08b187d4636767bb6799c0b67d --- /dev/null +++ b/test/language/expressions/class/fields-same-line-async-method-computed-symbol-names.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-symbol-names.case +// - src/class-fields/default/cls-expr-after-same-line-async-method.template +/*--- +description: Computed property symbol names (field definitions after an async method in the same line) +features: [Symbol, computed-property-names, class-fields, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +var C = class { + async m() { return 42; } [x]; [y] = 42; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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); + +c.m().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-method-literal-names.js b/test/language/expressions/class/fields-same-line-async-method-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..4303772cbe5c8d06cfa0c134b07a4611628a741f --- /dev/null +++ b/test/language/expressions/class/fields-same-line-async-method-literal-names.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names.case +// - src/class-fields/default/cls-expr-after-same-line-async-method.template +/*--- +description: Literal property names (field definitions after an async method in the same line) +features: [class-fields, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +var C = class { + async m() { return 42; } a; b = 42; + c = fn; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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 +}); + + +c.m().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-method-static-computed-names.js b/test/language/expressions/class/fields-same-line-async-method-static-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..578ee5b3072782d95941d33ca414e231673d8de1 --- /dev/null +++ b/test/language/expressions/class/fields-same-line-async-method-static-computed-names.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-names.case +// - src/class-fields/default/cls-expr-after-same-line-async-method.template +/*--- +description: Static Computed property names (field definitions after an async method in the same line) +features: [computed-property-names, class-fields, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + static FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + async m() { return 42; } static ["a"] = 42; ["a"] = 39; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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 +}); + +c.m().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-method-static-computed-symbol-names.js b/test/language/expressions/class/fields-same-line-async-method-static-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..12abddd46156eb6b8368c1bb02804294e5cef9a2 --- /dev/null +++ b/test/language/expressions/class/fields-same-line-async-method-static-computed-symbol-names.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-symbol-names.case +// - src/class-fields/default/cls-expr-after-same-line-async-method.template +/*--- +description: Static computed property symbol names (field definitions after an async method in the same line) +features: [Symbol, computed-property-names, class-fields, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +var C = class { + async m() { return 42; } [x]; [y] = 42; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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); + +c.m().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-method-static-literal-names.js b/test/language/expressions/class/fields-same-line-async-method-static-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..f3dee10c20405e1264512bff1c57180fa02c3379 --- /dev/null +++ b/test/language/expressions/class/fields-same-line-async-method-static-literal-names.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-literal-names.case +// - src/class-fields/default/cls-expr-after-same-line-async-method.template +/*--- +description: Static literal property names (field definitions after an async method in the same line) +features: [class-fields, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +var C = class { + async m() { return 42; } static a; b = 42; + static c = fn; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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 +}); + + +c.m().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-method-string-literal-names.js b/test/language/expressions/class/fields-same-line-async-method-string-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..c8825576b3712e7f63d93c26eb12a51c98861265 --- /dev/null +++ b/test/language/expressions/class/fields-same-line-async-method-string-literal-names.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/string-literal-names.case +// - src/class-fields/default/cls-expr-after-same-line-async-method.template +/*--- +description: String literal names (field definitions after an async method in the same line) +features: [class-fields, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + async m() { return 42; } 'a'; "b"; 'c' = 39; + "d" = 42; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +c.m().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-gen-computed-names.js b/test/language/expressions/class/fields-same-line-gen-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..98a34d18bff833ddff2a74db85bfa94d9f18332b --- /dev/null +++ b/test/language/expressions/class/fields-same-line-gen-computed-names.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-names.case +// - src/class-fields/default/cls-expr-same-line-generator.template +/*--- +description: Computed property names (field definitions followed by a generator method in the same line) +features: [computed-property-names, class-fields, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = "b"; + + + +var C = class { + static ["a"] = 39; [x] = 42; [10] = "meep"; ["not initialized"]; *m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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); + +verifyProperty(c, "b", { + 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, "10"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + +verifyProperty(c, "not initialized", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/expressions/class/fields-same-line-gen-computed-symbol-names.js b/test/language/expressions/class/fields-same-line-gen-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..61d3557fd718dd255ad19d3894a973f067f38151 --- /dev/null +++ b/test/language/expressions/class/fields-same-line-gen-computed-symbol-names.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-symbol-names.case +// - src/class-fields/default/cls-expr-same-line-generator.template +/*--- +description: Computed property symbol names (field definitions followed by a generator method in the same line) +features: [Symbol, computed-property-names, class-fields, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +var C = class { + [x]; [y] = 42; *m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-same-line-gen-literal-names.js b/test/language/expressions/class/fields-same-line-gen-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..248d4b9f63a55f19ae9efb6eccc7823edc6d9d08 --- /dev/null +++ b/test/language/expressions/class/fields-same-line-gen-literal-names.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names.case +// - src/class-fields/default/cls-expr-same-line-generator.template +/*--- +description: Literal property names (field definitions followed by a generator method in the same line) +features: [class-fields, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +var C = class { + a; b = 42; + c = fn; *m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-same-line-gen-static-computed-names.js b/test/language/expressions/class/fields-same-line-gen-static-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..71a36cc15adef830cb63435e49121dca0f764366 --- /dev/null +++ b/test/language/expressions/class/fields-same-line-gen-static-computed-names.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-names.case +// - src/class-fields/default/cls-expr-same-line-generator.template +/*--- +description: Static Computed property names (field definitions followed by a generator method in the same line) +features: [computed-property-names, class-fields, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + static FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + static ["a"] = 42; ["a"] = 39; *m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-same-line-gen-static-computed-symbol-names.js b/test/language/expressions/class/fields-same-line-gen-static-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..11c793da011a9e67cfb0ee682f465509cf61c816 --- /dev/null +++ b/test/language/expressions/class/fields-same-line-gen-static-computed-symbol-names.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-symbol-names.case +// - src/class-fields/default/cls-expr-same-line-generator.template +/*--- +description: Static computed property symbol names (field definitions followed by a generator method in the same line) +features: [Symbol, computed-property-names, class-fields, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +var C = class { + [x]; [y] = 42; *m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-same-line-gen-static-literal-names.js b/test/language/expressions/class/fields-same-line-gen-static-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..3bb92907627d48a89f8645218deb78496af9b93d --- /dev/null +++ b/test/language/expressions/class/fields-same-line-gen-static-literal-names.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-literal-names.case +// - src/class-fields/default/cls-expr-same-line-generator.template +/*--- +description: Static literal property names (field definitions followed by a generator method in the same line) +features: [class-fields, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +var C = class { + static a; b = 42; + static c = fn; *m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-same-line-gen-string-literal-names.js b/test/language/expressions/class/fields-same-line-gen-string-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..0818c6fb89dc2564bd74552eec89dbd297dbf634 --- /dev/null +++ b/test/language/expressions/class/fields-same-line-gen-string-literal-names.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/string-literal-names.case +// - src/class-fields/default/cls-expr-same-line-generator.template +/*--- +description: String literal names (field definitions followed by a generator method in the same line) +features: [class-fields, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + 'a'; "b"; 'c' = 39; + "d" = 42; *m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/expressions/class/fields-same-line-method-computed-names.js b/test/language/expressions/class/fields-same-line-method-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..ec3aba7db52c7e28d3409fd06831864fdab64ddb --- /dev/null +++ b/test/language/expressions/class/fields-same-line-method-computed-names.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-names.case +// - src/class-fields/default/cls-expr-same-line-method.template +/*--- +description: Computed property names (field definitions followed by a method in the same line) +features: [computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = "b"; + + + +var C = class { + static ["a"] = 39; [x] = 42; [10] = "meep"; ["not initialized"]; m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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); + +verifyProperty(c, "b", { + 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, "10"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + +verifyProperty(c, "not initialized", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/expressions/class/fields-same-line-method-computed-symbol-names.js b/test/language/expressions/class/fields-same-line-method-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..11d2a550f2c016169967adbc15a0ef6e27341e99 --- /dev/null +++ b/test/language/expressions/class/fields-same-line-method-computed-symbol-names.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-symbol-names.case +// - src/class-fields/default/cls-expr-same-line-method.template +/*--- +description: Computed property symbol names (field definitions followed by a method in the same line) +features: [Symbol, computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +var C = class { + [x]; [y] = 42; m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-same-line-method-literal-names.js b/test/language/expressions/class/fields-same-line-method-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..9fbb56871e41d2bdf144b32d917c5e921346a2e0 --- /dev/null +++ b/test/language/expressions/class/fields-same-line-method-literal-names.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names.case +// - src/class-fields/default/cls-expr-same-line-method.template +/*--- +description: Literal property names (field definitions followed by a method in the same line) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +var C = class { + a; b = 42; + c = fn; m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-same-line-method-static-computed-names.js b/test/language/expressions/class/fields-same-line-method-static-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..af28adedf5d0b776abb341606503b9cb2c4e5b29 --- /dev/null +++ b/test/language/expressions/class/fields-same-line-method-static-computed-names.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-names.case +// - src/class-fields/default/cls-expr-same-line-method.template +/*--- +description: Static Computed property names (field definitions followed by a method in the same line) +features: [computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + static FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + static ["a"] = 42; ["a"] = 39; m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-same-line-method-static-computed-symbol-names.js b/test/language/expressions/class/fields-same-line-method-static-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..3bc08250f92464542367b67fbab5e9466b4a25e1 --- /dev/null +++ b/test/language/expressions/class/fields-same-line-method-static-computed-symbol-names.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-symbol-names.case +// - src/class-fields/default/cls-expr-same-line-method.template +/*--- +description: Static computed property symbol names (field definitions followed by a method in the same line) +features: [Symbol, computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +var C = class { + [x]; [y] = 42; m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-same-line-method-static-literal-names.js b/test/language/expressions/class/fields-same-line-method-static-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..cf2491ff0367f4c08454702b5266730eaa568ffa --- /dev/null +++ b/test/language/expressions/class/fields-same-line-method-static-literal-names.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-literal-names.case +// - src/class-fields/default/cls-expr-same-line-method.template +/*--- +description: Static literal property names (field definitions followed by a method in the same line) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +var C = class { + static a; b = 42; + static c = fn; m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/expressions/class/fields-same-line-method-string-literal-names.js b/test/language/expressions/class/fields-same-line-method-string-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..fd9437256af0249398d1ca4eb4dddf2db3588b99 --- /dev/null +++ b/test/language/expressions/class/fields-same-line-method-string-literal-names.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/string-literal-names.case +// - src/class-fields/default/cls-expr-same-line-method.template +/*--- +description: String literal names (field definitions followed by a method in the same line) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + 'a'; "b"; 'c' = 39; + "d" = 42; m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/expressions/class/fields-wrapped-in-sc-computed-names.js b/test/language/expressions/class/fields-wrapped-in-sc-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..54103874ba3085ec38178199ba65b30bfe39af53 --- /dev/null +++ b/test/language/expressions/class/fields-wrapped-in-sc-computed-names.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-names.case +// - src/class-fields/default/cls-expr-wrapped-in-sc.template +/*--- +description: Computed property names (fields definition wrapped in semicolons) +features: [computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = "b"; + + + +var C = class { + ;;;; + ;;;;;;static ["a"] = 39; [x] = 42; [10] = "meep"; ["not initialized"];;;;;;; + ;;;; +} + +var c = new C(); + +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); + +verifyProperty(c, "b", { + 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, "10"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + +verifyProperty(c, "not initialized", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/expressions/class/fields-wrapped-in-sc-computed-symbol-names.js b/test/language/expressions/class/fields-wrapped-in-sc-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..27c1ea48be9256e2140fdc07edf8ceb7c04ccad9 --- /dev/null +++ b/test/language/expressions/class/fields-wrapped-in-sc-computed-symbol-names.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-symbol-names.case +// - src/class-fields/default/cls-expr-wrapped-in-sc.template +/*--- +description: Computed property symbol names (fields definition wrapped in semicolons) +features: [Symbol, computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +var C = class { + ;;;; + ;;;;;;[x]; [y] = 42;;;;;;; + ;;;; +} + +var c = new C(); + +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/test/language/expressions/class/fields-wrapped-in-sc-literal-names.js b/test/language/expressions/class/fields-wrapped-in-sc-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..15f42747715fc8bda7f696d050be15dba5f53b69 --- /dev/null +++ b/test/language/expressions/class/fields-wrapped-in-sc-literal-names.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names.case +// - src/class-fields/default/cls-expr-wrapped-in-sc.template +/*--- +description: Literal property names (fields definition wrapped in semicolons) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +var C = class { + ;;;; + ;;;;;;a; b = 42; + c = fn;;;;;;; + ;;;; +} + +var c = new C(); + +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/test/language/expressions/class/fields-wrapped-in-sc-static-computed-names.js b/test/language/expressions/class/fields-wrapped-in-sc-static-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..5c872a66a5d0a81c3c2f7e665c50d8e0539eab1d --- /dev/null +++ b/test/language/expressions/class/fields-wrapped-in-sc-static-computed-names.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-names.case +// - src/class-fields/default/cls-expr-wrapped-in-sc.template +/*--- +description: Static Computed property names (fields definition wrapped in semicolons) +features: [computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + static FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + ;;;; + ;;;;;;static ["a"] = 42; ["a"] = 39;;;;;;; + ;;;; +} + +var c = new C(); + +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/test/language/expressions/class/fields-wrapped-in-sc-static-computed-symbol-names.js b/test/language/expressions/class/fields-wrapped-in-sc-static-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..b13c40f717a3b68b705c4111fb28a0d362413ee8 --- /dev/null +++ b/test/language/expressions/class/fields-wrapped-in-sc-static-computed-symbol-names.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-symbol-names.case +// - src/class-fields/default/cls-expr-wrapped-in-sc.template +/*--- +description: Static computed property symbol names (fields definition wrapped in semicolons) +features: [Symbol, computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +var C = class { + ;;;; + ;;;;;;[x]; [y] = 42;;;;;;; + ;;;; +} + +var c = new C(); + +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/test/language/expressions/class/fields-wrapped-in-sc-static-literal-names.js b/test/language/expressions/class/fields-wrapped-in-sc-static-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..abb9d37ae997a4c4345fac0657b9403f5d7acd83 --- /dev/null +++ b/test/language/expressions/class/fields-wrapped-in-sc-static-literal-names.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-literal-names.case +// - src/class-fields/default/cls-expr-wrapped-in-sc.template +/*--- +description: Static literal property names (fields definition wrapped in semicolons) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +var C = class { + ;;;; + ;;;;;;static a; b = 42; + static c = fn;;;;;;; + ;;;; +} + +var c = new C(); + +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/test/language/expressions/class/fields-wrapped-in-sc-string-literal-names.js b/test/language/expressions/class/fields-wrapped-in-sc-string-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..e5249289a4dfe06f55c9fb633163fe0694d998fe --- /dev/null +++ b/test/language/expressions/class/fields-wrapped-in-sc-string-literal-names.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/string-literal-names.case +// - src/class-fields/default/cls-expr-wrapped-in-sc.template +/*--- +description: String literal names (fields definition wrapped in semicolons) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + ;;;; + ;;;;;;'a'; "b"; 'c' = 39; + "d" = 42;;;;;;; + ;;;; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/statements/class/fields-after-same-line-gen-computed-names.js b/test/language/statements/class/fields-after-same-line-gen-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..03a21dbcc78efe25add11082f873a4ef5d5a44f0 --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-gen-computed-names.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-names.case +// - src/class-fields/default/cls-decl-after-same-line-gen.template +/*--- +description: Computed property names (field definitions after a generator in the same line) +features: [computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = "b"; + + + +class C { + *m() { return 42; } static ["a"] = 39; [x] = 42; [10] = "meep"; ["not initialized"]; +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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); + +verifyProperty(c, "b", { + 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, "10"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + +verifyProperty(c, "not initialized", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/statements/class/fields-after-same-line-gen-computed-symbol-names.js b/test/language/statements/class/fields-after-same-line-gen-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..e8cfaacbd32a6e553f001f75813887bffb84f569 --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-gen-computed-symbol-names.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-symbol-names.case +// - src/class-fields/default/cls-decl-after-same-line-gen.template +/*--- +description: Computed property symbol names (field definitions after a generator in the same line) +features: [Symbol, computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +class C { + *m() { return 42; } [x]; [y] = 42; +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-after-same-line-gen-literal-names.js b/test/language/statements/class/fields-after-same-line-gen-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..e087a50dd989a04ce830d060b81c92be5dacb8e1 --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-gen-literal-names.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names.case +// - src/class-fields/default/cls-decl-after-same-line-gen.template +/*--- +description: Literal property names (field definitions after a generator in the same line) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +class C { + *m() { return 42; } a; b = 42; + c = fn; +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-after-same-line-gen-static-computed-names.js b/test/language/statements/class/fields-after-same-line-gen-static-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..99d3f1d449bdb3782d378333eb9bf8af3f11d39f --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-gen-static-computed-names.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-names.case +// - src/class-fields/default/cls-decl-after-same-line-gen.template +/*--- +description: Static Computed property names (field definitions after a generator in the same line) +features: [computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + static FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +class C { + *m() { return 42; } static ["a"] = 42; ["a"] = 39; +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-after-same-line-gen-static-computed-symbol-names.js b/test/language/statements/class/fields-after-same-line-gen-static-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..75771c7e4ef08dee7365f07b287aa329da71f668 --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-gen-static-computed-symbol-names.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-symbol-names.case +// - src/class-fields/default/cls-decl-after-same-line-gen.template +/*--- +description: Static computed property symbol names (field definitions after a generator in the same line) +features: [Symbol, computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +class C { + *m() { return 42; } [x]; [y] = 42; +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-after-same-line-gen-static-literal-names.js b/test/language/statements/class/fields-after-same-line-gen-static-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..e177af059967982d3d9d2972ff66a9f294d471d1 --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-gen-static-literal-names.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-literal-names.case +// - src/class-fields/default/cls-decl-after-same-line-gen.template +/*--- +description: Static literal property names (field definitions after a generator in the same line) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +class C { + *m() { return 42; } static a; b = 42; + static c = fn; +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-after-same-line-gen-string-literal-names.js b/test/language/statements/class/fields-after-same-line-gen-string-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..825c473e116783227e264cd07a129b698ef6b477 --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-gen-string-literal-names.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/string-literal-names.case +// - src/class-fields/default/cls-decl-after-same-line-gen.template +/*--- +description: String literal names (field definitions after a generator in the same line) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +class C { + *m() { return 42; } 'a'; "b"; 'c' = 39; + "d" = 42; +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/statements/class/fields-after-same-line-method-computed-names.js b/test/language/statements/class/fields-after-same-line-method-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..4ff63df6637af1ed717369877c8fa3c6088124cd --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-method-computed-names.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-names.case +// - src/class-fields/default/cls-decl-after-same-line-method.template +/*--- +description: Computed property names (field definitions after a method in the same line) +features: [computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = "b"; + + + +class C { + m() { return 42; } static ["a"] = 39; [x] = 42; [10] = "meep"; ["not initialized"]; +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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); + +verifyProperty(c, "b", { + 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, "10"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + +verifyProperty(c, "not initialized", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/statements/class/fields-after-same-line-method-computed-symbol-names.js b/test/language/statements/class/fields-after-same-line-method-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..16f3a6a706eb0f9dc23f04fbc93d401dcf296419 --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-method-computed-symbol-names.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-symbol-names.case +// - src/class-fields/default/cls-decl-after-same-line-method.template +/*--- +description: Computed property symbol names (field definitions after a method in the same line) +features: [Symbol, computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +class C { + m() { return 42; } [x]; [y] = 42; +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-after-same-line-method-literal-names.js b/test/language/statements/class/fields-after-same-line-method-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..72df50dbd8a665e907384dedb84b59c17725bba1 --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-method-literal-names.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names.case +// - src/class-fields/default/cls-decl-after-same-line-method.template +/*--- +description: Literal property names (field definitions after a method in the same line) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +class C { + m() { return 42; } a; b = 42; + c = fn; +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-after-same-line-method-static-computed-names.js b/test/language/statements/class/fields-after-same-line-method-static-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..e264f1823f257d9cb7a7002cd36209550d4cd183 --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-method-static-computed-names.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-names.case +// - src/class-fields/default/cls-decl-after-same-line-method.template +/*--- +description: Static Computed property names (field definitions after a method in the same line) +features: [computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + static FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +class C { + m() { return 42; } static ["a"] = 42; ["a"] = 39; +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-after-same-line-method-static-computed-symbol-names.js b/test/language/statements/class/fields-after-same-line-method-static-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..6e6203ee75e09055944bea622d2443a7cf095fbc --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-method-static-computed-symbol-names.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-symbol-names.case +// - src/class-fields/default/cls-decl-after-same-line-method.template +/*--- +description: Static computed property symbol names (field definitions after a method in the same line) +features: [Symbol, computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +class C { + m() { return 42; } [x]; [y] = 42; +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-after-same-line-method-static-literal-names.js b/test/language/statements/class/fields-after-same-line-method-static-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..eccff1ad1f558a13642a579c28e063204788986b --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-method-static-literal-names.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-literal-names.case +// - src/class-fields/default/cls-decl-after-same-line-method.template +/*--- +description: Static literal property names (field definitions after a method in the same line) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +class C { + m() { return 42; } static a; b = 42; + static c = fn; +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-after-same-line-method-string-literal-names.js b/test/language/statements/class/fields-after-same-line-method-string-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..9573c0764a10dc2b2437a129687e89b147900dd2 --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-method-string-literal-names.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/string-literal-names.case +// - src/class-fields/default/cls-decl-after-same-line-method.template +/*--- +description: String literal names (field definitions after a method in the same line) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +class C { + m() { return 42; } 'a'; "b"; 'c' = 39; + "d" = 42; +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/statements/class/fields-after-same-line-static-async-gen-computed-names.js b/test/language/statements/class/fields-after-same-line-static-async-gen-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..bf786bbe0204d9777548a0a70be9ff9d92f05f87 --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-static-async-gen-computed-names.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-names.case +// - src/class-fields/default/cls-decl-after-same-line-static-async-gen.template +/*--- +description: Computed property names (field definitions after a static async generator in the same line) +features: [computed-property-names, class-fields, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = "b"; + + + +class C { + static async *m() { return 42; } static ["a"] = 39; [x] = 42; [10] = "meep"; ["not initialized"]; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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); + +verifyProperty(c, "b", { + 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, "10"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + +verifyProperty(c, "not initialized", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +C.m().next().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-gen-computed-symbol-names.js b/test/language/statements/class/fields-after-same-line-static-async-gen-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..c6d00fc16ff6633e1bf71f027c72ea20ac153c41 --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-static-async-gen-computed-symbol-names.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-symbol-names.case +// - src/class-fields/default/cls-decl-after-same-line-static-async-gen.template +/*--- +description: Computed property symbol names (field definitions after a static async generator in the same line) +features: [Symbol, computed-property-names, class-fields, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +class C { + static async *m() { return 42; } [x]; [y] = 42; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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); + +C.m().next().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-gen-literal-names.js b/test/language/statements/class/fields-after-same-line-static-async-gen-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..8f7963036de36bd0c413d7d4ce2312e019b8739d --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-static-async-gen-literal-names.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names.case +// - src/class-fields/default/cls-decl-after-same-line-static-async-gen.template +/*--- +description: Literal property names (field definitions after a static async generator in the same line) +features: [class-fields, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +class C { + static async *m() { return 42; } a; b = 42; + c = fn; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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 +}); + + +C.m().next().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-gen-static-computed-names.js b/test/language/statements/class/fields-after-same-line-static-async-gen-static-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..1c0d59cb2b37ab0af5e90ae0279d31b82eab431f --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-static-async-gen-static-computed-names.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-names.case +// - src/class-fields/default/cls-decl-after-same-line-static-async-gen.template +/*--- +description: Static Computed property names (field definitions after a static async generator in the same line) +features: [computed-property-names, class-fields, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + static FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +class C { + static async *m() { return 42; } static ["a"] = 42; ["a"] = 39; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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 +}); + +C.m().next().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-gen-static-computed-symbol-names.js b/test/language/statements/class/fields-after-same-line-static-async-gen-static-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..01e7bdaa2330a2a43c4fb46467f4e40a12644637 --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-static-async-gen-static-computed-symbol-names.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-symbol-names.case +// - src/class-fields/default/cls-decl-after-same-line-static-async-gen.template +/*--- +description: Static computed property symbol names (field definitions after a static async generator in the same line) +features: [Symbol, computed-property-names, class-fields, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +class C { + static async *m() { return 42; } [x]; [y] = 42; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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); + +C.m().next().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-gen-static-literal-names.js b/test/language/statements/class/fields-after-same-line-static-async-gen-static-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..cda79389b774547e67d909c75ce54e33ff7bc3a7 --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-static-async-gen-static-literal-names.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-literal-names.case +// - src/class-fields/default/cls-decl-after-same-line-static-async-gen.template +/*--- +description: Static literal property names (field definitions after a static async generator in the same line) +features: [class-fields, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +class C { + static async *m() { return 42; } static a; b = 42; + static c = fn; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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 +}); + + +C.m().next().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-gen-string-literal-names.js b/test/language/statements/class/fields-after-same-line-static-async-gen-string-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..c0ce0a9a13105d01cc696882ca9efa3bd4336851 --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-static-async-gen-string-literal-names.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/string-literal-names.case +// - src/class-fields/default/cls-decl-after-same-line-static-async-gen.template +/*--- +description: String literal names (field definitions after a static async generator in the same line) +features: [class-fields, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +class C { + static async *m() { return 42; } 'a'; "b"; 'c' = 39; + "d" = 42; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +C.m().next().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-method-computed-names.js b/test/language/statements/class/fields-after-same-line-static-async-method-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..cdabce1c3de343d1e80622c24f24fdccc336cfff --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-static-async-method-computed-names.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-names.case +// - src/class-fields/default/cls-decl-after-same-line-static-async-method.template +/*--- +description: Computed property names (field definitions after a static async method in the same line) +features: [computed-property-names, class-fields, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = "b"; + + + +class C { + static async m() { return 42; } static ["a"] = 39; [x] = 42; [10] = "meep"; ["not initialized"]; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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); + +verifyProperty(c, "b", { + 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, "10"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + +verifyProperty(c, "not initialized", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +C.m().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-method-computed-symbol-names.js b/test/language/statements/class/fields-after-same-line-static-async-method-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..a5f850c520c0f68e072b0f8b29cd5269428ab6a3 --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-static-async-method-computed-symbol-names.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-symbol-names.case +// - src/class-fields/default/cls-decl-after-same-line-static-async-method.template +/*--- +description: Computed property symbol names (field definitions after a static async method in the same line) +features: [Symbol, computed-property-names, class-fields, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +class C { + static async m() { return 42; } [x]; [y] = 42; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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); + +C.m().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-method-literal-names.js b/test/language/statements/class/fields-after-same-line-static-async-method-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..65292771c12ce5e10cc76b35bfea4538dc75910c --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-static-async-method-literal-names.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names.case +// - src/class-fields/default/cls-decl-after-same-line-static-async-method.template +/*--- +description: Literal property names (field definitions after a static async method in the same line) +features: [class-fields, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +class C { + static async m() { return 42; } a; b = 42; + c = fn; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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 +}); + + +C.m().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-method-static-computed-names.js b/test/language/statements/class/fields-after-same-line-static-async-method-static-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..bfbbba4f43bd0c3d95679e52bca4b944985769e9 --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-static-async-method-static-computed-names.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-names.case +// - src/class-fields/default/cls-decl-after-same-line-static-async-method.template +/*--- +description: Static Computed property names (field definitions after a static async method in the same line) +features: [computed-property-names, class-fields, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + static FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +class C { + static async m() { return 42; } static ["a"] = 42; ["a"] = 39; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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 +}); + +C.m().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-method-static-computed-symbol-names.js b/test/language/statements/class/fields-after-same-line-static-async-method-static-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..1d06240c54fe140a8795f742a76ed319e2215d54 --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-static-async-method-static-computed-symbol-names.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-symbol-names.case +// - src/class-fields/default/cls-decl-after-same-line-static-async-method.template +/*--- +description: Static computed property symbol names (field definitions after a static async method in the same line) +features: [Symbol, computed-property-names, class-fields, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +class C { + static async m() { return 42; } [x]; [y] = 42; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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); + +C.m().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-method-static-literal-names.js b/test/language/statements/class/fields-after-same-line-static-async-method-static-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..6cad2880d8824beea1b077e6311b1b48089eff53 --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-static-async-method-static-literal-names.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-literal-names.case +// - src/class-fields/default/cls-decl-after-same-line-static-async-method.template +/*--- +description: Static literal property names (field definitions after a static async method in the same line) +features: [class-fields, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +class C { + static async m() { return 42; } static a; b = 42; + static c = fn; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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 +}); + + +C.m().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-method-string-literal-names.js b/test/language/statements/class/fields-after-same-line-static-async-method-string-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..9f7c8b1f6b777697befe510f367e659284cb021e --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-static-async-method-string-literal-names.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/string-literal-names.case +// - src/class-fields/default/cls-decl-after-same-line-static-async-method.template +/*--- +description: String literal names (field definitions after a static async method in the same line) +features: [class-fields, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +class C { + static async m() { return 42; } 'a'; "b"; 'c' = 39; + "d" = 42; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +C.m().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-gen-computed-names.js b/test/language/statements/class/fields-after-same-line-static-gen-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..8b57c85e41a95e8f5137d24d2118d652a676da92 --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-static-gen-computed-names.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-names.case +// - src/class-fields/default/cls-decl-after-same-line-static-gen.template +/*--- +description: Computed property names (field definitions after a static generator in the same line) +features: [computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = "b"; + + + +class C { + static *m() { return 42; } static ["a"] = 39; [x] = 42; [10] = "meep"; ["not initialized"]; +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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); + +verifyProperty(c, "b", { + 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, "10"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + +verifyProperty(c, "not initialized", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/statements/class/fields-after-same-line-static-gen-computed-symbol-names.js b/test/language/statements/class/fields-after-same-line-static-gen-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..a412f992d991b306ea2ea9972cb20deb39a8da0a --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-static-gen-computed-symbol-names.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-symbol-names.case +// - src/class-fields/default/cls-decl-after-same-line-static-gen.template +/*--- +description: Computed property symbol names (field definitions after a static generator in the same line) +features: [Symbol, computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +class C { + static *m() { return 42; } [x]; [y] = 42; +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-after-same-line-static-gen-literal-names.js b/test/language/statements/class/fields-after-same-line-static-gen-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..2c21f47baad3368d4f2d59ef7d3e6b0ac16fd90d --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-static-gen-literal-names.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names.case +// - src/class-fields/default/cls-decl-after-same-line-static-gen.template +/*--- +description: Literal property names (field definitions after a static generator in the same line) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +class C { + static *m() { return 42; } a; b = 42; + c = fn; +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-after-same-line-static-gen-static-computed-names.js b/test/language/statements/class/fields-after-same-line-static-gen-static-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..47ddb34eab918ae0013b25882a7d20f78de7d6b3 --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-static-gen-static-computed-names.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-names.case +// - src/class-fields/default/cls-decl-after-same-line-static-gen.template +/*--- +description: Static Computed property names (field definitions after a static generator in the same line) +features: [computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + static FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +class C { + static *m() { return 42; } static ["a"] = 42; ["a"] = 39; +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-after-same-line-static-gen-static-computed-symbol-names.js b/test/language/statements/class/fields-after-same-line-static-gen-static-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..635c9a0767287df38d5ec675d5211ce0e9edad66 --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-static-gen-static-computed-symbol-names.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-symbol-names.case +// - src/class-fields/default/cls-decl-after-same-line-static-gen.template +/*--- +description: Static computed property symbol names (field definitions after a static generator in the same line) +features: [Symbol, computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +class C { + static *m() { return 42; } [x]; [y] = 42; +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-after-same-line-static-gen-static-literal-names.js b/test/language/statements/class/fields-after-same-line-static-gen-static-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..677321c281f730312e474137fd6113e8d73d6dbc --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-static-gen-static-literal-names.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-literal-names.case +// - src/class-fields/default/cls-decl-after-same-line-static-gen.template +/*--- +description: Static literal property names (field definitions after a static generator in the same line) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +class C { + static *m() { return 42; } static a; b = 42; + static c = fn; +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-after-same-line-static-gen-string-literal-names.js b/test/language/statements/class/fields-after-same-line-static-gen-string-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..f80e495c77c3414aa16fc2a82362cfab15611d11 --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-static-gen-string-literal-names.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/string-literal-names.case +// - src/class-fields/default/cls-decl-after-same-line-static-gen.template +/*--- +description: String literal names (field definitions after a static generator in the same line) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +class C { + static *m() { return 42; } 'a'; "b"; 'c' = 39; + "d" = 42; +} + +var c = new C(); + +assert.sameValue(C.m().next().value, 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/statements/class/fields-after-same-line-static-method-computed-names.js b/test/language/statements/class/fields-after-same-line-static-method-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..ad303b78ede37278f3ca17053100d753cc9b5fe2 --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-static-method-computed-names.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-names.case +// - src/class-fields/default/cls-decl-after-same-line-static-method.template +/*--- +description: Computed property names (field definitions after a static method in the same line) +features: [computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = "b"; + + + +class C { + static m() { return 42; } static ["a"] = 39; [x] = 42; [10] = "meep"; ["not initialized"]; +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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); + +verifyProperty(c, "b", { + 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, "10"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + +verifyProperty(c, "not initialized", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/statements/class/fields-after-same-line-static-method-computed-symbol-names.js b/test/language/statements/class/fields-after-same-line-static-method-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..ccf3fb18ea80aaa419af2a54cc8eaebed89e0cf4 --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-static-method-computed-symbol-names.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-symbol-names.case +// - src/class-fields/default/cls-decl-after-same-line-static-method.template +/*--- +description: Computed property symbol names (field definitions after a static method in the same line) +features: [Symbol, computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +class C { + static m() { return 42; } [x]; [y] = 42; +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-after-same-line-static-method-literal-names.js b/test/language/statements/class/fields-after-same-line-static-method-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..9436b0ab13042f47523ce1c63635a83832507e31 --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-static-method-literal-names.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names.case +// - src/class-fields/default/cls-decl-after-same-line-static-method.template +/*--- +description: Literal property names (field definitions after a static method in the same line) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +class C { + static m() { return 42; } a; b = 42; + c = fn; +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-after-same-line-static-method-static-computed-names.js b/test/language/statements/class/fields-after-same-line-static-method-static-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..9f62592b359c00d1951b6324029a29ff32d56fb2 --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-static-method-static-computed-names.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-names.case +// - src/class-fields/default/cls-decl-after-same-line-static-method.template +/*--- +description: Static Computed property names (field definitions after a static method in the same line) +features: [computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + static FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +class C { + static m() { return 42; } static ["a"] = 42; ["a"] = 39; +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-after-same-line-static-method-static-computed-symbol-names.js b/test/language/statements/class/fields-after-same-line-static-method-static-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..077a7ff89b339e57edcacc063f4541d0c60a2a7f --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-static-method-static-computed-symbol-names.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-symbol-names.case +// - src/class-fields/default/cls-decl-after-same-line-static-method.template +/*--- +description: Static computed property symbol names (field definitions after a static method in the same line) +features: [Symbol, computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +class C { + static m() { return 42; } [x]; [y] = 42; +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-after-same-line-static-method-static-literal-names.js b/test/language/statements/class/fields-after-same-line-static-method-static-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..ea40041ffcc31ea584c279b7857638ebc6711e45 --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-static-method-static-literal-names.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-literal-names.case +// - src/class-fields/default/cls-decl-after-same-line-static-method.template +/*--- +description: Static literal property names (field definitions after a static method in the same line) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +class C { + static m() { return 42; } static a; b = 42; + static c = fn; +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-after-same-line-static-method-string-literal-names.js b/test/language/statements/class/fields-after-same-line-static-method-string-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..1778f50d03fb32d8528115ba1adee3c4cc0d7f95 --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-static-method-string-literal-names.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/string-literal-names.case +// - src/class-fields/default/cls-decl-after-same-line-static-method.template +/*--- +description: String literal names (field definitions after a static method in the same line) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +class C { + static m() { return 42; } 'a'; "b"; 'c' = 39; + "d" = 42; +} + +var c = new C(); + +assert.sameValue(C.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "m"), false); + +verifyProperty(C, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/statements/class/fields-multiple-definitions-computed-names.js b/test/language/statements/class/fields-multiple-definitions-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..7e5a8a52f3d057244aec640e2e99620d1c726dd7 --- /dev/null +++ b/test/language/statements/class/fields-multiple-definitions-computed-names.js @@ -0,0 +1,119 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-names.case +// - src/class-fields/default/cls-decl-multiple-definitions.template +/*--- +description: Computed property names (multiple fields definitions) +features: [computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = "b"; + + + +class C { + foo = "foobar"; + m() { return 42 } + static ["a"] = 39; [x] = 42; [10] = "meep"; ["not initialized"] + m2() { return 39 } + bar = "barbaz"; +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: false, + configurable: true, + writable: true, +}); + +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); + +verifyProperty(c, "b", { + 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, "10"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + +verifyProperty(c, "not initialized", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/statements/class/fields-multiple-definitions-computed-symbol-names.js b/test/language/statements/class/fields-multiple-definitions-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..448aa839c08e6b0750c62cafe8cb1c4f3cd7ee4b --- /dev/null +++ b/test/language/statements/class/fields-multiple-definitions-computed-symbol-names.js @@ -0,0 +1,104 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-symbol-names.case +// - src/class-fields/default/cls-decl-multiple-definitions.template +/*--- +description: Computed property symbol names (multiple fields definitions) +features: [Symbol, computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +class C { + foo = "foobar"; + m() { return 42 } + [x]; [y] = 42 + m2() { return 39 } + bar = "barbaz"; +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-multiple-definitions-literal-names.js b/test/language/statements/class/fields-multiple-definitions-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..c636d5078159d0301753e61e3030bbf3b629d5bd --- /dev/null +++ b/test/language/statements/class/fields-multiple-definitions-literal-names.js @@ -0,0 +1,107 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names.case +// - src/class-fields/default/cls-decl-multiple-definitions.template +/*--- +description: Literal property names (multiple fields definitions) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +class C { + foo = "foobar"; + m() { return 42 } + a; b = 42; + c = fn + m2() { return 39 } + bar = "barbaz"; +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-multiple-definitions-static-computed-names.js b/test/language/statements/class/fields-multiple-definitions-static-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..a325b8f34fad95086ed2bffd53893438579b52a1 --- /dev/null +++ b/test/language/statements/class/fields-multiple-definitions-static-computed-names.js @@ -0,0 +1,90 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-names.case +// - src/class-fields/default/cls-decl-multiple-definitions.template +/*--- +description: Static Computed property names (multiple fields definitions) +features: [computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + static FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +class C { + foo = "foobar"; + m() { return 42 } + static ["a"] = 42; ["a"] = 39 + m2() { return 39 } + bar = "barbaz"; +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-multiple-definitions-static-computed-symbol-names.js b/test/language/statements/class/fields-multiple-definitions-static-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..a9e390a24fbd4488a9914cdfe141d8acbb790473 --- /dev/null +++ b/test/language/statements/class/fields-multiple-definitions-static-computed-symbol-names.js @@ -0,0 +1,104 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-symbol-names.case +// - src/class-fields/default/cls-decl-multiple-definitions.template +/*--- +description: Static computed property symbol names (multiple fields definitions) +features: [Symbol, computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +class C { + foo = "foobar"; + m() { return 42 } + [x]; [y] = 42 + m2() { return 39 } + bar = "barbaz"; +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-multiple-definitions-static-literal-names.js b/test/language/statements/class/fields-multiple-definitions-static-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..ad72e5d79efefe1961c04b41d7920f754ad3aea3 --- /dev/null +++ b/test/language/statements/class/fields-multiple-definitions-static-literal-names.js @@ -0,0 +1,107 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-literal-names.case +// - src/class-fields/default/cls-decl-multiple-definitions.template +/*--- +description: Static literal property names (multiple fields definitions) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +class C { + foo = "foobar"; + m() { return 42 } + static a; b = 42; + static c = fn + m2() { return 39 } + bar = "barbaz"; +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-multiple-definitions-string-literal-names.js b/test/language/statements/class/fields-multiple-definitions-string-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..b49dae899012f9f905ec39a96d83cc43de2b832c --- /dev/null +++ b/test/language/statements/class/fields-multiple-definitions-string-literal-names.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/string-literal-names.case +// - src/class-fields/default/cls-decl-multiple-definitions.template +/*--- +description: String literal names (multiple fields definitions) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +class C { + foo = "foobar"; + m() { return 42 } + 'a'; "b"; 'c' = 39; + "d" = 42 + m2() { return 39 } + bar = "barbaz"; +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.m2(), 39); +assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); +assert.sameValue(c.m2, C.prototype.m2); + +verifyProperty(C.prototype, "m2", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/statements/class/fields-multiple-stacked-definitions-computed-names.js b/test/language/statements/class/fields-multiple-stacked-definitions-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..276b70ef058d06e9d052418ef5d3fced00d1fcfe --- /dev/null +++ b/test/language/statements/class/fields-multiple-stacked-definitions-computed-names.js @@ -0,0 +1,101 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-names.case +// - src/class-fields/default/cls-decl-multiple-stacked-definitions.template +/*--- +description: Computed property names (multiple stacked fields definitions through ASI) +features: [computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = "b"; + + + +class C { + static ["a"] = 39; [x] = 42; [10] = "meep"; ["not initialized"] + foo = "foobar" + bar = "barbaz"; +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: false, + configurable: true, + writable: true, +}); + +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); + +verifyProperty(c, "b", { + 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, "10"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + +verifyProperty(c, "not initialized", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/statements/class/fields-multiple-stacked-definitions-computed-symbol-names.js b/test/language/statements/class/fields-multiple-stacked-definitions-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..932aaf6b6cde8b2fa80a09e692df76f801e729c7 --- /dev/null +++ b/test/language/statements/class/fields-multiple-stacked-definitions-computed-symbol-names.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-symbol-names.case +// - src/class-fields/default/cls-decl-multiple-stacked-definitions.template +/*--- +description: Computed property symbol names (multiple stacked fields definitions through ASI) +features: [Symbol, computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +class C { + [x]; [y] = 42 + foo = "foobar" + bar = "barbaz"; +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-multiple-stacked-definitions-literal-names.js b/test/language/statements/class/fields-multiple-stacked-definitions-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..d4a699ba1055de5365869af6cc7ebfc8939a1f46 --- /dev/null +++ b/test/language/statements/class/fields-multiple-stacked-definitions-literal-names.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names.case +// - src/class-fields/default/cls-decl-multiple-stacked-definitions.template +/*--- +description: Literal property names (multiple stacked fields definitions through ASI) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +class C { + a; b = 42; + c = fn + foo = "foobar" + bar = "barbaz"; +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-multiple-stacked-definitions-static-computed-names.js b/test/language/statements/class/fields-multiple-stacked-definitions-static-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..3cab98aad11b3f42b12b147f0ca52d05313b7c6b --- /dev/null +++ b/test/language/statements/class/fields-multiple-stacked-definitions-static-computed-names.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-names.case +// - src/class-fields/default/cls-decl-multiple-stacked-definitions.template +/*--- +description: Static Computed property names (multiple stacked fields definitions through ASI) +features: [computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + static FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +class C { + static ["a"] = 42; ["a"] = 39 + foo = "foobar" + bar = "barbaz"; +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-multiple-stacked-definitions-static-computed-symbol-names.js b/test/language/statements/class/fields-multiple-stacked-definitions-static-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..b6fe6ec3fce29d17268415bf42e1fa8360afe32f --- /dev/null +++ b/test/language/statements/class/fields-multiple-stacked-definitions-static-computed-symbol-names.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-symbol-names.case +// - src/class-fields/default/cls-decl-multiple-stacked-definitions.template +/*--- +description: Static computed property symbol names (multiple stacked fields definitions through ASI) +features: [Symbol, computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +class C { + [x]; [y] = 42 + foo = "foobar" + bar = "barbaz"; +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-multiple-stacked-definitions-static-literal-names.js b/test/language/statements/class/fields-multiple-stacked-definitions-static-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..a64ed4cf1240c8882e06031c673afec872706307 --- /dev/null +++ b/test/language/statements/class/fields-multiple-stacked-definitions-static-literal-names.js @@ -0,0 +1,89 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-literal-names.case +// - src/class-fields/default/cls-decl-multiple-stacked-definitions.template +/*--- +description: Static literal property names (multiple stacked fields definitions through ASI) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +class C { + static a; b = 42; + static c = fn + foo = "foobar" + bar = "barbaz"; +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-multiple-stacked-definitions-string-literal-names.js b/test/language/statements/class/fields-multiple-stacked-definitions-string-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..e312f2ab928a7ed038204331e0c23830ca6caac2 --- /dev/null +++ b/test/language/statements/class/fields-multiple-stacked-definitions-string-literal-names.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/string-literal-names.case +// - src/class-fields/default/cls-decl-multiple-stacked-definitions.template +/*--- +description: String literal names (multiple stacked fields definitions through ASI) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +class C { + 'a'; "b"; 'c' = 39; + "d" = 42 + foo = "foobar" + bar = "barbaz"; +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +assert.sameValue(c.foo, "foobar"); +assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); + +verifyProperty(c, "foo", { + value: "foobar", + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(c.bar, "barbaz"); +assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); + +verifyProperty(c, "bar", { + value: "barbaz", + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/statements/class/fields-new-no-sc-line-method-computed-names.js b/test/language/statements/class/fields-new-no-sc-line-method-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..879c594faf89a7ebf5caacdcbb1f0c4782a777c7 --- /dev/null +++ b/test/language/statements/class/fields-new-no-sc-line-method-computed-names.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-names.case +// - src/class-fields/default/cls-decl-new-no-sc-line-method.template +/*--- +description: Computed property names (field definitions followed by a method in a new line without a semicolon) +features: [computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = "b"; + + + +class C { + static ["a"] = 39; [x] = 42; [10] = "meep"; ["not initialized"] + m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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); + +verifyProperty(c, "b", { + 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, "10"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + +verifyProperty(c, "not initialized", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/statements/class/fields-new-no-sc-line-method-computed-symbol-names.js b/test/language/statements/class/fields-new-no-sc-line-method-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..006a80a5f39585a9fe55d4d5d664199c2cfc0ddb --- /dev/null +++ b/test/language/statements/class/fields-new-no-sc-line-method-computed-symbol-names.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-symbol-names.case +// - src/class-fields/default/cls-decl-new-no-sc-line-method.template +/*--- +description: Computed property symbol names (field definitions followed by a method in a new line without a semicolon) +features: [Symbol, computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +class C { + [x]; [y] = 42 + m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-new-no-sc-line-method-literal-names.js b/test/language/statements/class/fields-new-no-sc-line-method-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..ab88001d64d97208be2436a22d8635d6dded2887 --- /dev/null +++ b/test/language/statements/class/fields-new-no-sc-line-method-literal-names.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names.case +// - src/class-fields/default/cls-decl-new-no-sc-line-method.template +/*--- +description: Literal property names (field definitions followed by a method in a new line without a semicolon) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +class C { + a; b = 42; + c = fn + m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-new-no-sc-line-method-static-computed-names.js b/test/language/statements/class/fields-new-no-sc-line-method-static-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..14ba9e812bc597d98a5df512d5863729f4f449d2 --- /dev/null +++ b/test/language/statements/class/fields-new-no-sc-line-method-static-computed-names.js @@ -0,0 +1,55 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-names.case +// - src/class-fields/default/cls-decl-new-no-sc-line-method.template +/*--- +description: Static Computed property names (field definitions followed by a method in a new line without a semicolon) +features: [computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + static FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +class C { + static ["a"] = 42; ["a"] = 39 + m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-new-no-sc-line-method-static-computed-symbol-names.js b/test/language/statements/class/fields-new-no-sc-line-method-static-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..925379c4746c2db0f77cbcccac3a17f874a9d6a1 --- /dev/null +++ b/test/language/statements/class/fields-new-no-sc-line-method-static-computed-symbol-names.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-symbol-names.case +// - src/class-fields/default/cls-decl-new-no-sc-line-method.template +/*--- +description: Static computed property symbol names (field definitions followed by a method in a new line without a semicolon) +features: [Symbol, computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +class C { + [x]; [y] = 42 + m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-new-no-sc-line-method-static-literal-names.js b/test/language/statements/class/fields-new-no-sc-line-method-static-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..f587d2b001ff917bdfc5d2e2074ca44e2d444479 --- /dev/null +++ b/test/language/statements/class/fields-new-no-sc-line-method-static-literal-names.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-literal-names.case +// - src/class-fields/default/cls-decl-new-no-sc-line-method.template +/*--- +description: Static literal property names (field definitions followed by a method in a new line without a semicolon) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +class C { + static a; b = 42; + static c = fn + m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-new-no-sc-line-method-string-literal-names.js b/test/language/statements/class/fields-new-no-sc-line-method-string-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..9312e0d0a8bac354601c551eabc386de9700e2de --- /dev/null +++ b/test/language/statements/class/fields-new-no-sc-line-method-string-literal-names.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/string-literal-names.case +// - src/class-fields/default/cls-decl-new-no-sc-line-method.template +/*--- +description: String literal names (field definitions followed by a method in a new line without a semicolon) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +class C { + 'a'; "b"; 'c' = 39; + "d" = 42 + m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/statements/class/fields-new-sc-line-gen-computed-names.js b/test/language/statements/class/fields-new-sc-line-gen-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..991abbab82d1dd2f671c669df090697a5e6af628 --- /dev/null +++ b/test/language/statements/class/fields-new-sc-line-gen-computed-names.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-names.case +// - src/class-fields/default/cls-decl-new-sc-line-generator.template +/*--- +description: Computed property names (field definitions followed by a method in a new line with a semicolon) +features: [computed-property-names, class-fields, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = "b"; + + + +class C { + static ["a"] = 39; [x] = 42; [10] = "meep"; ["not initialized"]; + *m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.g().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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); + +verifyProperty(c, "b", { + 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, "10"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + +verifyProperty(c, "not initialized", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/statements/class/fields-new-sc-line-gen-computed-symbol-names.js b/test/language/statements/class/fields-new-sc-line-gen-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..d2de94d67af1238991574e3f32f668d2813df076 --- /dev/null +++ b/test/language/statements/class/fields-new-sc-line-gen-computed-symbol-names.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-symbol-names.case +// - src/class-fields/default/cls-decl-new-sc-line-generator.template +/*--- +description: Computed property symbol names (field definitions followed by a method in a new line with a semicolon) +features: [Symbol, computed-property-names, class-fields, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +class C { + [x]; [y] = 42; + *m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.g().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-new-sc-line-gen-literal-names.js b/test/language/statements/class/fields-new-sc-line-gen-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..b4722a67bc0ce37e5a0fafee3c98a0dc1757bb9a --- /dev/null +++ b/test/language/statements/class/fields-new-sc-line-gen-literal-names.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names.case +// - src/class-fields/default/cls-decl-new-sc-line-generator.template +/*--- +description: Literal property names (field definitions followed by a method in a new line with a semicolon) +features: [class-fields, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +class C { + a; b = 42; + c = fn; + *m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.g().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-new-sc-line-gen-static-computed-names.js b/test/language/statements/class/fields-new-sc-line-gen-static-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..b37919784b6be9a3f325203258e0630c114454c4 --- /dev/null +++ b/test/language/statements/class/fields-new-sc-line-gen-static-computed-names.js @@ -0,0 +1,55 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-names.case +// - src/class-fields/default/cls-decl-new-sc-line-generator.template +/*--- +description: Static Computed property names (field definitions followed by a method in a new line with a semicolon) +features: [computed-property-names, class-fields, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + static FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +class C { + static ["a"] = 42; ["a"] = 39; + *m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.g().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-new-sc-line-gen-static-computed-symbol-names.js b/test/language/statements/class/fields-new-sc-line-gen-static-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..4f135922fdeadb932990f43feef58e6244f5f08f --- /dev/null +++ b/test/language/statements/class/fields-new-sc-line-gen-static-computed-symbol-names.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-symbol-names.case +// - src/class-fields/default/cls-decl-new-sc-line-generator.template +/*--- +description: Static computed property symbol names (field definitions followed by a method in a new line with a semicolon) +features: [Symbol, computed-property-names, class-fields, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +class C { + [x]; [y] = 42; + *m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.g().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-new-sc-line-gen-static-literal-names.js b/test/language/statements/class/fields-new-sc-line-gen-static-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..17c11a6ced6415cff8e22c578a02fbcee0086330 --- /dev/null +++ b/test/language/statements/class/fields-new-sc-line-gen-static-literal-names.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-literal-names.case +// - src/class-fields/default/cls-decl-new-sc-line-generator.template +/*--- +description: Static literal property names (field definitions followed by a method in a new line with a semicolon) +features: [class-fields, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +class C { + static a; b = 42; + static c = fn; + *m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.g().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-new-sc-line-gen-string-literal-names.js b/test/language/statements/class/fields-new-sc-line-gen-string-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..85ea958d0cf26b5690143150a3a1c56617937250 --- /dev/null +++ b/test/language/statements/class/fields-new-sc-line-gen-string-literal-names.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/string-literal-names.case +// - src/class-fields/default/cls-decl-new-sc-line-generator.template +/*--- +description: String literal names (field definitions followed by a method in a new line with a semicolon) +features: [class-fields, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +class C { + 'a'; "b"; 'c' = 39; + "d" = 42; + *m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.g().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/statements/class/fields-new-sc-line-method-computed-names.js b/test/language/statements/class/fields-new-sc-line-method-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..ccc1a75c8a2bdd6d3dc74159cd04af63a20849de --- /dev/null +++ b/test/language/statements/class/fields-new-sc-line-method-computed-names.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-names.case +// - src/class-fields/default/cls-decl-new-sc-line-method.template +/*--- +description: Computed property names (field definitions followed by a method in a new line with a semicolon) +features: [computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = "b"; + + + +class C { + static ["a"] = 39; [x] = 42; [10] = "meep"; ["not initialized"]; + m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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); + +verifyProperty(c, "b", { + 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, "10"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + +verifyProperty(c, "not initialized", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/statements/class/fields-new-sc-line-method-computed-symbol-names.js b/test/language/statements/class/fields-new-sc-line-method-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..501a9c455f590b3b88936d75092b4b4e0f632bc8 --- /dev/null +++ b/test/language/statements/class/fields-new-sc-line-method-computed-symbol-names.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-symbol-names.case +// - src/class-fields/default/cls-decl-new-sc-line-method.template +/*--- +description: Computed property symbol names (field definitions followed by a method in a new line with a semicolon) +features: [Symbol, computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +class C { + [x]; [y] = 42; + m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-new-sc-line-method-literal-names.js b/test/language/statements/class/fields-new-sc-line-method-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..24ce2a6b41eab798439a7793d942908d7b1aeb3f --- /dev/null +++ b/test/language/statements/class/fields-new-sc-line-method-literal-names.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names.case +// - src/class-fields/default/cls-decl-new-sc-line-method.template +/*--- +description: Literal property names (field definitions followed by a method in a new line with a semicolon) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +class C { + a; b = 42; + c = fn; + m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-new-sc-line-method-static-computed-names.js b/test/language/statements/class/fields-new-sc-line-method-static-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..8c8d1f7c282c4dcf067599d0650b366d4b4830da --- /dev/null +++ b/test/language/statements/class/fields-new-sc-line-method-static-computed-names.js @@ -0,0 +1,55 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-names.case +// - src/class-fields/default/cls-decl-new-sc-line-method.template +/*--- +description: Static Computed property names (field definitions followed by a method in a new line with a semicolon) +features: [computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + static FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +class C { + static ["a"] = 42; ["a"] = 39; + m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-new-sc-line-method-static-computed-symbol-names.js b/test/language/statements/class/fields-new-sc-line-method-static-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..9ad8182f2eb1ccc6fd1ec6f22f047375b1c39a4d --- /dev/null +++ b/test/language/statements/class/fields-new-sc-line-method-static-computed-symbol-names.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-symbol-names.case +// - src/class-fields/default/cls-decl-new-sc-line-method.template +/*--- +description: Static computed property symbol names (field definitions followed by a method in a new line with a semicolon) +features: [Symbol, computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +class C { + [x]; [y] = 42; + m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-new-sc-line-method-static-literal-names.js b/test/language/statements/class/fields-new-sc-line-method-static-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..db60f6da21ba82bacb51229f53f9ffbe6003f43f --- /dev/null +++ b/test/language/statements/class/fields-new-sc-line-method-static-literal-names.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-literal-names.case +// - src/class-fields/default/cls-decl-new-sc-line-method.template +/*--- +description: Static literal property names (field definitions followed by a method in a new line with a semicolon) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +class C { + static a; b = 42; + static c = fn; + m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-new-sc-line-method-string-literal-names.js b/test/language/statements/class/fields-new-sc-line-method-string-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..28988a4ac30b42daf7da64013107be93bdf5e4b9 --- /dev/null +++ b/test/language/statements/class/fields-new-sc-line-method-string-literal-names.js @@ -0,0 +1,49 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/string-literal-names.case +// - src/class-fields/default/cls-decl-new-sc-line-method.template +/*--- +description: String literal names (field definitions followed by a method in a new line with a semicolon) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +class C { + 'a'; "b"; 'c' = 39; + "d" = 42; + m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/statements/class/fields-regular-definitions-computed-names.js b/test/language/statements/class/fields-regular-definitions-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..da34a7e6472585d3edfada91824569b223156c1a --- /dev/null +++ b/test/language/statements/class/fields-regular-definitions-computed-names.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-names.case +// - src/class-fields/default/cls-decl-regular-definitions.template +/*--- +description: Computed property names (regular fields defintion) +features: [computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = "b"; + + + +class C { + static ["a"] = 39; [x] = 42; [10] = "meep"; ["not initialized"] +} + +var c = new C(); + +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); + +verifyProperty(c, "b", { + 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, "10"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + +verifyProperty(c, "not initialized", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/statements/class/fields-regular-definitions-computed-symbol-names.js b/test/language/statements/class/fields-regular-definitions-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..1d05dd714247285e8b4872abb41f8785695d8d53 --- /dev/null +++ b/test/language/statements/class/fields-regular-definitions-computed-symbol-names.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-symbol-names.case +// - src/class-fields/default/cls-decl-regular-definitions.template +/*--- +description: Computed property symbol names (regular fields defintion) +features: [Symbol, computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +class C { + [x]; [y] = 42 +} + +var c = new C(); + +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/test/language/statements/class/fields-regular-definitions-literal-names.js b/test/language/statements/class/fields-regular-definitions-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..b35f3cc138a3b377aea915f05287de6283e25cc7 --- /dev/null +++ b/test/language/statements/class/fields-regular-definitions-literal-names.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names.case +// - src/class-fields/default/cls-decl-regular-definitions.template +/*--- +description: Literal property names (regular fields defintion) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +class C { + a; b = 42; + c = fn +} + +var c = new C(); + +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/test/language/statements/class/fields-regular-definitions-static-computed-names.js b/test/language/statements/class/fields-regular-definitions-static-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..b61ca08f90ab62341902b6e87382caacc27e4a98 --- /dev/null +++ b/test/language/statements/class/fields-regular-definitions-static-computed-names.js @@ -0,0 +1,44 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-names.case +// - src/class-fields/default/cls-decl-regular-definitions.template +/*--- +description: Static Computed property names (regular fields defintion) +features: [computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + static FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +class C { + static ["a"] = 42; ["a"] = 39 +} + +var c = new C(); + +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/test/language/statements/class/fields-regular-definitions-static-computed-symbol-names.js b/test/language/statements/class/fields-regular-definitions-static-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..e982efc9ab0776c5303e111a9c8213560a81ada6 --- /dev/null +++ b/test/language/statements/class/fields-regular-definitions-static-computed-symbol-names.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-symbol-names.case +// - src/class-fields/default/cls-decl-regular-definitions.template +/*--- +description: Static computed property symbol names (regular fields defintion) +features: [Symbol, computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +class C { + [x]; [y] = 42 +} + +var c = new C(); + +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/test/language/statements/class/fields-regular-definitions-static-literal-names.js b/test/language/statements/class/fields-regular-definitions-static-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..4ebbcedef89437470086fe4bc48762baa59cca98 --- /dev/null +++ b/test/language/statements/class/fields-regular-definitions-static-literal-names.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-literal-names.case +// - src/class-fields/default/cls-decl-regular-definitions.template +/*--- +description: Static literal property names (regular fields defintion) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +class C { + static a; b = 42; + static c = fn +} + +var c = new C(); + +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/test/language/statements/class/fields-regular-definitions-string-literal-names.js b/test/language/statements/class/fields-regular-definitions-string-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..3de28394e4228e065f913b3ef89d2d0ebc0279c5 --- /dev/null +++ b/test/language/statements/class/fields-regular-definitions-string-literal-names.js @@ -0,0 +1,38 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/string-literal-names.case +// - src/class-fields/default/cls-decl-regular-definitions.template +/*--- +description: String literal names (regular fields defintion) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +class C { + 'a'; "b"; 'c' = 39; + "d" = 42 +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/statements/class/fields-same-line-async-gen-computed-names.js b/test/language/statements/class/fields-same-line-async-gen-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..d5a9a08945a62d67ee185108bd6386f78b777e77 --- /dev/null +++ b/test/language/statements/class/fields-same-line-async-gen-computed-names.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-names.case +// - src/class-fields/default/cls-decl-after-same-line-async-gen.template +/*--- +description: Computed property names (field definitions after an async generator in the same line) +features: [computed-property-names, class-fields, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = "b"; + + + +class C { + async *m() { return 42; } static ["a"] = 39; [x] = 42; [10] = "meep"; ["not initialized"]; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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); + +verifyProperty(c, "b", { + 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, "10"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + +verifyProperty(c, "not initialized", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +c.m().next().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-gen-computed-symbol-names.js b/test/language/statements/class/fields-same-line-async-gen-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..12ed08d0665a36d8031f461b3bd3342bbdc8a99a --- /dev/null +++ b/test/language/statements/class/fields-same-line-async-gen-computed-symbol-names.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-symbol-names.case +// - src/class-fields/default/cls-decl-after-same-line-async-gen.template +/*--- +description: Computed property symbol names (field definitions after an async generator in the same line) +features: [Symbol, computed-property-names, class-fields, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +class C { + async *m() { return 42; } [x]; [y] = 42; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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); + +c.m().next().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-gen-literal-names.js b/test/language/statements/class/fields-same-line-async-gen-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..b42348da5476e6b70932746be722798c28e0771a --- /dev/null +++ b/test/language/statements/class/fields-same-line-async-gen-literal-names.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names.case +// - src/class-fields/default/cls-decl-after-same-line-async-gen.template +/*--- +description: Literal property names (field definitions after an async generator in the same line) +features: [class-fields, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +class C { + async *m() { return 42; } a; b = 42; + c = fn; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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 +}); + + +c.m().next().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-gen-static-computed-names.js b/test/language/statements/class/fields-same-line-async-gen-static-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..725743a1c98f62ca487c9de3eaf1213f46fd8790 --- /dev/null +++ b/test/language/statements/class/fields-same-line-async-gen-static-computed-names.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-names.case +// - src/class-fields/default/cls-decl-after-same-line-async-gen.template +/*--- +description: Static Computed property names (field definitions after an async generator in the same line) +features: [computed-property-names, class-fields, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + static FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +class C { + async *m() { return 42; } static ["a"] = 42; ["a"] = 39; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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 +}); + +c.m().next().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-gen-static-computed-symbol-names.js b/test/language/statements/class/fields-same-line-async-gen-static-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..ddf3c706679348c15ecf585ae2effdb05affdbe1 --- /dev/null +++ b/test/language/statements/class/fields-same-line-async-gen-static-computed-symbol-names.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-symbol-names.case +// - src/class-fields/default/cls-decl-after-same-line-async-gen.template +/*--- +description: Static computed property symbol names (field definitions after an async generator in the same line) +features: [Symbol, computed-property-names, class-fields, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +class C { + async *m() { return 42; } [x]; [y] = 42; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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); + +c.m().next().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-gen-static-literal-names.js b/test/language/statements/class/fields-same-line-async-gen-static-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..6958ec40e7c57e96f1abaae73c2749d5c2ad490c --- /dev/null +++ b/test/language/statements/class/fields-same-line-async-gen-static-literal-names.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-literal-names.case +// - src/class-fields/default/cls-decl-after-same-line-async-gen.template +/*--- +description: Static literal property names (field definitions after an async generator in the same line) +features: [class-fields, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +class C { + async *m() { return 42; } static a; b = 42; + static c = fn; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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 +}); + + +c.m().next().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-gen-string-literal-names.js b/test/language/statements/class/fields-same-line-async-gen-string-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..9b8b18af1435e3b5176222557ac57595e587cd5f --- /dev/null +++ b/test/language/statements/class/fields-same-line-async-gen-string-literal-names.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/string-literal-names.case +// - src/class-fields/default/cls-decl-after-same-line-async-gen.template +/*--- +description: String literal names (field definitions after an async generator in the same line) +features: [class-fields, async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +class C { + async *m() { return 42; } 'a'; "b"; 'c' = 39; + "d" = 42; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +c.m().next().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-method-computed-names.js b/test/language/statements/class/fields-same-line-async-method-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..b662f133ff3e98da40d478f9f98d823e4c04993c --- /dev/null +++ b/test/language/statements/class/fields-same-line-async-method-computed-names.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-names.case +// - src/class-fields/default/cls-decl-after-same-line-async-method.template +/*--- +description: Computed property names (field definitions after an async method in the same line) +features: [computed-property-names, class-fields, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = "b"; + + + +class C { + async m() { return 42; } static ["a"] = 39; [x] = 42; [10] = "meep"; ["not initialized"]; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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); + +verifyProperty(c, "b", { + 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, "10"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + +verifyProperty(c, "not initialized", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +c.m().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-method-computed-symbol-names.js b/test/language/statements/class/fields-same-line-async-method-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..56be7bd43b8294dae6e81667b1f64bab3c092f63 --- /dev/null +++ b/test/language/statements/class/fields-same-line-async-method-computed-symbol-names.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-symbol-names.case +// - src/class-fields/default/cls-decl-after-same-line-async-method.template +/*--- +description: Computed property symbol names (field definitions after an async method in the same line) +features: [Symbol, computed-property-names, class-fields, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +class C { + async m() { return 42; } [x]; [y] = 42; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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); + +c.m().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-method-literal-names.js b/test/language/statements/class/fields-same-line-async-method-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..0b6f6da91dcd878e6e05b433ca9c45492abe6e93 --- /dev/null +++ b/test/language/statements/class/fields-same-line-async-method-literal-names.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names.case +// - src/class-fields/default/cls-decl-after-same-line-async-method.template +/*--- +description: Literal property names (field definitions after an async method in the same line) +features: [class-fields, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +class C { + async m() { return 42; } a; b = 42; + c = fn; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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 +}); + + +c.m().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-method-static-computed-names.js b/test/language/statements/class/fields-same-line-async-method-static-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..355ab2ccd5243c573b65642498d1687375415b33 --- /dev/null +++ b/test/language/statements/class/fields-same-line-async-method-static-computed-names.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-names.case +// - src/class-fields/default/cls-decl-after-same-line-async-method.template +/*--- +description: Static Computed property names (field definitions after an async method in the same line) +features: [computed-property-names, class-fields, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + static FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +class C { + async m() { return 42; } static ["a"] = 42; ["a"] = 39; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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 +}); + +c.m().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-method-static-computed-symbol-names.js b/test/language/statements/class/fields-same-line-async-method-static-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..9e81020f929fb52a03f363cb971152accf03e1d0 --- /dev/null +++ b/test/language/statements/class/fields-same-line-async-method-static-computed-symbol-names.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-symbol-names.case +// - src/class-fields/default/cls-decl-after-same-line-async-method.template +/*--- +description: Static computed property symbol names (field definitions after an async method in the same line) +features: [Symbol, computed-property-names, class-fields, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +class C { + async m() { return 42; } [x]; [y] = 42; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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); + +c.m().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-method-static-literal-names.js b/test/language/statements/class/fields-same-line-async-method-static-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..8fa7c18721fd225b94a2fc7c9e955e1b9a5f59cf --- /dev/null +++ b/test/language/statements/class/fields-same-line-async-method-static-literal-names.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-literal-names.case +// - src/class-fields/default/cls-decl-after-same-line-async-method.template +/*--- +description: Static literal property names (field definitions after an async method in the same line) +features: [class-fields, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +class C { + async m() { return 42; } static a; b = 42; + static c = fn; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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 +}); + + +c.m().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-method-string-literal-names.js b/test/language/statements/class/fields-same-line-async-method-string-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..149008d37321f0800d77f74b6100788e375f767f --- /dev/null +++ b/test/language/statements/class/fields-same-line-async-method-string-literal-names.js @@ -0,0 +1,51 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/string-literal-names.case +// - src/class-fields/default/cls-decl-after-same-line-async-method.template +/*--- +description: String literal names (field definitions after an async method in the same line) +features: [class-fields, async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +class C { + async m() { return 42; } 'a'; "b"; 'c' = 39; + "d" = 42; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); +assert.sameValue(c.m, C.prototype.m); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); + +c.m().then(function(v) { + assert.sameValue(v, 42); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-gen-computed-names.js b/test/language/statements/class/fields-same-line-gen-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..bea9a04f4d5a0ea25729c0a51fd5a6497df7ee9e --- /dev/null +++ b/test/language/statements/class/fields-same-line-gen-computed-names.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-names.case +// - src/class-fields/default/cls-decl-same-line-generator.template +/*--- +description: Computed property names (field definitions followed by a generator method in the same line) +features: [computed-property-names, class-fields, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = "b"; + + + +class C { + static ["a"] = 39; [x] = 42; [10] = "meep"; ["not initialized"]; *m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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); + +verifyProperty(c, "b", { + 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, "10"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + +verifyProperty(c, "not initialized", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/statements/class/fields-same-line-gen-computed-symbol-names.js b/test/language/statements/class/fields-same-line-gen-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..a7976b991602d7c95d3ef95fc094815b80566205 --- /dev/null +++ b/test/language/statements/class/fields-same-line-gen-computed-symbol-names.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-symbol-names.case +// - src/class-fields/default/cls-decl-same-line-generator.template +/*--- +description: Computed property symbol names (field definitions followed by a generator method in the same line) +features: [Symbol, computed-property-names, class-fields, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +class C { + [x]; [y] = 42; *m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-same-line-gen-literal-names.js b/test/language/statements/class/fields-same-line-gen-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..d84b1c3ce967509095165bf526043bc5d4f7a73d --- /dev/null +++ b/test/language/statements/class/fields-same-line-gen-literal-names.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names.case +// - src/class-fields/default/cls-decl-same-line-generator.template +/*--- +description: Literal property names (field definitions followed by a generator method in the same line) +features: [class-fields, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +class C { + a; b = 42; + c = fn; *m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-same-line-gen-static-computed-names.js b/test/language/statements/class/fields-same-line-gen-static-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..158a1aa43fbaae8b1317263e711afbec9a43715c --- /dev/null +++ b/test/language/statements/class/fields-same-line-gen-static-computed-names.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-names.case +// - src/class-fields/default/cls-decl-same-line-generator.template +/*--- +description: Static Computed property names (field definitions followed by a generator method in the same line) +features: [computed-property-names, class-fields, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + static FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +class C { + static ["a"] = 42; ["a"] = 39; *m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-same-line-gen-static-computed-symbol-names.js b/test/language/statements/class/fields-same-line-gen-static-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..52699d5ecc27a6972531e0ab4330ea9720971dee --- /dev/null +++ b/test/language/statements/class/fields-same-line-gen-static-computed-symbol-names.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-symbol-names.case +// - src/class-fields/default/cls-decl-same-line-generator.template +/*--- +description: Static computed property symbol names (field definitions followed by a generator method in the same line) +features: [Symbol, computed-property-names, class-fields, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +class C { + [x]; [y] = 42; *m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-same-line-gen-static-literal-names.js b/test/language/statements/class/fields-same-line-gen-static-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..7afdf30af83884c6b49415df401ab151f750c08b --- /dev/null +++ b/test/language/statements/class/fields-same-line-gen-static-literal-names.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-literal-names.case +// - src/class-fields/default/cls-decl-same-line-generator.template +/*--- +description: Static literal property names (field definitions followed by a generator method in the same line) +features: [class-fields, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +class C { + static a; b = 42; + static c = fn; *m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-same-line-gen-string-literal-names.js b/test/language/statements/class/fields-same-line-gen-string-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..2b204ab5ffc192cac70fea4c8292ed4cc2a66f6d --- /dev/null +++ b/test/language/statements/class/fields-same-line-gen-string-literal-names.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/string-literal-names.case +// - src/class-fields/default/cls-decl-same-line-generator.template +/*--- +description: String literal names (field definitions followed by a generator method in the same line) +features: [class-fields, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +class C { + 'a'; "b"; 'c' = 39; + "d" = 42; *m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m().next().value, 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/statements/class/fields-same-line-method-computed-names.js b/test/language/statements/class/fields-same-line-method-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..ad7135a649091a03bb1602912311eb3d91d7bae3 --- /dev/null +++ b/test/language/statements/class/fields-same-line-method-computed-names.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-names.case +// - src/class-fields/default/cls-decl-same-line-method.template +/*--- +description: Computed property names (field definitions followed by a method in the same line) +features: [computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = "b"; + + + +class C { + static ["a"] = 39; [x] = 42; [10] = "meep"; ["not initialized"]; m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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); + +verifyProperty(c, "b", { + 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, "10"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + +verifyProperty(c, "not initialized", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/statements/class/fields-same-line-method-computed-symbol-names.js b/test/language/statements/class/fields-same-line-method-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..2e3aac2b2abc642ce33f5abb0e2372114af4b9e8 --- /dev/null +++ b/test/language/statements/class/fields-same-line-method-computed-symbol-names.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-symbol-names.case +// - src/class-fields/default/cls-decl-same-line-method.template +/*--- +description: Computed property symbol names (field definitions followed by a method in the same line) +features: [Symbol, computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +class C { + [x]; [y] = 42; m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-same-line-method-literal-names.js b/test/language/statements/class/fields-same-line-method-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..377d6f8dcc8369aff64c3f48b267f0dda5b73956 --- /dev/null +++ b/test/language/statements/class/fields-same-line-method-literal-names.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names.case +// - src/class-fields/default/cls-decl-same-line-method.template +/*--- +description: Literal property names (field definitions followed by a method in the same line) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +class C { + a; b = 42; + c = fn; m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-same-line-method-static-computed-names.js b/test/language/statements/class/fields-same-line-method-static-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..0b8076d6240cd925d8ec9bbf448d27e49e49a352 --- /dev/null +++ b/test/language/statements/class/fields-same-line-method-static-computed-names.js @@ -0,0 +1,54 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-names.case +// - src/class-fields/default/cls-decl-same-line-method.template +/*--- +description: Static Computed property names (field definitions followed by a method in the same line) +features: [computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + static FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +class C { + static ["a"] = 42; ["a"] = 39; m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-same-line-method-static-computed-symbol-names.js b/test/language/statements/class/fields-same-line-method-static-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..d7175fb6a92df199337b3b50d9f84876f1899276 --- /dev/null +++ b/test/language/statements/class/fields-same-line-method-static-computed-symbol-names.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-symbol-names.case +// - src/class-fields/default/cls-decl-same-line-method.template +/*--- +description: Static computed property symbol names (field definitions followed by a method in the same line) +features: [Symbol, computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +class C { + [x]; [y] = 42; m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-same-line-method-static-literal-names.js b/test/language/statements/class/fields-same-line-method-static-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..8a413a4908b7cc41bdb7387c0ac60919aec8ec22 --- /dev/null +++ b/test/language/statements/class/fields-same-line-method-static-literal-names.js @@ -0,0 +1,71 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-literal-names.case +// - src/class-fields/default/cls-decl-same-line-method.template +/*--- +description: Static literal property names (field definitions followed by a method in the same line) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +class C { + static a; b = 42; + static c = fn; m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +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/test/language/statements/class/fields-same-line-method-string-literal-names.js b/test/language/statements/class/fields-same-line-method-string-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..4a4f6d37f35f8a26d04199f94a9426ff3ba6cc00 --- /dev/null +++ b/test/language/statements/class/fields-same-line-method-string-literal-names.js @@ -0,0 +1,48 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/string-literal-names.case +// - src/class-fields/default/cls-decl-same-line-method.template +/*--- +description: String literal names (field definitions followed by a method in the same line) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +class C { + 'a'; "b"; 'c' = 39; + "d" = 42; m() { return 42; } +} + +var c = new C(); + +assert.sameValue(c.m(), 42); +assert.sameValue(c.m, C.prototype.m); +assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); + +verifyProperty(C.prototype, "m", { + enumerable: false, + configurable: true, + writable: true, +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: 42, + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/statements/class/fields-wrapped-in-sc-computed-names.js b/test/language/statements/class/fields-wrapped-in-sc-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..14f2400c6a69e06cd79111cf5d1a4e7b1a444baa --- /dev/null +++ b/test/language/statements/class/fields-wrapped-in-sc-computed-names.js @@ -0,0 +1,75 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-names.case +// - src/class-fields/default/cls-decl-wrapped-in-sc.template +/*--- +description: Computed property names (fields definition wrapped in semicolons) +features: [computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = "b"; + + + +class C { + ;;;; + ;;;;;;static ["a"] = 39; [x] = 42; [10] = "meep"; ["not initialized"];;;;;;; + ;;;; +} + +var c = new C(); + +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); + +verifyProperty(c, "b", { + 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, "10"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "10"), false); + +verifyProperty(c, "10", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "not initialized"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "not initialized"), false); + +verifyProperty(c, "not initialized", { + value: "meep", + enumerable: true, + writable: true, + configurable: true +}); diff --git a/test/language/statements/class/fields-wrapped-in-sc-computed-symbol-names.js b/test/language/statements/class/fields-wrapped-in-sc-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..ef9466ace83f5b4973afc29f782c07d52b823f2f --- /dev/null +++ b/test/language/statements/class/fields-wrapped-in-sc-computed-symbol-names.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/computed-symbol-names.case +// - src/class-fields/default/cls-decl-wrapped-in-sc.template +/*--- +description: Computed property symbol names (fields definition wrapped in semicolons) +features: [Symbol, computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +class C { + ;;;; + ;;;;;;[x]; [y] = 42;;;;;;; + ;;;; +} + +var c = new C(); + +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/test/language/statements/class/fields-wrapped-in-sc-literal-names.js b/test/language/statements/class/fields-wrapped-in-sc-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..4212441ce85fa2b8fb426d825b0e466be4d1bc2e --- /dev/null +++ b/test/language/statements/class/fields-wrapped-in-sc-literal-names.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names.case +// - src/class-fields/default/cls-decl-wrapped-in-sc.template +/*--- +description: Literal property names (fields definition wrapped in semicolons) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +class C { + ;;;; + ;;;;;;a; b = 42; + c = fn;;;;;;; + ;;;; +} + +var c = new C(); + +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/test/language/statements/class/fields-wrapped-in-sc-static-computed-names.js b/test/language/statements/class/fields-wrapped-in-sc-static-computed-names.js new file mode 100644 index 0000000000000000000000000000000000000000..3a569f8c33f7661bdeb1deb070f210e56191d692 --- /dev/null +++ b/test/language/statements/class/fields-wrapped-in-sc-static-computed-names.js @@ -0,0 +1,46 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-names.case +// - src/class-fields/default/cls-decl-wrapped-in-sc.template +/*--- +description: Static Computed property names (fields definition wrapped in semicolons) +features: [computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + static FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +class C { + ;;;; + ;;;;;;static ["a"] = 42; ["a"] = 39;;;;;;; + ;;;; +} + +var c = new C(); + +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/test/language/statements/class/fields-wrapped-in-sc-static-computed-symbol-names.js b/test/language/statements/class/fields-wrapped-in-sc-static-computed-symbol-names.js new file mode 100644 index 0000000000000000000000000000000000000000..1d7a9681da6cfc4eee3fa990648d7bfe9f03fcc9 --- /dev/null +++ b/test/language/statements/class/fields-wrapped-in-sc-static-computed-symbol-names.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-computed-symbol-names.case +// - src/class-fields/default/cls-decl-wrapped-in-sc.template +/*--- +description: Static computed property symbol names (fields definition wrapped in semicolons) +features: [Symbol, computed-property-names, class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +var x = Symbol(); +var y = Symbol(); + + + +class C { + ;;;; + ;;;;;;[x]; [y] = 42;;;;;;; + ;;;; +} + +var c = new C(); + +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/test/language/statements/class/fields-wrapped-in-sc-static-literal-names.js b/test/language/statements/class/fields-wrapped-in-sc-static-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..3709f8f89fc660e63b9f04297676ef72449884af --- /dev/null +++ b/test/language/statements/class/fields-wrapped-in-sc-static-literal-names.js @@ -0,0 +1,63 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-literal-names.case +// - src/class-fields/default/cls-decl-wrapped-in-sc.template +/*--- +description: Static literal property names (fields definition wrapped in semicolons) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ +const fn = function() {} + + + +class C { + ;;;; + ;;;;;;static a; b = 42; + static c = fn;;;;;;; + ;;;; +} + +var c = new C(); + +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/test/language/statements/class/fields-wrapped-in-sc-string-literal-names.js b/test/language/statements/class/fields-wrapped-in-sc-string-literal-names.js new file mode 100644 index 0000000000000000000000000000000000000000..03155320b0771cf0eb235d8740d27aa55a04be80 --- /dev/null +++ b/test/language/statements/class/fields-wrapped-in-sc-string-literal-names.js @@ -0,0 +1,40 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/string-literal-names.case +// - src/class-fields/default/cls-decl-wrapped-in-sc.template +/*--- +description: String literal names (fields definition wrapped in semicolons) +features: [class-fields] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +class C { + ;;;; + ;;;;;;'a'; "b"; 'c' = 39; + "d" = 42;;;;;;; + ;;;; +} + +var c = new C(); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false); +assert.sameValue(Object.hasOwnProperty.call(C, "a"), false); + +verifyProperty(c, "a", { + value: 42, + enumerable: true, + writable: true, + configurable: true +});