diff --git a/test/language/expressions/class/fields-after-same-line-gen-literal-names-asi.js b/test/language/expressions/class/fields-after-same-line-gen-literal-names-asi.js new file mode 100644 index 0000000000000000000000000000000000000000..07d3594394416d9b222c9c72add33d957adf0f7d --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-gen-literal-names-asi.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names-asi.case +// - src/class-fields/productions/cls-expr-after-same-line-gen.template +/*--- +description: Literal property names with ASI (field definitions after a generator in the same line) +esid: prod-FieldDefinition +features: [generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + *m() { return 42; } a + b = 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: 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 +}); diff --git a/test/language/expressions/class/fields-after-same-line-method-literal-names-asi.js b/test/language/expressions/class/fields-after-same-line-method-literal-names-asi.js new file mode 100644 index 0000000000000000000000000000000000000000..eef03956a010f8018bce6da97d21e5a94c134b2c --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-method-literal-names-asi.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names-asi.case +// - src/class-fields/productions/cls-expr-after-same-line-method.template +/*--- +description: Literal property names with ASI (field definitions after a method in the same line) +esid: prod-FieldDefinition +features: [class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + m() { return 42; } a + b = 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: 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 +}); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-gen-literal-names-asi.js b/test/language/expressions/class/fields-after-same-line-static-async-gen-literal-names-asi.js new file mode 100644 index 0000000000000000000000000000000000000000..a387bee8ccfcb91da98ba44a9abb3a4e0978d163 --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-static-async-gen-literal-names-asi.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names-asi.case +// - src/class-fields/productions/cls-expr-after-same-line-static-async-gen.template +/*--- +description: Literal property names with ASI (field definitions after a static async generator in the same line) +esid: prod-FieldDefinition +features: [class, class-fields-public, 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 = 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, +}, {restore: true}); + +C.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + 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 + }); + } + + return Promise.resolve(assertions()); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-method-literal-names-asi.js b/test/language/expressions/class/fields-after-same-line-static-async-method-literal-names-asi.js new file mode 100644 index 0000000000000000000000000000000000000000..05fe894bf2bc92c22f35c19b166b762fa2f2f71f --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-static-async-method-literal-names-asi.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names-asi.case +// - src/class-fields/productions/cls-expr-after-same-line-static-async-method.template +/*--- +description: Literal property names with ASI (field definitions after a static async method in the same line) +esid: prod-FieldDefinition +features: [class, class-fields-public, 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 = 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, +}, {restore: true}); + +C.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + 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 + }); + } + + return Promise.resolve(assertions()); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-gen-literal-names-asi.js b/test/language/expressions/class/fields-after-same-line-static-gen-literal-names-asi.js new file mode 100644 index 0000000000000000000000000000000000000000..3a469c562a4e5a5cf6ba58c383d951eb6e706fac --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-static-gen-literal-names-asi.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names-asi.case +// - src/class-fields/productions/cls-expr-after-same-line-static-gen.template +/*--- +description: Literal property names with ASI (field definitions after a static generator in the same line) +esid: prod-FieldDefinition +features: [generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + static *m() { return 42; } a + b = 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: 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 +}); diff --git a/test/language/expressions/class/fields-after-same-line-static-method-literal-names-asi.js b/test/language/expressions/class/fields-after-same-line-static-method-literal-names-asi.js new file mode 100644 index 0000000000000000000000000000000000000000..54566a347961a45a98180c9f153f24b0958a1738 --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-static-method-literal-names-asi.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names-asi.case +// - src/class-fields/productions/cls-expr-after-same-line-static-method.template +/*--- +description: Literal property names with ASI (field definitions after a static method in the same line) +esid: prod-FieldDefinition +features: [class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + static m() { return 42; } a + b = 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: 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 +}); diff --git a/test/language/expressions/class/fields-multiple-definitions-literal-names-asi.js b/test/language/expressions/class/fields-multiple-definitions-literal-names-asi.js new file mode 100644 index 0000000000000000000000000000000000000000..74fd80c2f777071d97a2becd1db9053c200411f2 --- /dev/null +++ b/test/language/expressions/class/fields-multiple-definitions-literal-names-asi.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names-asi.case +// - src/class-fields/productions/cls-expr-multiple-definitions.template +/*--- +description: Literal property names with ASI (multiple fields definitions) +esid: prod-FieldDefinition +features: [class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + foo = "foobar"; + m() { return 42 } + a + b = 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: true, + 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: true, + 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 +}); diff --git a/test/language/expressions/class/fields-multiple-stacked-definitions-literal-names-asi.js b/test/language/expressions/class/fields-multiple-stacked-definitions-literal-names-asi.js new file mode 100644 index 0000000000000000000000000000000000000000..08d39ea46cee7b1d7ab18d0457d9a2f48ad331fd --- /dev/null +++ b/test/language/expressions/class/fields-multiple-stacked-definitions-literal-names-asi.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names-asi.case +// - src/class-fields/productions/cls-expr-multiple-stacked-definitions.template +/*--- +description: Literal property names with ASI (multiple stacked fields definitions through ASI) +esid: prod-FieldDefinition +features: [class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + a + b = 42; + foo = "foobar" + bar = "barbaz"; + +} + +var c = new C(); + +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: true, + 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: true, + 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 +}); diff --git a/test/language/expressions/class/fields-new-no-sc-line-method-literal-names-asi.js b/test/language/expressions/class/fields-new-no-sc-line-method-literal-names-asi.js new file mode 100644 index 0000000000000000000000000000000000000000..fcbc8851249fdbae2b016db40936d4370aedd40e --- /dev/null +++ b/test/language/expressions/class/fields-new-no-sc-line-method-literal-names-asi.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names-asi.case +// - src/class-fields/productions/cls-expr-new-no-sc-line-method.template +/*--- +description: Literal property names with ASI (field definitions followed by a method in a new line without a semicolon) +esid: prod-FieldDefinition +features: [class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + a + b = 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: 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 +}); diff --git a/test/language/expressions/class/fields-new-sc-line-gen-literal-names-asi.js b/test/language/expressions/class/fields-new-sc-line-gen-literal-names-asi.js new file mode 100644 index 0000000000000000000000000000000000000000..e8a7097b2ed22ae4003a062b287ec08883685a8a --- /dev/null +++ b/test/language/expressions/class/fields-new-sc-line-gen-literal-names-asi.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names-asi.case +// - src/class-fields/productions/cls-expr-new-sc-line-generator.template +/*--- +description: Literal property names with ASI (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + a + b = 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: 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 +}); diff --git a/test/language/expressions/class/fields-new-sc-line-method-literal-names-asi.js b/test/language/expressions/class/fields-new-sc-line-method-literal-names-asi.js new file mode 100644 index 0000000000000000000000000000000000000000..f98ab8c65e18ffebb65954d1da30e2d2f37c2c2d --- /dev/null +++ b/test/language/expressions/class/fields-new-sc-line-method-literal-names-asi.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names-asi.case +// - src/class-fields/productions/cls-expr-new-sc-line-method.template +/*--- +description: Literal property names with ASI (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + a + b = 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: 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 +}); diff --git a/test/language/expressions/class/fields-regular-definitions-literal-names-asi.js b/test/language/expressions/class/fields-regular-definitions-literal-names-asi.js new file mode 100644 index 0000000000000000000000000000000000000000..95f92f5691f2e1433a98bf950278797f187396bf --- /dev/null +++ b/test/language/expressions/class/fields-regular-definitions-literal-names-asi.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names-asi.case +// - src/class-fields/productions/cls-expr-regular-definitions.template +/*--- +description: Literal property names with ASI (regular fields defintion) +esid: prod-FieldDefinition +features: [class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + a + b = 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: 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 +}); diff --git a/test/language/expressions/class/fields-same-line-async-gen-literal-names-asi.js b/test/language/expressions/class/fields-same-line-async-gen-literal-names-asi.js new file mode 100644 index 0000000000000000000000000000000000000000..35d3ee1db6a126f7ac06226a5c82478a71764729 --- /dev/null +++ b/test/language/expressions/class/fields-same-line-async-gen-literal-names-asi.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names-asi.case +// - src/class-fields/productions/cls-expr-after-same-line-async-gen.template +/*--- +description: Literal property names with ASI (field definitions after an async generator in the same line) +esid: prod-FieldDefinition +features: [class, class-fields-public, 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 = 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, +}, {restore: true}); + +c.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + 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 + }); + } + + return Promise.resolve(assertions()); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-method-literal-names-asi.js b/test/language/expressions/class/fields-same-line-async-method-literal-names-asi.js new file mode 100644 index 0000000000000000000000000000000000000000..413ced87f53b8a6a2e6173b6af1e04799cff3bdd --- /dev/null +++ b/test/language/expressions/class/fields-same-line-async-method-literal-names-asi.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names-asi.case +// - src/class-fields/productions/cls-expr-after-same-line-async-method.template +/*--- +description: Literal property names with ASI (field definitions after an async method in the same line) +esid: prod-FieldDefinition +features: [class, class-fields-public, 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 = 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, +}, {restore: true}); + +c.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + 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 + }); + } + + return Promise.resolve(assertions()); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-gen-literal-names-asi.js b/test/language/expressions/class/fields-same-line-gen-literal-names-asi.js new file mode 100644 index 0000000000000000000000000000000000000000..1bbd48d5b3683fbf0972104dbd048e54003762b7 --- /dev/null +++ b/test/language/expressions/class/fields-same-line-gen-literal-names-asi.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names-asi.case +// - src/class-fields/productions/cls-expr-same-line-generator.template +/*--- +description: Literal property names with ASI (field definitions followed by a generator method in the same line) +esid: prod-FieldDefinition +features: [class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + a + b = 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: 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 +}); diff --git a/test/language/expressions/class/fields-same-line-method-literal-names-asi.js b/test/language/expressions/class/fields-same-line-method-literal-names-asi.js new file mode 100644 index 0000000000000000000000000000000000000000..ff7f4722a137acf7322c0090cdaac9b50f6f6d6a --- /dev/null +++ b/test/language/expressions/class/fields-same-line-method-literal-names-asi.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names-asi.case +// - src/class-fields/productions/cls-expr-same-line-method.template +/*--- +description: Literal property names with ASI (field definitions followed by a method in the same line) +esid: prod-FieldDefinition +features: [class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + a + b = 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: 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 +}); diff --git a/test/language/expressions/class/fields-wrapped-in-sc-literal-names-asi.js b/test/language/expressions/class/fields-wrapped-in-sc-literal-names-asi.js new file mode 100644 index 0000000000000000000000000000000000000000..3c1b690ee03dd2390a984fe30049d57d7da3aac5 --- /dev/null +++ b/test/language/expressions/class/fields-wrapped-in-sc-literal-names-asi.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names-asi.case +// - src/class-fields/productions/cls-expr-wrapped-in-sc.template +/*--- +description: Literal property names with ASI (fields definition wrapped in semicolons) +esid: prod-FieldDefinition +features: [class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +var C = class { + ;;;; + ;;;;;;a + b = 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: 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 +}); diff --git a/test/language/expressions/class/syntax-invalid-grammar-field-def-has-initializer-no-sc-error.js b/test/language/expressions/class/syntax-invalid-grammar-field-def-has-initializer-no-sc-error.js deleted file mode 100644 index bc825b5981363224a7cec2101017f978424f4b13..0000000000000000000000000000000000000000 --- a/test/language/expressions/class/syntax-invalid-grammar-field-def-has-initializer-no-sc-error.js +++ /dev/null @@ -1,35 +0,0 @@ -// This file was procedurally generated from the following sources: -// - src/class-fields/grammar-field-def-has-initializer-no-sc-error.case -// - src/class-fields/syntax/invalid/cls-expr-fields-invalid-syntax.template -/*--- -description: SyntaxError (class expression) -esid: prod-ClassElement -features: [class-fields-private, class] -flags: [generated] -negative: - phase: parse - type: SyntaxError -info: | - - ClassElement : - MethodDefinition - static MethodDefinition - FieldDefinition ; - ; - - FieldDefinition : - ClassElementName Initializer _opt - - ClassElementName : - PropertyName - PrivateName - ----*/ - - -throw "Test262: This statement should not be evaluated."; - -var C = class { - x = [] - y; -}; diff --git a/test/language/statements/class/fields-after-same-line-gen-literal-names-asi.js b/test/language/statements/class/fields-after-same-line-gen-literal-names-asi.js new file mode 100644 index 0000000000000000000000000000000000000000..8c1194f166bb0497c6678f3eac7cf3033cdaed76 --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-gen-literal-names-asi.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names-asi.case +// - src/class-fields/productions/cls-decl-after-same-line-gen.template +/*--- +description: Literal property names with ASI (field definitions after a generator in the same line) +esid: prod-FieldDefinition +features: [generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +class C { + *m() { return 42; } a + b = 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: 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 +}); diff --git a/test/language/statements/class/fields-after-same-line-method-literal-names-asi.js b/test/language/statements/class/fields-after-same-line-method-literal-names-asi.js new file mode 100644 index 0000000000000000000000000000000000000000..53ee50802670dc2e30290e219db8408bd2e53cba --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-method-literal-names-asi.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names-asi.case +// - src/class-fields/productions/cls-decl-after-same-line-method.template +/*--- +description: Literal property names with ASI (field definitions after a method in the same line) +esid: prod-FieldDefinition +features: [class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +class C { + m() { return 42; } a + b = 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: 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 +}); diff --git a/test/language/statements/class/fields-after-same-line-static-async-gen-literal-names-asi.js b/test/language/statements/class/fields-after-same-line-static-async-gen-literal-names-asi.js new file mode 100644 index 0000000000000000000000000000000000000000..789d6d0a8b0cf9eaa047a96ad59b1180b81eda7c --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-static-async-gen-literal-names-asi.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names-asi.case +// - src/class-fields/productions/cls-decl-after-same-line-static-async-gen.template +/*--- +description: Literal property names with ASI (field definitions after a static async generator in the same line) +esid: prod-FieldDefinition +features: [class, class-fields-public, 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 = 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, +}, {restore: true}); + +C.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + 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 + }); + } + + return Promise.resolve(assertions()); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-method-literal-names-asi.js b/test/language/statements/class/fields-after-same-line-static-async-method-literal-names-asi.js new file mode 100644 index 0000000000000000000000000000000000000000..77550e6155e5870a0c3dcfcbbd18d59f34c95d0a --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-static-async-method-literal-names-asi.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names-asi.case +// - src/class-fields/productions/cls-decl-after-same-line-static-async-method.template +/*--- +description: Literal property names with ASI (field definitions after a static async method in the same line) +esid: prod-FieldDefinition +features: [class, class-fields-public, 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 = 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, +}, {restore: true}); + +C.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + 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 + }); + } + + return Promise.resolve(assertions()); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-gen-literal-names-asi.js b/test/language/statements/class/fields-after-same-line-static-gen-literal-names-asi.js new file mode 100644 index 0000000000000000000000000000000000000000..930fa094c30cb9ec0d7c78cb16150bd2055c40c8 --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-static-gen-literal-names-asi.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names-asi.case +// - src/class-fields/productions/cls-decl-after-same-line-static-gen.template +/*--- +description: Literal property names with ASI (field definitions after a static generator in the same line) +esid: prod-FieldDefinition +features: [generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +class C { + static *m() { return 42; } a + b = 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: 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 +}); diff --git a/test/language/statements/class/fields-after-same-line-static-method-literal-names-asi.js b/test/language/statements/class/fields-after-same-line-static-method-literal-names-asi.js new file mode 100644 index 0000000000000000000000000000000000000000..f2a5ddda8670bc6b42950dd4b5651d83270e7185 --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-static-method-literal-names-asi.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names-asi.case +// - src/class-fields/productions/cls-decl-after-same-line-static-method.template +/*--- +description: Literal property names with ASI (field definitions after a static method in the same line) +esid: prod-FieldDefinition +features: [class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +class C { + static m() { return 42; } a + b = 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: 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 +}); diff --git a/test/language/statements/class/fields-multiple-definitions-literal-names-asi.js b/test/language/statements/class/fields-multiple-definitions-literal-names-asi.js new file mode 100644 index 0000000000000000000000000000000000000000..05e4df8328fc3195159e937068a2a035c3691c86 --- /dev/null +++ b/test/language/statements/class/fields-multiple-definitions-literal-names-asi.js @@ -0,0 +1,96 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names-asi.case +// - src/class-fields/productions/cls-decl-multiple-definitions.template +/*--- +description: Literal property names with ASI (multiple fields definitions) +esid: prod-FieldDefinition +features: [class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +class C { + foo = "foobar"; + m() { return 42 } + a + b = 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: true, + 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: true, + 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 +}); diff --git a/test/language/statements/class/fields-multiple-stacked-definitions-literal-names-asi.js b/test/language/statements/class/fields-multiple-stacked-definitions-literal-names-asi.js new file mode 100644 index 0000000000000000000000000000000000000000..bfebc2458cb1e8384c9ca44c55caefa6d7ad2166 --- /dev/null +++ b/test/language/statements/class/fields-multiple-stacked-definitions-literal-names-asi.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names-asi.case +// - src/class-fields/productions/cls-decl-multiple-stacked-definitions.template +/*--- +description: Literal property names with ASI (multiple stacked fields definitions through ASI) +esid: prod-FieldDefinition +features: [class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +class C { + a + b = 42; + foo = "foobar" + bar = "barbaz"; + +} + +var c = new C(); + +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: true, + 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: true, + 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 +}); diff --git a/test/language/statements/class/fields-new-no-sc-line-method-literal-names-asi.js b/test/language/statements/class/fields-new-no-sc-line-method-literal-names-asi.js new file mode 100644 index 0000000000000000000000000000000000000000..a8589849e9313b5aecf9ff04ba5cd02fa3860592 --- /dev/null +++ b/test/language/statements/class/fields-new-no-sc-line-method-literal-names-asi.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names-asi.case +// - src/class-fields/productions/cls-decl-new-no-sc-line-method.template +/*--- +description: Literal property names with ASI (field definitions followed by a method in a new line without a semicolon) +esid: prod-FieldDefinition +features: [class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +class C { + a + b = 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: 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 +}); diff --git a/test/language/statements/class/fields-new-sc-line-gen-literal-names-asi.js b/test/language/statements/class/fields-new-sc-line-gen-literal-names-asi.js new file mode 100644 index 0000000000000000000000000000000000000000..985a74b5c5179bb37c1ba7abe0143c3e538b8ec5 --- /dev/null +++ b/test/language/statements/class/fields-new-sc-line-gen-literal-names-asi.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names-asi.case +// - src/class-fields/productions/cls-decl-new-sc-line-generator.template +/*--- +description: Literal property names with ASI (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +class C { + a + b = 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: 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 +}); diff --git a/test/language/statements/class/fields-new-sc-line-method-literal-names-asi.js b/test/language/statements/class/fields-new-sc-line-method-literal-names-asi.js new file mode 100644 index 0000000000000000000000000000000000000000..9a7c48d27af88ce171dc0e05d761308c7c6b5afa --- /dev/null +++ b/test/language/statements/class/fields-new-sc-line-method-literal-names-asi.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names-asi.case +// - src/class-fields/productions/cls-decl-new-sc-line-method.template +/*--- +description: Literal property names with ASI (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +class C { + a + b = 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: 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 +}); diff --git a/test/language/statements/class/fields-regular-definitions-literal-names-asi.js b/test/language/statements/class/fields-regular-definitions-literal-names-asi.js new file mode 100644 index 0000000000000000000000000000000000000000..d973f9c268bcb6ffb92c47898d5dc1a961a53dac --- /dev/null +++ b/test/language/statements/class/fields-regular-definitions-literal-names-asi.js @@ -0,0 +1,50 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names-asi.case +// - src/class-fields/productions/cls-decl-regular-definitions.template +/*--- +description: Literal property names with ASI (regular fields defintion) +esid: prod-FieldDefinition +features: [class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +class C { + a + b = 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: 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 +}); diff --git a/test/language/statements/class/fields-same-line-async-gen-literal-names-asi.js b/test/language/statements/class/fields-same-line-async-gen-literal-names-asi.js new file mode 100644 index 0000000000000000000000000000000000000000..8e6acab61e40a1142ff95700200e8a3bde33da2a --- /dev/null +++ b/test/language/statements/class/fields-same-line-async-gen-literal-names-asi.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names-asi.case +// - src/class-fields/productions/cls-decl-after-same-line-async-gen.template +/*--- +description: Literal property names with ASI (field definitions after an async generator in the same line) +esid: prod-FieldDefinition +features: [class, class-fields-public, 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 = 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, +}, {restore: true}); + +c.m().next().then(function(v) { + assert.sameValue(v.value, 42); + assert.sameValue(v.done, true); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + 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 + }); + } + + return Promise.resolve(assertions()); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-method-literal-names-asi.js b/test/language/statements/class/fields-same-line-async-method-literal-names-asi.js new file mode 100644 index 0000000000000000000000000000000000000000..b1b6d62778a2c14826c0dcd335b31b1e23ee2929 --- /dev/null +++ b/test/language/statements/class/fields-same-line-async-method-literal-names-asi.js @@ -0,0 +1,73 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names-asi.case +// - src/class-fields/productions/cls-decl-after-same-line-async-method.template +/*--- +description: Literal property names with ASI (field definitions after an async method in the same line) +esid: prod-FieldDefinition +features: [class, class-fields-public, 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 = 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, +}, {restore: true}); + +c.m().then(function(v) { + assert.sameValue(v, 42); + + function assertions() { + // Cover $DONE handler for async cases. + function $DONE(error) { + if (error) { + throw new Test262Error('Test262:AsyncTestFailure') + } + } + 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 + }); + } + + return Promise.resolve(assertions()); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-gen-literal-names-asi.js b/test/language/statements/class/fields-same-line-gen-literal-names-asi.js new file mode 100644 index 0000000000000000000000000000000000000000..0455dc9a8badbaca675439f59135ed7ad6eaa74e --- /dev/null +++ b/test/language/statements/class/fields-same-line-gen-literal-names-asi.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names-asi.case +// - src/class-fields/productions/cls-decl-same-line-generator.template +/*--- +description: Literal property names with ASI (field definitions followed by a generator method in the same line) +esid: prod-FieldDefinition +features: [class, class-fields-public, generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +class C { + a + b = 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: 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 +}); diff --git a/test/language/statements/class/fields-same-line-method-literal-names-asi.js b/test/language/statements/class/fields-same-line-method-literal-names-asi.js new file mode 100644 index 0000000000000000000000000000000000000000..e6df12efcdfc56bfff681e54e29943ed63ff10ae --- /dev/null +++ b/test/language/statements/class/fields-same-line-method-literal-names-asi.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names-asi.case +// - src/class-fields/productions/cls-decl-same-line-method.template +/*--- +description: Literal property names with ASI (field definitions followed by a method in the same line) +esid: prod-FieldDefinition +features: [class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +class C { + a + b = 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: 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 +}); diff --git a/test/language/statements/class/fields-wrapped-in-sc-literal-names-asi.js b/test/language/statements/class/fields-wrapped-in-sc-literal-names-asi.js new file mode 100644 index 0000000000000000000000000000000000000000..a566fa049436881d717a736fbbe85191eb861fb6 --- /dev/null +++ b/test/language/statements/class/fields-wrapped-in-sc-literal-names-asi.js @@ -0,0 +1,52 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/literal-names-asi.case +// - src/class-fields/productions/cls-decl-wrapped-in-sc.template +/*--- +description: Literal property names with ASI (fields definition wrapped in semicolons) +esid: prod-FieldDefinition +features: [class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement: + ... + FieldDefinition ; + + FieldDefinition: + ClassElementName Initializer_opt + + ClassElementName: + PropertyName + +---*/ + + +class C { + ;;;; + ;;;;;;a + b = 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: 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 +}); diff --git a/test/language/statements/class/syntax-invalid-grammar-field-def-has-initializer-no-sc-error.js b/test/language/statements/class/syntax-invalid-grammar-field-def-has-initializer-no-sc-error.js deleted file mode 100644 index b0eb3a3a07c9594de45c6499a4b25a27faa40e52..0000000000000000000000000000000000000000 --- a/test/language/statements/class/syntax-invalid-grammar-field-def-has-initializer-no-sc-error.js +++ /dev/null @@ -1,35 +0,0 @@ -// This file was procedurally generated from the following sources: -// - src/class-fields/grammar-field-def-has-initializer-no-sc-error.case -// - src/class-fields/syntax/invalid/cls-decl-fields-invalid-syntax.template -/*--- -description: SyntaxError (class declaration) -esid: prod-ClassElement -features: [class-fields-private, class] -flags: [generated] -negative: - phase: parse - type: SyntaxError -info: | - - ClassElement : - MethodDefinition - static MethodDefinition - FieldDefinition ; - ; - - FieldDefinition : - ClassElementName Initializer _opt - - ClassElementName : - PropertyName - PrivateName - ----*/ - - -throw "Test262: This statement should not be evaluated."; - -class C { - x = [] - y; -}