diff --git a/test/language/expressions/class/fields-after-same-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js b/test/language/expressions/class/fields-after-same-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js index fc911d0320..b4820018ae 100644 --- a/test/language/expressions/class/fields-after-same-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js +++ b/test/language/expressions/class/fields-after-same-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js @@ -61,41 +61,41 @@ info: | var C = class { - *m() { return 42; } static async #$(value) { + *m() { return 42; } static async * #$(value) { yield await value; } - static async #_(value) { + static async * #_(value) { yield await value; } - static async #o(value) { + static async * #o(value) { yield await value; } - static async #℘(value) { + static async * #℘(value) { yield await value; } - static async #ZW_‌_NJ(value) { + static async * #ZW_‌_NJ(value) { yield await value; } - static async #ZW_‍_J(value) { + static async * #ZW_‍_J(value) { yield await value; }; - static async $(value) { - yield * await this.#$(value); + static get $() { + return this.#$; } - static async _(value) { - yield * await this.#_(value); + static get _() { + return this.#_; } - static async o(value) { - yield * await this.#o(value); + static get o() { + return this.#o; } - static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/expressions/class/fields-after-same-line-gen-rs-static-async-generator-method-privatename-identifier.js b/test/language/expressions/class/fields-after-same-line-gen-rs-static-async-generator-method-privatename-identifier.js index 3963332d19..69981853c9 100644 --- a/test/language/expressions/class/fields-after-same-line-gen-rs-static-async-generator-method-privatename-identifier.js +++ b/test/language/expressions/class/fields-after-same-line-gen-rs-static-async-generator-method-privatename-identifier.js @@ -62,40 +62,40 @@ info: | var C = class { *m() { return 42; } static async * #$(value) { - yield await value; + yield * await value; } static async * #_(value) { - yield await value; + yield * await value; } static async * #\u{6F}(value) { - yield await value; + yield * await value; } static async * #\u2118(value) { - yield await value; + yield * await value; } static async * #ZW_\u200C_NJ(value) { - yield await value; + yield * await value; } static async * #ZW_\u200D_J(value) { - yield await value; + yield * await value; }; - static async * $(value) { - yield * await this.#$(value); + static async * $() { + return this.#$; } - static async * _(value) { - yield * await this.#_(value); + static async * _() { + return this.#_; } - static async * \u{6F}(value) { - yield * await this.#\u{6F}(value); + static async * \u{6F}() { + return this.#\u{6F}; } - static async * \u2118(value) { - yield * await this.#\u2118(value); + static async * \u2118() { + return this.#\u2118; } - static async * ZW_\u200C_NJ(value) { - yield * await this.#ZW_\u200C_NJ(value); + static async * ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static async * ZW_\u200D_J(value) { - yield * await this.#ZW_\u200D_J(value); + static async * ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/expressions/class/fields-after-same-line-gen-rs-static-generator-method-privatename-identifier-alt.js b/test/language/expressions/class/fields-after-same-line-gen-rs-static-generator-method-privatename-identifier-alt.js index b476ac548a..ff21ef06f3 100644 --- a/test/language/expressions/class/fields-after-same-line-gen-rs-static-generator-method-privatename-identifier-alt.js +++ b/test/language/expressions/class/fields-after-same-line-gen-rs-static-generator-method-privatename-identifier-alt.js @@ -62,40 +62,40 @@ info: | var C = class { *m() { return 42; } static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #o(value) { - yield value; + yield * value; } static * #℘(value) { - yield value; + yield * value; } static * #ZW_‌_NJ(value) { - yield value; + yield * value; } static * #ZW_‍_J(value) { - yield value; + yield * value; }; - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * o(value) { - yield this.#o(value); + static get o() { + return this.#o; } - static * ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static * ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static * ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/expressions/class/fields-after-same-line-gen-rs-static-generator-method-privatename-identifier.js b/test/language/expressions/class/fields-after-same-line-gen-rs-static-generator-method-privatename-identifier.js index 04f3dda18f..8206125d7d 100644 --- a/test/language/expressions/class/fields-after-same-line-gen-rs-static-generator-method-privatename-identifier.js +++ b/test/language/expressions/class/fields-after-same-line-gen-rs-static-generator-method-privatename-identifier.js @@ -62,40 +62,40 @@ info: | var C = class { *m() { return 42; } static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #\u{6F}(value) { - yield value; + yield * value; } static * #\u2118(value) { - yield value; + yield * value; } static * #ZW_\u200C_NJ(value) { - yield value; + yield * value; } static * #ZW_\u200D_J(value) { - yield value; + yield * value; }; - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * \u{6F}(value) { - yield this.#\u{6F}(value); + static get \u{6F}() { + return this.#\u{6F}; } - static * \u2118(value) { - yield this.#\u2118(value); + static get \u2118() { + return this.#\u2118; } - static * ZW_\u200C_NJ(value) { - yield this.#ZW_\u200C_NJ(value); + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static * ZW_\u200D_J(value) { - yield this.#ZW_\u200D_J(value); + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/expressions/class/fields-after-same-line-gen-static-private-methods-with-fields.js b/test/language/expressions/class/fields-after-same-line-gen-static-private-methods-with-fields.js new file mode 100644 index 0000000000..e71673d907 --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-gen-static-private-methods-with-fields.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-private-methods-with-fields.case +// - src/class-fields/productions/cls-expr-after-same-line-gen.template +/*--- +description: static private methods with fields (field definitions after a generator in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + *m() { return 42; } static #xVal; static #yVal; + static #x(value) { + this.#xVal = value; + return this.#xVal; + } + static #y(value) { + this.#yVal = value; + return this.#yVal; + } + static x() { + return this.#x(42); + } + static y() { + return this.#y(43); + } +} + +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, +}); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7"); +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8"); +assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11"); +assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 13"); +assert.sameValue(C.y(), 43, "test 14"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16"); + +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18"); diff --git a/test/language/expressions/class/fields-after-same-line-gen-static-private-methods.js b/test/language/expressions/class/fields-after-same-line-gen-static-private-methods.js index a7b69d61cc..9639fd2f99 100644 --- a/test/language/expressions/class/fields-after-same-line-gen-static-private-methods.js +++ b/test/language/expressions/class/fields-after-same-line-gen-static-private-methods.js @@ -25,17 +25,15 @@ info: | var C = class { - *m() { return 42; } static #xVal; static #yVal; + *m() { return 42; } ; static #x(value) { - this.#xVal = value; - return this.#xVal; + return value / 2; } static #y(value) { - this.#y = value; - return this.#yVal; + return value * 2; } static x() { - return this.#x(42); + return this.#x(84); } static y() { return this.#y(43); @@ -55,18 +53,18 @@ verifyProperty(C.prototype, "m", { }); // Test the private methods do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 1"); -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 2"); -assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 3"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 4"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 5"); -assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 6"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); // Test if private fields can be sucessfully accessed and set to value assert.sameValue(C.x(), 42, "test 7"); -assert.sameValue(C.y(), 43, "test 8"); +assert.sameValue(C.y(), 86, "test 8"); // Test the private fields do not appear as properties before after set to value -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 9"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); diff --git a/test/language/expressions/class/fields-after-same-line-method-rs-static-async-generator-method-privatename-identifier-alt.js b/test/language/expressions/class/fields-after-same-line-method-rs-static-async-generator-method-privatename-identifier-alt.js index 252484c0ad..9f06a4102a 100644 --- a/test/language/expressions/class/fields-after-same-line-method-rs-static-async-generator-method-privatename-identifier-alt.js +++ b/test/language/expressions/class/fields-after-same-line-method-rs-static-async-generator-method-privatename-identifier-alt.js @@ -61,41 +61,41 @@ info: | var C = class { - m() { return 42; } static async #$(value) { + m() { return 42; } static async * #$(value) { yield await value; } - static async #_(value) { + static async * #_(value) { yield await value; } - static async #o(value) { + static async * #o(value) { yield await value; } - static async #℘(value) { + static async * #℘(value) { yield await value; } - static async #ZW_‌_NJ(value) { + static async * #ZW_‌_NJ(value) { yield await value; } - static async #ZW_‍_J(value) { + static async * #ZW_‍_J(value) { yield await value; }; - static async $(value) { - yield * await this.#$(value); + static get $() { + return this.#$; } - static async _(value) { - yield * await this.#_(value); + static get _() { + return this.#_; } - static async o(value) { - yield * await this.#o(value); + static get o() { + return this.#o; } - static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/expressions/class/fields-after-same-line-method-rs-static-async-generator-method-privatename-identifier.js b/test/language/expressions/class/fields-after-same-line-method-rs-static-async-generator-method-privatename-identifier.js index e21b8a4dd5..f5d7e71e45 100644 --- a/test/language/expressions/class/fields-after-same-line-method-rs-static-async-generator-method-privatename-identifier.js +++ b/test/language/expressions/class/fields-after-same-line-method-rs-static-async-generator-method-privatename-identifier.js @@ -62,40 +62,40 @@ info: | var C = class { m() { return 42; } static async * #$(value) { - yield await value; + yield * await value; } static async * #_(value) { - yield await value; + yield * await value; } static async * #\u{6F}(value) { - yield await value; + yield * await value; } static async * #\u2118(value) { - yield await value; + yield * await value; } static async * #ZW_\u200C_NJ(value) { - yield await value; + yield * await value; } static async * #ZW_\u200D_J(value) { - yield await value; + yield * await value; }; - static async * $(value) { - yield * await this.#$(value); + static async * $() { + return this.#$; } - static async * _(value) { - yield * await this.#_(value); + static async * _() { + return this.#_; } - static async * \u{6F}(value) { - yield * await this.#\u{6F}(value); + static async * \u{6F}() { + return this.#\u{6F}; } - static async * \u2118(value) { - yield * await this.#\u2118(value); + static async * \u2118() { + return this.#\u2118; } - static async * ZW_\u200C_NJ(value) { - yield * await this.#ZW_\u200C_NJ(value); + static async * ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static async * ZW_\u200D_J(value) { - yield * await this.#ZW_\u200D_J(value); + static async * ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/expressions/class/fields-after-same-line-method-rs-static-generator-method-privatename-identifier-alt.js b/test/language/expressions/class/fields-after-same-line-method-rs-static-generator-method-privatename-identifier-alt.js index fa9c6081c5..e9e52f25ac 100644 --- a/test/language/expressions/class/fields-after-same-line-method-rs-static-generator-method-privatename-identifier-alt.js +++ b/test/language/expressions/class/fields-after-same-line-method-rs-static-generator-method-privatename-identifier-alt.js @@ -62,40 +62,40 @@ info: | var C = class { m() { return 42; } static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #o(value) { - yield value; + yield * value; } static * #℘(value) { - yield value; + yield * value; } static * #ZW_‌_NJ(value) { - yield value; + yield * value; } static * #ZW_‍_J(value) { - yield value; + yield * value; }; - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * o(value) { - yield this.#o(value); + static get o() { + return this.#o; } - static * ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static * ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static * ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/expressions/class/fields-after-same-line-method-rs-static-generator-method-privatename-identifier.js b/test/language/expressions/class/fields-after-same-line-method-rs-static-generator-method-privatename-identifier.js index fd80b63356..dc0d84ce97 100644 --- a/test/language/expressions/class/fields-after-same-line-method-rs-static-generator-method-privatename-identifier.js +++ b/test/language/expressions/class/fields-after-same-line-method-rs-static-generator-method-privatename-identifier.js @@ -62,40 +62,40 @@ info: | var C = class { m() { return 42; } static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #\u{6F}(value) { - yield value; + yield * value; } static * #\u2118(value) { - yield value; + yield * value; } static * #ZW_\u200C_NJ(value) { - yield value; + yield * value; } static * #ZW_\u200D_J(value) { - yield value; + yield * value; }; - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * \u{6F}(value) { - yield this.#\u{6F}(value); + static get \u{6F}() { + return this.#\u{6F}; } - static * \u2118(value) { - yield this.#\u2118(value); + static get \u2118() { + return this.#\u2118; } - static * ZW_\u200C_NJ(value) { - yield this.#ZW_\u200C_NJ(value); + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static * ZW_\u200D_J(value) { - yield this.#ZW_\u200D_J(value); + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/expressions/class/fields-after-same-line-method-static-private-methods-with-fields.js b/test/language/expressions/class/fields-after-same-line-method-static-private-methods-with-fields.js new file mode 100644 index 0000000000..17159d7df5 --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-method-static-private-methods-with-fields.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-private-methods-with-fields.case +// - src/class-fields/productions/cls-expr-after-same-line-method.template +/*--- +description: static private methods with fields (field definitions after a method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + m() { return 42; } static #xVal; static #yVal; + static #x(value) { + this.#xVal = value; + return this.#xVal; + } + static #y(value) { + this.#yVal = value; + return this.#yVal; + } + static x() { + return this.#x(42); + } + static y() { + return this.#y(43); + } +} + +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, +}); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7"); +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8"); +assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11"); +assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 13"); +assert.sameValue(C.y(), 43, "test 14"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16"); + +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18"); diff --git a/test/language/expressions/class/fields-after-same-line-method-static-private-methods.js b/test/language/expressions/class/fields-after-same-line-method-static-private-methods.js index a45087347c..cd5594950d 100644 --- a/test/language/expressions/class/fields-after-same-line-method-static-private-methods.js +++ b/test/language/expressions/class/fields-after-same-line-method-static-private-methods.js @@ -25,17 +25,15 @@ info: | var C = class { - m() { return 42; } static #xVal; static #yVal; + m() { return 42; } ; static #x(value) { - this.#xVal = value; - return this.#xVal; + return value / 2; } static #y(value) { - this.#y = value; - return this.#yVal; + return value * 2; } static x() { - return this.#x(42); + return this.#x(84); } static y() { return this.#y(43); @@ -55,18 +53,18 @@ verifyProperty(C.prototype, "m", { }); // Test the private methods do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 1"); -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 2"); -assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 3"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 4"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 5"); -assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 6"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); // Test if private fields can be sucessfully accessed and set to value assert.sameValue(C.x(), 42, "test 7"); -assert.sameValue(C.y(), 43, "test 8"); +assert.sameValue(C.y(), 86, "test 8"); // Test the private fields do not appear as properties before after set to value -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 9"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); 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 index 4f92e5bc9f..bfb1108860 100644 --- 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 @@ -39,41 +39,51 @@ verifyProperty(C, "m", { writable: true, }, {restore: 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: undefined, - enumerable: true, - writable: true, - configurable: 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, "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: undefined, + 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-gen-computed-symbol-names.js b/test/language/expressions/class/fields-after-same-line-static-async-gen-computed-symbol-names.js index 80d36a6128..901648f55d 100644 --- 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 @@ -40,35 +40,45 @@ verifyProperty(C, "m", { writable: true, }, {restore: 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.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, 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); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-gen-grammar-privatename-identifier-semantics-stringvalue.js b/test/language/expressions/class/fields-after-same-line-static-async-gen-grammar-privatename-identifier-semantics-stringvalue.js index ec7fbec04c..a9e56846d0 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-gen-grammar-privatename-identifier-semantics-stringvalue.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-gen-grammar-privatename-identifier-semantics-stringvalue.js @@ -98,12 +98,22 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(c.o(1), 1); -assert.sameValue(c.℘(1), 1); -assert.sameValue(c.ZW_‌_NJ(1), 1); -assert.sameValue(c.ZW_‍_J(1), 1); - 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(c.o(1), 1); + assert.sameValue(c.℘(1), 1); + assert.sameValue(c.ZW_‌_NJ(1), 1); + assert.sameValue(c.ZW_‍_J(1), 1); + } + + return Promise.resolve(assertions()); }, $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 index b298c5f633..76a72a7f91 100644 --- 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 @@ -40,38 +40,48 @@ verifyProperty(C, "m", { writable: true, }, {restore: 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.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 + }); + + 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 + }); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-gen-private-names.js b/test/language/expressions/class/fields-after-same-line-static-async-gen-private-names.js index 8a73040702..ed92d09c0f 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-gen-private-names.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-gen-private-names.js @@ -47,24 +47,34 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -// Test the private fields do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); -assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); -assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); - -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); -assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); -assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); - -// Test if private fields can be sucessfully accessed and set to value -assert.sameValue(c.x(), 42, "test 7"); -assert.sameValue(c.y(), 43, "test 8"); - -// Test the private fields do not appear as properties before after set to value -assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 9"); -assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 10"); - 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') + } + } + // Test the private fields do not appear as properties before set to value + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + + // Test if private fields can be sucessfully accessed and set to value + assert.sameValue(c.x(), 42, "test 7"); + assert.sameValue(c.y(), 43, "test 8"); + + // Test the private fields do not appear as properties before after set to value + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 9"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 10"); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-field-identifier-initializer.js b/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-field-identifier-initializer.js index 87bb10775f..fa307baf5c 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-field-identifier-initializer.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-field-identifier-initializer.js @@ -74,14 +74,24 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(c.$, 1); -assert.sameValue(c._, 1); -assert.sameValue(c.\u{6F}, 1); -assert.sameValue(c.\u2118, 1); -assert.sameValue(c.ZW_\u200C_NJ, 1); -assert.sameValue(c.ZW_\u200D_J, 1); - 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(c.$, 1); + assert.sameValue(c._, 1); + assert.sameValue(c.\u{6F}, 1); + assert.sameValue(c.\u2118, 1); + assert.sameValue(c.ZW_\u200C_NJ, 1); + assert.sameValue(c.ZW_\u200D_J, 1); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-field-identifier.js b/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-field-identifier.js index cdf3f000f7..dc4bf4b226 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-field-identifier.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-field-identifier.js @@ -74,21 +74,31 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -c.$ = 1; -c._ = 1; -c.\u{6F} = 1; -c.\u2118 = 1; -c.ZW_\u200C_NJ = 1; -c.ZW_\u200D_J = 1; - -assert.sameValue(c.$, 1); -assert.sameValue(c._, 1); -assert.sameValue(c.\u{6F}, 1); -assert.sameValue(c.\u2118, 1); -assert.sameValue(c.ZW_\u200C_NJ, 1); -assert.sameValue(c.ZW_\u200D_J, 1); - 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') + } + } + c.$ = 1; + c._ = 1; + c.\u{6F} = 1; + c.\u2118 = 1; + c.ZW_\u200C_NJ = 1; + c.ZW_\u200D_J = 1; + + assert.sameValue(c.$, 1); + assert.sameValue(c._, 1); + assert.sameValue(c.\u{6F}, 1); + assert.sameValue(c.\u2118, 1); + assert.sameValue(c.ZW_\u200C_NJ, 1); + assert.sameValue(c.ZW_\u200D_J, 1); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-privatename-identifier-alt.js b/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-privatename-identifier-alt.js index bf0b03b253..5036153f12 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-privatename-identifier-alt.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-privatename-identifier-alt.js @@ -95,15 +95,25 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(c.$(1), 1); -assert.sameValue(c._(1), 1); -assert.sameValue(c.\u{6F}(1), 1); -assert.sameValue(c.℘(1), 1); -assert.sameValue(c.ZW_‌_NJ(1), 1); -assert.sameValue(c.ZW_‍_J(1), 1); - - 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(c.$(1), 1); + assert.sameValue(c._(1), 1); + assert.sameValue(c.\u{6F}(1), 1); + assert.sameValue(c.℘(1), 1); + assert.sameValue(c.ZW_‌_NJ(1), 1); + assert.sameValue(c.ZW_‍_J(1), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-privatename-identifier-initializer-alt.js b/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-privatename-identifier-initializer-alt.js index 718948e078..d3d5c4c489 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-privatename-identifier-initializer-alt.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-privatename-identifier-initializer-alt.js @@ -89,15 +89,25 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(c.$(), 1); -assert.sameValue(c._(), 1); -assert.sameValue(c.\u{6F}(), 1); -assert.sameValue(c.℘(), 1); -assert.sameValue(c.ZW_‌_NJ(), 1); -assert.sameValue(c.ZW_‍_J(), 1); - - 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(c.$(), 1); + assert.sameValue(c._(), 1); + assert.sameValue(c.\u{6F}(), 1); + assert.sameValue(c.℘(), 1); + assert.sameValue(c.ZW_‌_NJ(), 1); + assert.sameValue(c.ZW_‍_J(), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-privatename-identifier-initializer.js b/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-privatename-identifier-initializer.js index 9a45f465ed..102070c8ee 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-privatename-identifier-initializer.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-privatename-identifier-initializer.js @@ -89,15 +89,25 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(c.$(), 1); -assert.sameValue(c._(), 1); -assert.sameValue(c.\u{6F}(), 1); -assert.sameValue(c.\u2118(), 1); -assert.sameValue(c.ZW_\u200C_NJ(), 1); -assert.sameValue(c.ZW_\u200D_J(), 1); - - 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(c.$(), 1); + assert.sameValue(c._(), 1); + assert.sameValue(c.\u{6F}(), 1); + assert.sameValue(c.\u2118(), 1); + assert.sameValue(c.ZW_\u200C_NJ(), 1); + assert.sameValue(c.ZW_\u200D_J(), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-privatename-identifier.js b/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-privatename-identifier.js index f1693b695e..c0d8ba7d1e 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-privatename-identifier.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-privatename-identifier.js @@ -95,15 +95,25 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(c.$(1), 1); -assert.sameValue(c._(1), 1); -assert.sameValue(c.\u{6F}(1), 1); -assert.sameValue(c.\u2118(1), 1); -assert.sameValue(c.ZW_\u200C_NJ(1), 1); -assert.sameValue(c.ZW_\u200D_J(1), 1); - - 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(c.$(1), 1); + assert.sameValue(c._(1), 1); + assert.sameValue(c.\u{6F}(1), 1); + assert.sameValue(c.\u2118(1), 1); + assert.sameValue(c.ZW_\u200C_NJ(1), 1); + assert.sameValue(c.ZW_\u200D_J(1), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-async-generator-method-privatename-identifier-alt.js b/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-async-generator-method-privatename-identifier-alt.js index 84e248f8a4..7cf2aac622 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-async-generator-method-privatename-identifier-alt.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-async-generator-method-privatename-identifier-alt.js @@ -61,41 +61,41 @@ info: | var C = class { - static async *m() { return 42; } static async #$(value) { + static async *m() { return 42; } static async * #$(value) { yield await value; } - static async #_(value) { + static async * #_(value) { yield await value; } - static async #o(value) { + static async * #o(value) { yield await value; } - static async #℘(value) { + static async * #℘(value) { yield await value; } - static async #ZW_‌_NJ(value) { + static async * #ZW_‌_NJ(value) { yield await value; } - static async #ZW_‍_J(value) { + static async * #ZW_‍_J(value) { yield await value; }; - static async $(value) { - yield * await this.#$(value); + static get $() { + return this.#$; } - static async _(value) { - yield * await this.#_(value); + static get _() { + return this.#_; } - static async o(value) { - yield * await this.#o(value); + static get o() { + return this.#o; } - static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } @@ -111,25 +111,35 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -Promise.all([ - C.$(1).next(), - C._(1).next(), - C.o(1).next(), - C.℘(1).next(), // DO NOT CHANGE THE NAME OF THIS FIELD - C.ZW_‌_NJ(1).next(), // DO NOT CHANGE THE NAME OF THIS FIELD - C.ZW_‍_J(1).next(), // DO NOT CHANGE THE NAME OF THIS FIELD -]).then(results => { - - assert.sameValue(results[0].value, 1); - assert.sameValue(results[1].value, 1); - assert.sameValue(results[2].value, 1); - assert.sameValue(results[3].value, 1); - assert.sameValue(results[4].value, 1); - assert.sameValue(results[5].value, 1); - -}, $DONE).then($DONE, $DONE); - 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') + } + } + Promise.all([ + C.$(1).next(), + C._(1).next(), + C.o(1).next(), + C.℘(1).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‌_NJ(1).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‍_J(1).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + ]).then(results => { + + assert.sameValue(results[0].value, 1); + assert.sameValue(results[1].value, 1); + assert.sameValue(results[2].value, 1); + assert.sameValue(results[3].value, 1); + assert.sameValue(results[4].value, 1); + assert.sameValue(results[5].value, 1); + + }, $DONE).then($DONE, $DONE); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-async-generator-method-privatename-identifier.js b/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-async-generator-method-privatename-identifier.js index fa4f68e1b7..1fea76cae8 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-async-generator-method-privatename-identifier.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-async-generator-method-privatename-identifier.js @@ -62,40 +62,40 @@ info: | var C = class { static async *m() { return 42; } static async * #$(value) { - yield await value; + yield * await value; } static async * #_(value) { - yield await value; + yield * await value; } static async * #\u{6F}(value) { - yield await value; + yield * await value; } static async * #\u2118(value) { - yield await value; + yield * await value; } static async * #ZW_\u200C_NJ(value) { - yield await value; + yield * await value; } static async * #ZW_\u200D_J(value) { - yield await value; + yield * await value; }; - static async * $(value) { - yield * await this.#$(value); + static async * $() { + return this.#$; } - static async * _(value) { - yield * await this.#_(value); + static async * _() { + return this.#_; } - static async * \u{6F}(value) { - yield * await this.#\u{6F}(value); + static async * \u{6F}() { + return this.#\u{6F}; } - static async * \u2118(value) { - yield * await this.#\u2118(value); + static async * \u2118() { + return this.#\u2118; } - static async * ZW_\u200C_NJ(value) { - yield * await this.#ZW_\u200C_NJ(value); + static async * ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static async * ZW_\u200D_J(value) { - yield * await this.#ZW_\u200D_J(value); + static async * ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } @@ -111,26 +111,36 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -Promise.all([ - C.$(1).next(), - C._(1).next(), - C.\u{6F}(1).next(), - C.\u2118(1).next(), - C.ZW_\u200C_NJ(1).next(), - C.ZW_\u200D_J(1).next(), -]).then(results => { - - assert.sameValue(results[0].value, 1); - assert.sameValue(results[1].value, 1); - assert.sameValue(results[2].value, 1); - assert.sameValue(results[3].value, 1); - assert.sameValue(results[4].value, 1); - assert.sameValue(results[5].value, 1); - -}, $DONE).then($DONE, $DONE); - - 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') + } + } + Promise.all([ + C.$(1).next(), + C._(1).next(), + C.\u{6F}(1).next(), + C.\u2118(1).next(), + C.ZW_\u200C_NJ(1).next(), + C.ZW_\u200D_J(1).next(), + ]).then(results => { + + assert.sameValue(results[0].value, 1); + assert.sameValue(results[1].value, 1); + assert.sameValue(results[2].value, 1); + assert.sameValue(results[3].value, 1); + assert.sameValue(results[4].value, 1); + assert.sameValue(results[5].value, 1); + + }, $DONE).then($DONE, $DONE); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-async-method-privatename-identifier-alt.js b/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-async-method-privatename-identifier-alt.js index cd4791232b..da8fe5611f 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-async-method-privatename-identifier-alt.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-async-method-privatename-identifier-alt.js @@ -111,25 +111,35 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -Promise.all([ - C.$(1), - C._(1), - C.o(1), - C.℘(1), // DO NOT CHANGE THE NAME OF THIS FIELD - C.ZW_‌_NJ(1), // DO NOT CHANGE THE NAME OF THIS FIELD - C.ZW_‍_J(1), // DO NOT CHANGE THE NAME OF THIS FIELD -]).then(results => { - - assert.sameValue(results[0], 1); - assert.sameValue(results[1], 1); - assert.sameValue(results[2], 1); - assert.sameValue(results[3], 1); - assert.sameValue(results[4], 1); - assert.sameValue(results[5], 1); - -}, $DONE).then($DONE, $DONE); - 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') + } + } + Promise.all([ + C.$(1), + C._(1), + C.o(1), + C.℘(1), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‌_NJ(1), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‍_J(1), // DO NOT CHANGE THE NAME OF THIS FIELD + ]).then(results => { + + assert.sameValue(results[0], 1); + assert.sameValue(results[1], 1); + assert.sameValue(results[2], 1); + assert.sameValue(results[3], 1); + assert.sameValue(results[4], 1); + assert.sameValue(results[5], 1); + + }, $DONE).then($DONE, $DONE); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-async-method-privatename-identifier.js b/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-async-method-privatename-identifier.js index d4209a9fd3..2a00f8ca72 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-async-method-privatename-identifier.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-async-method-privatename-identifier.js @@ -111,26 +111,36 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -Promise.all([ - C.$(1), - C._(1), - C.\u{6F}(1), - C.\u2118(1), - C.ZW_\u200C_NJ(1), - C.ZW_\u200D_J(1), -]).then(results => { - - assert.sameValue(results[0], 1); - assert.sameValue(results[1], 1); - assert.sameValue(results[2], 1); - assert.sameValue(results[3], 1); - assert.sameValue(results[4], 1); - assert.sameValue(results[5], 1); - -}, $DONE).then($DONE, $DONE); - - 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') + } + } + Promise.all([ + C.$(1), + C._(1), + C.\u{6F}(1), + C.\u2118(1), + C.ZW_\u200C_NJ(1), + C.ZW_\u200D_J(1), + ]).then(results => { + + assert.sameValue(results[0], 1); + assert.sameValue(results[1], 1); + assert.sameValue(results[2], 1); + assert.sameValue(results[3], 1); + assert.sameValue(results[4], 1); + assert.sameValue(results[5], 1); + + }, $DONE).then($DONE, $DONE); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-generator-method-privatename-identifier-alt.js b/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-generator-method-privatename-identifier-alt.js index 9872898804..31b3575d57 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-generator-method-privatename-identifier-alt.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-generator-method-privatename-identifier-alt.js @@ -62,40 +62,40 @@ info: | var C = class { static async *m() { return 42; } static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #o(value) { - yield value; + yield * value; } static * #℘(value) { - yield value; + yield * value; } static * #ZW_‌_NJ(value) { - yield value; + yield * value; } static * #ZW_‍_J(value) { - yield value; + yield * value; }; - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * o(value) { - yield this.#o(value); + static get o() { + return this.#o; } - static * ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static * ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static * ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } @@ -111,14 +111,24 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1).next().value, 1); -assert.sameValue(C._(1).next().value, 1); -assert.sameValue(C.o(1).next().value, 1); -assert.sameValue(C.℘(1).next().value, 1); -assert.sameValue(C.ZW_‌_NJ(1).next().value, 1); -assert.sameValue(C.ZW_‍_J(1).next().value, 1); - 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(C.$(1).next().value, 1); + assert.sameValue(C._(1).next().value, 1); + assert.sameValue(C.o(1).next().value, 1); + assert.sameValue(C.℘(1).next().value, 1); + assert.sameValue(C.ZW_‌_NJ(1).next().value, 1); + assert.sameValue(C.ZW_‍_J(1).next().value, 1); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-generator-method-privatename-identifier.js b/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-generator-method-privatename-identifier.js index cca95d074c..fdc6e94eca 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-generator-method-privatename-identifier.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-generator-method-privatename-identifier.js @@ -62,40 +62,40 @@ info: | var C = class { static async *m() { return 42; } static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #\u{6F}(value) { - yield value; + yield * value; } static * #\u2118(value) { - yield value; + yield * value; } static * #ZW_\u200C_NJ(value) { - yield value; + yield * value; } static * #ZW_\u200D_J(value) { - yield value; + yield * value; }; - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * \u{6F}(value) { - yield this.#\u{6F}(value); + static get \u{6F}() { + return this.#\u{6F}; } - static * \u2118(value) { - yield this.#\u2118(value); + static get \u2118() { + return this.#\u2118; } - static * ZW_\u200C_NJ(value) { - yield this.#ZW_\u200C_NJ(value); + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static * ZW_\u200D_J(value) { - yield this.#ZW_\u200D_J(value); + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } @@ -111,15 +111,25 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1).next().value, 1); -assert.sameValue(C._(1).next().value, 1); -assert.sameValue(C.\u{6F}(1).next().value, 1); -assert.sameValue(C.\u2118(1).next().value, 1); -assert.sameValue(C.ZW_\u200C_NJ(1).next().value, 1); -assert.sameValue(C.ZW_\u200D_J(1).next().value, 1); - - 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(C.$(1).next().value, 1); + assert.sameValue(C._(1).next().value, 1); + assert.sameValue(C.\u{6F}(1).next().value, 1); + assert.sameValue(C.\u2118(1).next().value, 1); + assert.sameValue(C.ZW_\u200C_NJ(1).next().value, 1); + assert.sameValue(C.ZW_\u200D_J(1).next().value, 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-method-privatename-identifier-alt.js b/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-method-privatename-identifier-alt.js index 8c1b3ec4ae..9a35ca9679 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-method-privatename-identifier-alt.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-method-privatename-identifier-alt.js @@ -108,15 +108,25 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1), 1); -assert.sameValue(C._(1), 1); -assert.sameValue(C.o(1), 1); -assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD -assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD -assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD - - 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(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.o(1), 1); + assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-method-privatename-identifier.js b/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-method-privatename-identifier.js index 3367d390f4..a2591243a5 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-method-privatename-identifier.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-method-privatename-identifier.js @@ -108,15 +108,25 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1), 1); -assert.sameValue(C._(1), 1); -assert.sameValue(C.\u{6F}(1), 1); -assert.sameValue(C.\u2118(1), 1); -assert.sameValue(C.ZW_\u200C_NJ(1), 1); -assert.sameValue(C.ZW_\u200D_J(1), 1); - - 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(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.\u{6F}(1), 1); + assert.sameValue(C.\u2118(1), 1); + assert.sameValue(C.ZW_\u200C_NJ(1), 1); + assert.sameValue(C.ZW_\u200D_J(1), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier-alt-by-classname.js b/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier-alt-by-classname.js index 41b6ead3f0..9b71691e31 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier-alt-by-classname.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier-alt-by-classname.js @@ -96,15 +96,25 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1), 1); -assert.sameValue(C._(1), 1); -assert.sameValue(C.o(1), 1); -assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD -assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD -assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD - - 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(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.o(1), 1); + assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier-alt.js b/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier-alt.js index fae74f1829..73a514b15d 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier-alt.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier-alt.js @@ -96,15 +96,25 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1), 1); -assert.sameValue(C._(1), 1); -assert.sameValue(C.o(1), 1); -assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD -assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD -assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD - - 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(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.o(1), 1); + assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier-by-classname.js b/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier-by-classname.js index a646301450..d8f41b3aa6 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier-by-classname.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier-by-classname.js @@ -96,15 +96,25 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1), 1); -assert.sameValue(C._(1), 1); -assert.sameValue(C.\u{6F}(1), 1); -assert.sameValue(C.\u2118(1), 1); -assert.sameValue(C.ZW_\u200C_NJ(1), 1); -assert.sameValue(C.ZW_\u200D_J(1), 1); - - 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(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.\u{6F}(1), 1); + assert.sameValue(C.\u2118(1), 1); + assert.sameValue(C.ZW_\u200C_NJ(1), 1); + assert.sameValue(C.ZW_\u200D_J(1), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js b/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js index 09fce36734..807418f83c 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js @@ -90,15 +90,25 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(), 1); -assert.sameValue(C._(), 1); -assert.sameValue(C.\u{6F}(), 1); -assert.sameValue(C.℘(), 1); -assert.sameValue(C.ZW_‌_NJ(), 1); -assert.sameValue(C.ZW_‍_J(), 1); - - 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(C.$(), 1); + assert.sameValue(C._(), 1); + assert.sameValue(C.\u{6F}(), 1); + assert.sameValue(C.℘(), 1); + assert.sameValue(C.ZW_‌_NJ(), 1); + assert.sameValue(C.ZW_‍_J(), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier-initializer-alt.js b/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier-initializer-alt.js index c35ef2e3ca..62af4c1635 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier-initializer-alt.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier-initializer-alt.js @@ -90,15 +90,25 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(), 1); -assert.sameValue(C._(), 1); -assert.sameValue(C.\u{6F}(), 1); -assert.sameValue(C.℘(), 1); -assert.sameValue(C.ZW_‌_NJ(), 1); -assert.sameValue(C.ZW_‍_J(), 1); - - 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(C.$(), 1); + assert.sameValue(C._(), 1); + assert.sameValue(C.\u{6F}(), 1); + assert.sameValue(C.℘(), 1); + assert.sameValue(C.ZW_‌_NJ(), 1); + assert.sameValue(C.ZW_‍_J(), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier-initializer.js b/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier-initializer.js index b3bae16d27..c6f01fda88 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier-initializer.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier-initializer.js @@ -90,15 +90,25 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(), 1); -assert.sameValue(C._(), 1); -assert.sameValue(C.\u{6F}(), 1); -assert.sameValue(C.\u2118(), 1); -assert.sameValue(C.ZW_\u200C_NJ(), 1); -assert.sameValue(C.ZW_\u200D_J(), 1); - - 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(C.$(), 1); + assert.sameValue(C._(), 1); + assert.sameValue(C.\u{6F}(), 1); + assert.sameValue(C.\u2118(), 1); + assert.sameValue(C.ZW_\u200C_NJ(), 1); + assert.sameValue(C.ZW_\u200D_J(), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier.js b/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier.js index c898059164..38d8ff2094 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier.js @@ -96,15 +96,25 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1), 1); -assert.sameValue(C._(1), 1); -assert.sameValue(C.\u{6F}(1), 1); -assert.sameValue(C.\u2118(1), 1); -assert.sameValue(C.ZW_\u200C_NJ(1), 1); -assert.sameValue(C.ZW_\u200D_J(1), 1); - - 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(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.\u{6F}(1), 1); + assert.sameValue(C.\u2118(1), 1); + assert.sameValue(C.ZW_\u200C_NJ(1), 1); + assert.sameValue(C.ZW_\u200D_J(1), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-gen-static-private-fields.js b/test/language/expressions/class/fields-after-same-line-static-async-gen-static-private-fields.js index 8f27dd8736..96ff7d881c 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-gen-static-private-fields.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-gen-static-private-fields.js @@ -47,24 +47,34 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -// Test the private fields do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); -assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); -assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); - -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); -assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); -assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); - -// Test if private fields can be sucessfully accessed and set to value -assert.sameValue(C.x(), 42, "test 7"); -assert.sameValue(C.y(), 43, "test 8"); - -// Test the private fields do not appear as properties before after set to value -assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); -assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); - 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') + } + } + // Test the private fields do not appear as properties before set to value + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + + // Test if private fields can be sucessfully accessed and set to value + assert.sameValue(C.x(), 42, "test 7"); + assert.sameValue(C.y(), 43, "test 8"); + + // Test the private fields do not appear as properties before after set to value + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-gen-static-private-methods-with-fields.js b/test/language/expressions/class/fields-after-same-line-static-async-gen-static-private-methods-with-fields.js new file mode 100644 index 0000000000..4e6610b25e --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-static-async-gen-static-private-methods-with-fields.js @@ -0,0 +1,98 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-private-methods-with-fields.case +// - src/class-fields/productions/cls-expr-after-same-line-static-async-gen.template +/*--- +description: static private methods with fields (field definitions after a static async generator in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public, + async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + static async *m() { return 42; } static #xVal; static #yVal; + static #x(value) { + this.#xVal = value; + return this.#xVal; + } + static #y(value) { + this.#yVal = value; + return this.#yVal; + } + static x() { + return this.#x(42); + } + static y() { + return this.#y(43); + } +} + +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') + } + } + // Test the private methods do not appear as properties before set to value + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7"); + assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8"); + assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10"); + assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11"); + assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12"); + + // Test if private fields can be sucessfully accessed and set to value + assert.sameValue(C.x(), 42, "test 13"); + assert.sameValue(C.y(), 43, "test 14"); + + // Test the private fields do not appear as properties before after set to value + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16"); + + assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17"); + assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18"); + } + + return Promise.resolve(assertions()); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-gen-static-private-methods.js b/test/language/expressions/class/fields-after-same-line-static-async-gen-static-private-methods.js index d8e030b0d5..20f8d7aa0e 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-gen-static-private-methods.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-gen-static-private-methods.js @@ -25,17 +25,15 @@ info: | var C = class { - static async *m() { return 42; } static #xVal; static #yVal; + static async *m() { return 42; } ; static #x(value) { - this.#xVal = value; - return this.#xVal; + return value / 2; } static #y(value) { - this.#y = value; - return this.#yVal; + return value * 2; } static x() { - return this.#x(42); + return this.#x(84); } static y() { return this.#y(43); @@ -53,24 +51,34 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -// Test the private methods do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 1"); -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 2"); -assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 3"); - -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 4"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 5"); -assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 6"); - -// Test if private fields can be sucessfully accessed and set to value -assert.sameValue(C.x(), 42, "test 7"); -assert.sameValue(C.y(), 43, "test 8"); - -// Test the private fields do not appear as properties before after set to value -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 9"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 10"); - 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') + } + } + // Test the private methods do not appear as properties before set to value + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + + // Test if private fields can be sucessfully accessed and set to value + assert.sameValue(C.x(), 42, "test 7"); + assert.sameValue(C.y(), 86, "test 8"); + + // Test the private fields do not appear as properties before after set to value + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); + } + + return Promise.resolve(assertions()); }, $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 index 95e1a46432..ce1018ae6f 100644 --- 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 @@ -38,47 +38,57 @@ verifyProperty(C, "m", { writable: true, }, {restore: 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: undefined, - 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: 39, - enumerable: true, - writable: true, - configurable: true -}); - -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "d"), false); -assert.sameValue(Object.hasOwnProperty.call(C, "d"), false); - -verifyProperty(c, "d", { - value: 42, - enumerable: true, - writable: true, - configurable: 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: undefined, + 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: 39, + enumerable: true, + writable: true, + configurable: true + }); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "d"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "d"), false); + + verifyProperty(c, "d", { + 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-computed-names.js b/test/language/expressions/class/fields-after-same-line-static-async-method-computed-names.js index b32ed9b83f..e0938c4544 100644 --- 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 @@ -39,40 +39,50 @@ verifyProperty(C, "m", { writable: true, }, {restore: 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: undefined, - enumerable: true, - writable: true, - configurable: 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, "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: undefined, + 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-computed-symbol-names.js b/test/language/expressions/class/fields-after-same-line-static-async-method-computed-symbol-names.js index 392fb7b0a6..04091e6e96 100644 --- 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 @@ -40,34 +40,44 @@ verifyProperty(C, "m", { writable: true, }, {restore: 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); + + 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, 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); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-method-grammar-privatename-identifier-semantics-stringvalue.js b/test/language/expressions/class/fields-after-same-line-static-async-method-grammar-privatename-identifier-semantics-stringvalue.js index 5e932402ae..e5426eef12 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-method-grammar-privatename-identifier-semantics-stringvalue.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-method-grammar-privatename-identifier-semantics-stringvalue.js @@ -98,11 +98,21 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(c.o(1), 1); -assert.sameValue(c.℘(1), 1); -assert.sameValue(c.ZW_‌_NJ(1), 1); -assert.sameValue(c.ZW_‍_J(1), 1); - 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(c.o(1), 1); + assert.sameValue(c.℘(1), 1); + assert.sameValue(c.ZW_‌_NJ(1), 1); + assert.sameValue(c.ZW_‍_J(1), 1); + } + + return Promise.resolve(assertions()); }, $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 index 14f723d1dd..166d40d02f 100644 --- 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 @@ -40,37 +40,47 @@ verifyProperty(C, "m", { writable: true, }, {restore: 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); + + 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 + }); + + 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 + }); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-method-private-names.js b/test/language/expressions/class/fields-after-same-line-static-async-method-private-names.js index 2dfe19655f..4a04280937 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-method-private-names.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-method-private-names.js @@ -47,23 +47,33 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -// Test the private fields do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); -assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); -assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); - -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); -assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); -assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); - -// Test if private fields can be sucessfully accessed and set to value -assert.sameValue(c.x(), 42, "test 7"); -assert.sameValue(c.y(), 43, "test 8"); - -// Test the private fields do not appear as properties before after set to value -assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 9"); -assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 10"); - 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') + } + } + // Test the private fields do not appear as properties before set to value + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + + // Test if private fields can be sucessfully accessed and set to value + assert.sameValue(c.x(), 42, "test 7"); + assert.sameValue(c.y(), 43, "test 8"); + + // Test the private fields do not appear as properties before after set to value + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 9"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 10"); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-method-rs-field-identifier-initializer.js b/test/language/expressions/class/fields-after-same-line-static-async-method-rs-field-identifier-initializer.js index cc3a4aef07..6a1590440a 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-method-rs-field-identifier-initializer.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-method-rs-field-identifier-initializer.js @@ -74,13 +74,23 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(c.$, 1); -assert.sameValue(c._, 1); -assert.sameValue(c.\u{6F}, 1); -assert.sameValue(c.\u2118, 1); -assert.sameValue(c.ZW_\u200C_NJ, 1); -assert.sameValue(c.ZW_\u200D_J, 1); - 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(c.$, 1); + assert.sameValue(c._, 1); + assert.sameValue(c.\u{6F}, 1); + assert.sameValue(c.\u2118, 1); + assert.sameValue(c.ZW_\u200C_NJ, 1); + assert.sameValue(c.ZW_\u200D_J, 1); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-method-rs-field-identifier.js b/test/language/expressions/class/fields-after-same-line-static-async-method-rs-field-identifier.js index 6a6270a478..ee7569bd93 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-method-rs-field-identifier.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-method-rs-field-identifier.js @@ -74,20 +74,30 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -c.$ = 1; -c._ = 1; -c.\u{6F} = 1; -c.\u2118 = 1; -c.ZW_\u200C_NJ = 1; -c.ZW_\u200D_J = 1; - -assert.sameValue(c.$, 1); -assert.sameValue(c._, 1); -assert.sameValue(c.\u{6F}, 1); -assert.sameValue(c.\u2118, 1); -assert.sameValue(c.ZW_\u200C_NJ, 1); -assert.sameValue(c.ZW_\u200D_J, 1); - 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') + } + } + c.$ = 1; + c._ = 1; + c.\u{6F} = 1; + c.\u2118 = 1; + c.ZW_\u200C_NJ = 1; + c.ZW_\u200D_J = 1; + + assert.sameValue(c.$, 1); + assert.sameValue(c._, 1); + assert.sameValue(c.\u{6F}, 1); + assert.sameValue(c.\u2118, 1); + assert.sameValue(c.ZW_\u200C_NJ, 1); + assert.sameValue(c.ZW_\u200D_J, 1); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-method-rs-privatename-identifier-alt.js b/test/language/expressions/class/fields-after-same-line-static-async-method-rs-privatename-identifier-alt.js index df53d38f99..6b4d954e86 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-method-rs-privatename-identifier-alt.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-method-rs-privatename-identifier-alt.js @@ -95,14 +95,24 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(c.$(1), 1); -assert.sameValue(c._(1), 1); -assert.sameValue(c.\u{6F}(1), 1); -assert.sameValue(c.℘(1), 1); -assert.sameValue(c.ZW_‌_NJ(1), 1); -assert.sameValue(c.ZW_‍_J(1), 1); - - 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(c.$(1), 1); + assert.sameValue(c._(1), 1); + assert.sameValue(c.\u{6F}(1), 1); + assert.sameValue(c.℘(1), 1); + assert.sameValue(c.ZW_‌_NJ(1), 1); + assert.sameValue(c.ZW_‍_J(1), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-method-rs-privatename-identifier-initializer-alt.js b/test/language/expressions/class/fields-after-same-line-static-async-method-rs-privatename-identifier-initializer-alt.js index 950a23d17a..7a48df1b60 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-method-rs-privatename-identifier-initializer-alt.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-method-rs-privatename-identifier-initializer-alt.js @@ -89,14 +89,24 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(c.$(), 1); -assert.sameValue(c._(), 1); -assert.sameValue(c.\u{6F}(), 1); -assert.sameValue(c.℘(), 1); -assert.sameValue(c.ZW_‌_NJ(), 1); -assert.sameValue(c.ZW_‍_J(), 1); - - 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(c.$(), 1); + assert.sameValue(c._(), 1); + assert.sameValue(c.\u{6F}(), 1); + assert.sameValue(c.℘(), 1); + assert.sameValue(c.ZW_‌_NJ(), 1); + assert.sameValue(c.ZW_‍_J(), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-method-rs-privatename-identifier-initializer.js b/test/language/expressions/class/fields-after-same-line-static-async-method-rs-privatename-identifier-initializer.js index 2a734e15f6..c90bd5319b 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-method-rs-privatename-identifier-initializer.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-method-rs-privatename-identifier-initializer.js @@ -89,14 +89,24 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(c.$(), 1); -assert.sameValue(c._(), 1); -assert.sameValue(c.\u{6F}(), 1); -assert.sameValue(c.\u2118(), 1); -assert.sameValue(c.ZW_\u200C_NJ(), 1); -assert.sameValue(c.ZW_\u200D_J(), 1); - - 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(c.$(), 1); + assert.sameValue(c._(), 1); + assert.sameValue(c.\u{6F}(), 1); + assert.sameValue(c.\u2118(), 1); + assert.sameValue(c.ZW_\u200C_NJ(), 1); + assert.sameValue(c.ZW_\u200D_J(), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-method-rs-privatename-identifier.js b/test/language/expressions/class/fields-after-same-line-static-async-method-rs-privatename-identifier.js index 2aeb93b8c8..7fb854b73c 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-method-rs-privatename-identifier.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-method-rs-privatename-identifier.js @@ -95,14 +95,24 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(c.$(1), 1); -assert.sameValue(c._(1), 1); -assert.sameValue(c.\u{6F}(1), 1); -assert.sameValue(c.\u2118(1), 1); -assert.sameValue(c.ZW_\u200C_NJ(1), 1); -assert.sameValue(c.ZW_\u200D_J(1), 1); - - 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(c.$(1), 1); + assert.sameValue(c._(1), 1); + assert.sameValue(c.\u{6F}(1), 1); + assert.sameValue(c.\u2118(1), 1); + assert.sameValue(c.ZW_\u200C_NJ(1), 1); + assert.sameValue(c.ZW_\u200D_J(1), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-async-generator-method-privatename-identifier-alt.js b/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-async-generator-method-privatename-identifier-alt.js index a1ebbc4c7a..6df986a9ca 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-async-generator-method-privatename-identifier-alt.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-async-generator-method-privatename-identifier-alt.js @@ -61,41 +61,41 @@ info: | var C = class { - static async m() { return 42; } static async #$(value) { + static async m() { return 42; } static async * #$(value) { yield await value; } - static async #_(value) { + static async * #_(value) { yield await value; } - static async #o(value) { + static async * #o(value) { yield await value; } - static async #℘(value) { + static async * #℘(value) { yield await value; } - static async #ZW_‌_NJ(value) { + static async * #ZW_‌_NJ(value) { yield await value; } - static async #ZW_‍_J(value) { + static async * #ZW_‍_J(value) { yield await value; }; - static async $(value) { - yield * await this.#$(value); + static get $() { + return this.#$; } - static async _(value) { - yield * await this.#_(value); + static get _() { + return this.#_; } - static async o(value) { - yield * await this.#o(value); + static get o() { + return this.#o; } - static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } @@ -111,24 +111,34 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -Promise.all([ - C.$(1).next(), - C._(1).next(), - C.o(1).next(), - C.℘(1).next(), // DO NOT CHANGE THE NAME OF THIS FIELD - C.ZW_‌_NJ(1).next(), // DO NOT CHANGE THE NAME OF THIS FIELD - C.ZW_‍_J(1).next(), // DO NOT CHANGE THE NAME OF THIS FIELD -]).then(results => { - - assert.sameValue(results[0].value, 1); - assert.sameValue(results[1].value, 1); - assert.sameValue(results[2].value, 1); - assert.sameValue(results[3].value, 1); - assert.sameValue(results[4].value, 1); - assert.sameValue(results[5].value, 1); - -}, $DONE).then($DONE, $DONE); - 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') + } + } + Promise.all([ + C.$(1).next(), + C._(1).next(), + C.o(1).next(), + C.℘(1).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‌_NJ(1).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‍_J(1).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + ]).then(results => { + + assert.sameValue(results[0].value, 1); + assert.sameValue(results[1].value, 1); + assert.sameValue(results[2].value, 1); + assert.sameValue(results[3].value, 1); + assert.sameValue(results[4].value, 1); + assert.sameValue(results[5].value, 1); + + }, $DONE).then($DONE, $DONE); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-async-generator-method-privatename-identifier.js b/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-async-generator-method-privatename-identifier.js index f062838678..3a88a620fb 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-async-generator-method-privatename-identifier.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-async-generator-method-privatename-identifier.js @@ -62,40 +62,40 @@ info: | var C = class { static async m() { return 42; } static async * #$(value) { - yield await value; + yield * await value; } static async * #_(value) { - yield await value; + yield * await value; } static async * #\u{6F}(value) { - yield await value; + yield * await value; } static async * #\u2118(value) { - yield await value; + yield * await value; } static async * #ZW_\u200C_NJ(value) { - yield await value; + yield * await value; } static async * #ZW_\u200D_J(value) { - yield await value; + yield * await value; }; - static async * $(value) { - yield * await this.#$(value); + static async * $() { + return this.#$; } - static async * _(value) { - yield * await this.#_(value); + static async * _() { + return this.#_; } - static async * \u{6F}(value) { - yield * await this.#\u{6F}(value); + static async * \u{6F}() { + return this.#\u{6F}; } - static async * \u2118(value) { - yield * await this.#\u2118(value); + static async * \u2118() { + return this.#\u2118; } - static async * ZW_\u200C_NJ(value) { - yield * await this.#ZW_\u200C_NJ(value); + static async * ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static async * ZW_\u200D_J(value) { - yield * await this.#ZW_\u200D_J(value); + static async * ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } @@ -111,25 +111,35 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -Promise.all([ - C.$(1).next(), - C._(1).next(), - C.\u{6F}(1).next(), - C.\u2118(1).next(), - C.ZW_\u200C_NJ(1).next(), - C.ZW_\u200D_J(1).next(), -]).then(results => { - - assert.sameValue(results[0].value, 1); - assert.sameValue(results[1].value, 1); - assert.sameValue(results[2].value, 1); - assert.sameValue(results[3].value, 1); - assert.sameValue(results[4].value, 1); - assert.sameValue(results[5].value, 1); - -}, $DONE).then($DONE, $DONE); - - 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') + } + } + Promise.all([ + C.$(1).next(), + C._(1).next(), + C.\u{6F}(1).next(), + C.\u2118(1).next(), + C.ZW_\u200C_NJ(1).next(), + C.ZW_\u200D_J(1).next(), + ]).then(results => { + + assert.sameValue(results[0].value, 1); + assert.sameValue(results[1].value, 1); + assert.sameValue(results[2].value, 1); + assert.sameValue(results[3].value, 1); + assert.sameValue(results[4].value, 1); + assert.sameValue(results[5].value, 1); + + }, $DONE).then($DONE, $DONE); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-async-method-privatename-identifier-alt.js b/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-async-method-privatename-identifier-alt.js index 3d80577fa5..8d834ca550 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-async-method-privatename-identifier-alt.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-async-method-privatename-identifier-alt.js @@ -111,24 +111,34 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -Promise.all([ - C.$(1), - C._(1), - C.o(1), - C.℘(1), // DO NOT CHANGE THE NAME OF THIS FIELD - C.ZW_‌_NJ(1), // DO NOT CHANGE THE NAME OF THIS FIELD - C.ZW_‍_J(1), // DO NOT CHANGE THE NAME OF THIS FIELD -]).then(results => { - - assert.sameValue(results[0], 1); - assert.sameValue(results[1], 1); - assert.sameValue(results[2], 1); - assert.sameValue(results[3], 1); - assert.sameValue(results[4], 1); - assert.sameValue(results[5], 1); - -}, $DONE).then($DONE, $DONE); - 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') + } + } + Promise.all([ + C.$(1), + C._(1), + C.o(1), + C.℘(1), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‌_NJ(1), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‍_J(1), // DO NOT CHANGE THE NAME OF THIS FIELD + ]).then(results => { + + assert.sameValue(results[0], 1); + assert.sameValue(results[1], 1); + assert.sameValue(results[2], 1); + assert.sameValue(results[3], 1); + assert.sameValue(results[4], 1); + assert.sameValue(results[5], 1); + + }, $DONE).then($DONE, $DONE); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-async-method-privatename-identifier.js b/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-async-method-privatename-identifier.js index 842b65e3b8..db2e674beb 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-async-method-privatename-identifier.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-async-method-privatename-identifier.js @@ -111,25 +111,35 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -Promise.all([ - C.$(1), - C._(1), - C.\u{6F}(1), - C.\u2118(1), - C.ZW_\u200C_NJ(1), - C.ZW_\u200D_J(1), -]).then(results => { - - assert.sameValue(results[0], 1); - assert.sameValue(results[1], 1); - assert.sameValue(results[2], 1); - assert.sameValue(results[3], 1); - assert.sameValue(results[4], 1); - assert.sameValue(results[5], 1); - -}, $DONE).then($DONE, $DONE); - - 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') + } + } + Promise.all([ + C.$(1), + C._(1), + C.\u{6F}(1), + C.\u2118(1), + C.ZW_\u200C_NJ(1), + C.ZW_\u200D_J(1), + ]).then(results => { + + assert.sameValue(results[0], 1); + assert.sameValue(results[1], 1); + assert.sameValue(results[2], 1); + assert.sameValue(results[3], 1); + assert.sameValue(results[4], 1); + assert.sameValue(results[5], 1); + + }, $DONE).then($DONE, $DONE); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-generator-method-privatename-identifier-alt.js b/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-generator-method-privatename-identifier-alt.js index 02ed350661..d11fcb72c7 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-generator-method-privatename-identifier-alt.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-generator-method-privatename-identifier-alt.js @@ -62,40 +62,40 @@ info: | var C = class { static async m() { return 42; } static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #o(value) { - yield value; + yield * value; } static * #℘(value) { - yield value; + yield * value; } static * #ZW_‌_NJ(value) { - yield value; + yield * value; } static * #ZW_‍_J(value) { - yield value; + yield * value; }; - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * o(value) { - yield this.#o(value); + static get o() { + return this.#o; } - static * ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static * ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static * ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } @@ -111,13 +111,23 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1).next().value, 1); -assert.sameValue(C._(1).next().value, 1); -assert.sameValue(C.o(1).next().value, 1); -assert.sameValue(C.℘(1).next().value, 1); -assert.sameValue(C.ZW_‌_NJ(1).next().value, 1); -assert.sameValue(C.ZW_‍_J(1).next().value, 1); - 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(C.$(1).next().value, 1); + assert.sameValue(C._(1).next().value, 1); + assert.sameValue(C.o(1).next().value, 1); + assert.sameValue(C.℘(1).next().value, 1); + assert.sameValue(C.ZW_‌_NJ(1).next().value, 1); + assert.sameValue(C.ZW_‍_J(1).next().value, 1); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-generator-method-privatename-identifier.js b/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-generator-method-privatename-identifier.js index 194dc3d999..d54a82407f 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-generator-method-privatename-identifier.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-generator-method-privatename-identifier.js @@ -62,40 +62,40 @@ info: | var C = class { static async m() { return 42; } static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #\u{6F}(value) { - yield value; + yield * value; } static * #\u2118(value) { - yield value; + yield * value; } static * #ZW_\u200C_NJ(value) { - yield value; + yield * value; } static * #ZW_\u200D_J(value) { - yield value; + yield * value; }; - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * \u{6F}(value) { - yield this.#\u{6F}(value); + static get \u{6F}() { + return this.#\u{6F}; } - static * \u2118(value) { - yield this.#\u2118(value); + static get \u2118() { + return this.#\u2118; } - static * ZW_\u200C_NJ(value) { - yield this.#ZW_\u200C_NJ(value); + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static * ZW_\u200D_J(value) { - yield this.#ZW_\u200D_J(value); + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } @@ -111,14 +111,24 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1).next().value, 1); -assert.sameValue(C._(1).next().value, 1); -assert.sameValue(C.\u{6F}(1).next().value, 1); -assert.sameValue(C.\u2118(1).next().value, 1); -assert.sameValue(C.ZW_\u200C_NJ(1).next().value, 1); -assert.sameValue(C.ZW_\u200D_J(1).next().value, 1); - - 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(C.$(1).next().value, 1); + assert.sameValue(C._(1).next().value, 1); + assert.sameValue(C.\u{6F}(1).next().value, 1); + assert.sameValue(C.\u2118(1).next().value, 1); + assert.sameValue(C.ZW_\u200C_NJ(1).next().value, 1); + assert.sameValue(C.ZW_\u200D_J(1).next().value, 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-method-privatename-identifier-alt.js b/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-method-privatename-identifier-alt.js index 018063c0e9..fd52de3d25 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-method-privatename-identifier-alt.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-method-privatename-identifier-alt.js @@ -108,14 +108,24 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1), 1); -assert.sameValue(C._(1), 1); -assert.sameValue(C.o(1), 1); -assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD -assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD -assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD - - 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(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.o(1), 1); + assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-method-privatename-identifier.js b/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-method-privatename-identifier.js index a0124ed6dc..2bbc3368ee 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-method-privatename-identifier.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-method-privatename-identifier.js @@ -108,14 +108,24 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1), 1); -assert.sameValue(C._(1), 1); -assert.sameValue(C.\u{6F}(1), 1); -assert.sameValue(C.\u2118(1), 1); -assert.sameValue(C.ZW_\u200C_NJ(1), 1); -assert.sameValue(C.ZW_\u200D_J(1), 1); - - 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(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.\u{6F}(1), 1); + assert.sameValue(C.\u2118(1), 1); + assert.sameValue(C.ZW_\u200C_NJ(1), 1); + assert.sameValue(C.ZW_\u200D_J(1), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier-alt-by-classname.js b/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier-alt-by-classname.js index d121c08459..855072f5ed 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier-alt-by-classname.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier-alt-by-classname.js @@ -96,14 +96,24 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1), 1); -assert.sameValue(C._(1), 1); -assert.sameValue(C.o(1), 1); -assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD -assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD -assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD - - 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(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.o(1), 1); + assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier-alt.js b/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier-alt.js index bb4679d89f..bc80961b63 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier-alt.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier-alt.js @@ -96,14 +96,24 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1), 1); -assert.sameValue(C._(1), 1); -assert.sameValue(C.o(1), 1); -assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD -assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD -assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD - - 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(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.o(1), 1); + assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier-by-classname.js b/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier-by-classname.js index 1460024a08..dcb3d360d5 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier-by-classname.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier-by-classname.js @@ -96,14 +96,24 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1), 1); -assert.sameValue(C._(1), 1); -assert.sameValue(C.\u{6F}(1), 1); -assert.sameValue(C.\u2118(1), 1); -assert.sameValue(C.ZW_\u200C_NJ(1), 1); -assert.sameValue(C.ZW_\u200D_J(1), 1); - - 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(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.\u{6F}(1), 1); + assert.sameValue(C.\u2118(1), 1); + assert.sameValue(C.ZW_\u200C_NJ(1), 1); + assert.sameValue(C.ZW_\u200D_J(1), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier-initializer-alt-by-classname.js b/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier-initializer-alt-by-classname.js index f1ce0e6a3b..01b88952ff 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier-initializer-alt-by-classname.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier-initializer-alt-by-classname.js @@ -90,14 +90,24 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(), 1); -assert.sameValue(C._(), 1); -assert.sameValue(C.\u{6F}(), 1); -assert.sameValue(C.℘(), 1); -assert.sameValue(C.ZW_‌_NJ(), 1); -assert.sameValue(C.ZW_‍_J(), 1); - - 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(C.$(), 1); + assert.sameValue(C._(), 1); + assert.sameValue(C.\u{6F}(), 1); + assert.sameValue(C.℘(), 1); + assert.sameValue(C.ZW_‌_NJ(), 1); + assert.sameValue(C.ZW_‍_J(), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier-initializer-alt.js b/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier-initializer-alt.js index 741cc639d6..6d7d7a39c8 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier-initializer-alt.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier-initializer-alt.js @@ -90,14 +90,24 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(), 1); -assert.sameValue(C._(), 1); -assert.sameValue(C.\u{6F}(), 1); -assert.sameValue(C.℘(), 1); -assert.sameValue(C.ZW_‌_NJ(), 1); -assert.sameValue(C.ZW_‍_J(), 1); - - 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(C.$(), 1); + assert.sameValue(C._(), 1); + assert.sameValue(C.\u{6F}(), 1); + assert.sameValue(C.℘(), 1); + assert.sameValue(C.ZW_‌_NJ(), 1); + assert.sameValue(C.ZW_‍_J(), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier-initializer.js b/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier-initializer.js index ee6fedcc0d..1a04620757 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier-initializer.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier-initializer.js @@ -90,14 +90,24 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(), 1); -assert.sameValue(C._(), 1); -assert.sameValue(C.\u{6F}(), 1); -assert.sameValue(C.\u2118(), 1); -assert.sameValue(C.ZW_\u200C_NJ(), 1); -assert.sameValue(C.ZW_\u200D_J(), 1); - - 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(C.$(), 1); + assert.sameValue(C._(), 1); + assert.sameValue(C.\u{6F}(), 1); + assert.sameValue(C.\u2118(), 1); + assert.sameValue(C.ZW_\u200C_NJ(), 1); + assert.sameValue(C.ZW_\u200D_J(), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier.js b/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier.js index ee079a906d..1fe7145228 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier.js @@ -96,14 +96,24 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1), 1); -assert.sameValue(C._(1), 1); -assert.sameValue(C.\u{6F}(1), 1); -assert.sameValue(C.\u2118(1), 1); -assert.sameValue(C.ZW_\u200C_NJ(1), 1); -assert.sameValue(C.ZW_\u200D_J(1), 1); - - 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(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.\u{6F}(1), 1); + assert.sameValue(C.\u2118(1), 1); + assert.sameValue(C.ZW_\u200C_NJ(1), 1); + assert.sameValue(C.ZW_\u200D_J(1), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-method-static-private-fields.js b/test/language/expressions/class/fields-after-same-line-static-async-method-static-private-fields.js index 21a43260e1..f5ffc73db5 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-method-static-private-fields.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-method-static-private-fields.js @@ -47,23 +47,33 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -// Test the private fields do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); -assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); -assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); - -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); -assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); -assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); - -// Test if private fields can be sucessfully accessed and set to value -assert.sameValue(C.x(), 42, "test 7"); -assert.sameValue(C.y(), 43, "test 8"); - -// Test the private fields do not appear as properties before after set to value -assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); -assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); - 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') + } + } + // Test the private fields do not appear as properties before set to value + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + + // Test if private fields can be sucessfully accessed and set to value + assert.sameValue(C.x(), 42, "test 7"); + assert.sameValue(C.y(), 43, "test 8"); + + // Test the private fields do not appear as properties before after set to value + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-method-static-private-methods-with-fields.js b/test/language/expressions/class/fields-after-same-line-static-async-method-static-private-methods-with-fields.js new file mode 100644 index 0000000000..9b6bbb6ce0 --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-static-async-method-static-private-methods-with-fields.js @@ -0,0 +1,97 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-private-methods-with-fields.case +// - src/class-fields/productions/cls-expr-after-same-line-static-async-method.template +/*--- +description: static private methods with fields (field definitions after a static async method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public, + async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + static async m() { return 42; } static #xVal; static #yVal; + static #x(value) { + this.#xVal = value; + return this.#xVal; + } + static #y(value) { + this.#yVal = value; + return this.#yVal; + } + static x() { + return this.#x(42); + } + static y() { + return this.#y(43); + } +} + +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') + } + } + // Test the private methods do not appear as properties before set to value + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7"); + assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8"); + assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10"); + assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11"); + assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12"); + + // Test if private fields can be sucessfully accessed and set to value + assert.sameValue(C.x(), 42, "test 13"); + assert.sameValue(C.y(), 43, "test 14"); + + // Test the private fields do not appear as properties before after set to value + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16"); + + assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17"); + assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18"); + } + + return Promise.resolve(assertions()); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-after-same-line-static-async-method-static-private-methods.js b/test/language/expressions/class/fields-after-same-line-static-async-method-static-private-methods.js index 3a61adf3ff..a6bec3eb49 100644 --- a/test/language/expressions/class/fields-after-same-line-static-async-method-static-private-methods.js +++ b/test/language/expressions/class/fields-after-same-line-static-async-method-static-private-methods.js @@ -25,17 +25,15 @@ info: | var C = class { - static async m() { return 42; } static #xVal; static #yVal; + static async m() { return 42; } ; static #x(value) { - this.#xVal = value; - return this.#xVal; + return value / 2; } static #y(value) { - this.#y = value; - return this.#yVal; + return value * 2; } static x() { - return this.#x(42); + return this.#x(84); } static y() { return this.#y(43); @@ -53,23 +51,33 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -// Test the private methods do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 1"); -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 2"); -assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 3"); - -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 4"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 5"); -assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 6"); - -// Test if private fields can be sucessfully accessed and set to value -assert.sameValue(C.x(), 42, "test 7"); -assert.sameValue(C.y(), 43, "test 8"); - -// Test the private fields do not appear as properties before after set to value -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 9"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 10"); - 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') + } + } + // Test the private methods do not appear as properties before set to value + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + + // Test if private fields can be sucessfully accessed and set to value + assert.sameValue(C.x(), 42, "test 7"); + assert.sameValue(C.y(), 86, "test 8"); + + // Test the private fields do not appear as properties before after set to value + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); + } + + return Promise.resolve(assertions()); }, $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 index 9d0422cbdc..d9f7af8b18 100644 --- 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 @@ -38,46 +38,56 @@ verifyProperty(C, "m", { writable: true, }, {restore: 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: undefined, - 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: 39, - enumerable: true, - writable: true, - configurable: true -}); - -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "d"), false); -assert.sameValue(Object.hasOwnProperty.call(C, "d"), false); - -verifyProperty(c, "d", { - value: 42, - enumerable: true, - writable: true, - configurable: 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: undefined, + 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: 39, + enumerable: true, + writable: true, + configurable: true + }); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "d"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "d"), false); + + verifyProperty(c, "d", { + 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-rs-static-async-generator-method-privatename-identifier-alt.js b/test/language/expressions/class/fields-after-same-line-static-gen-rs-static-async-generator-method-privatename-identifier-alt.js index 7ed3135c5e..ce4adc3b88 100644 --- a/test/language/expressions/class/fields-after-same-line-static-gen-rs-static-async-generator-method-privatename-identifier-alt.js +++ b/test/language/expressions/class/fields-after-same-line-static-gen-rs-static-async-generator-method-privatename-identifier-alt.js @@ -61,41 +61,41 @@ info: | var C = class { - static *m() { return 42; } static async #$(value) { + static *m() { return 42; } static async * #$(value) { yield await value; } - static async #_(value) { + static async * #_(value) { yield await value; } - static async #o(value) { + static async * #o(value) { yield await value; } - static async #℘(value) { + static async * #℘(value) { yield await value; } - static async #ZW_‌_NJ(value) { + static async * #ZW_‌_NJ(value) { yield await value; } - static async #ZW_‍_J(value) { + static async * #ZW_‍_J(value) { yield await value; }; - static async $(value) { - yield * await this.#$(value); + static get $() { + return this.#$; } - static async _(value) { - yield * await this.#_(value); + static get _() { + return this.#_; } - static async o(value) { - yield * await this.#o(value); + static get o() { + return this.#o; } - static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/expressions/class/fields-after-same-line-static-gen-rs-static-async-generator-method-privatename-identifier.js b/test/language/expressions/class/fields-after-same-line-static-gen-rs-static-async-generator-method-privatename-identifier.js index 6f0571f81c..06356c8527 100644 --- a/test/language/expressions/class/fields-after-same-line-static-gen-rs-static-async-generator-method-privatename-identifier.js +++ b/test/language/expressions/class/fields-after-same-line-static-gen-rs-static-async-generator-method-privatename-identifier.js @@ -62,40 +62,40 @@ info: | var C = class { static *m() { return 42; } static async * #$(value) { - yield await value; + yield * await value; } static async * #_(value) { - yield await value; + yield * await value; } static async * #\u{6F}(value) { - yield await value; + yield * await value; } static async * #\u2118(value) { - yield await value; + yield * await value; } static async * #ZW_\u200C_NJ(value) { - yield await value; + yield * await value; } static async * #ZW_\u200D_J(value) { - yield await value; + yield * await value; }; - static async * $(value) { - yield * await this.#$(value); + static async * $() { + return this.#$; } - static async * _(value) { - yield * await this.#_(value); + static async * _() { + return this.#_; } - static async * \u{6F}(value) { - yield * await this.#\u{6F}(value); + static async * \u{6F}() { + return this.#\u{6F}; } - static async * \u2118(value) { - yield * await this.#\u2118(value); + static async * \u2118() { + return this.#\u2118; } - static async * ZW_\u200C_NJ(value) { - yield * await this.#ZW_\u200C_NJ(value); + static async * ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static async * ZW_\u200D_J(value) { - yield * await this.#ZW_\u200D_J(value); + static async * ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/expressions/class/fields-after-same-line-static-gen-rs-static-generator-method-privatename-identifier-alt.js b/test/language/expressions/class/fields-after-same-line-static-gen-rs-static-generator-method-privatename-identifier-alt.js index 67e21fb3f7..fa18e79e92 100644 --- a/test/language/expressions/class/fields-after-same-line-static-gen-rs-static-generator-method-privatename-identifier-alt.js +++ b/test/language/expressions/class/fields-after-same-line-static-gen-rs-static-generator-method-privatename-identifier-alt.js @@ -62,40 +62,40 @@ info: | var C = class { static *m() { return 42; } static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #o(value) { - yield value; + yield * value; } static * #℘(value) { - yield value; + yield * value; } static * #ZW_‌_NJ(value) { - yield value; + yield * value; } static * #ZW_‍_J(value) { - yield value; + yield * value; }; - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * o(value) { - yield this.#o(value); + static get o() { + return this.#o; } - static * ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static * ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static * ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/expressions/class/fields-after-same-line-static-gen-rs-static-generator-method-privatename-identifier.js b/test/language/expressions/class/fields-after-same-line-static-gen-rs-static-generator-method-privatename-identifier.js index fd57c93431..f7307965b2 100644 --- a/test/language/expressions/class/fields-after-same-line-static-gen-rs-static-generator-method-privatename-identifier.js +++ b/test/language/expressions/class/fields-after-same-line-static-gen-rs-static-generator-method-privatename-identifier.js @@ -62,40 +62,40 @@ info: | var C = class { static *m() { return 42; } static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #\u{6F}(value) { - yield value; + yield * value; } static * #\u2118(value) { - yield value; + yield * value; } static * #ZW_\u200C_NJ(value) { - yield value; + yield * value; } static * #ZW_\u200D_J(value) { - yield value; + yield * value; }; - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * \u{6F}(value) { - yield this.#\u{6F}(value); + static get \u{6F}() { + return this.#\u{6F}; } - static * \u2118(value) { - yield this.#\u2118(value); + static get \u2118() { + return this.#\u2118; } - static * ZW_\u200C_NJ(value) { - yield this.#ZW_\u200C_NJ(value); + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static * ZW_\u200D_J(value) { - yield this.#ZW_\u200D_J(value); + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/expressions/class/fields-after-same-line-static-gen-static-private-methods-with-fields.js b/test/language/expressions/class/fields-after-same-line-static-gen-static-private-methods-with-fields.js new file mode 100644 index 0000000000..387d134558 --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-static-gen-static-private-methods-with-fields.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-private-methods-with-fields.case +// - src/class-fields/productions/cls-expr-after-same-line-static-gen.template +/*--- +description: static private methods with fields (field definitions after a static generator in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + static *m() { return 42; } static #xVal; static #yVal; + static #x(value) { + this.#xVal = value; + return this.#xVal; + } + static #y(value) { + this.#yVal = value; + return this.#yVal; + } + static x() { + return this.#x(42); + } + static y() { + return this.#y(43); + } +} + +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, +}); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7"); +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8"); +assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11"); +assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 13"); +assert.sameValue(C.y(), 43, "test 14"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16"); + +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18"); diff --git a/test/language/expressions/class/fields-after-same-line-static-gen-static-private-methods.js b/test/language/expressions/class/fields-after-same-line-static-gen-static-private-methods.js index b7e9ca1ae2..b23414123b 100644 --- a/test/language/expressions/class/fields-after-same-line-static-gen-static-private-methods.js +++ b/test/language/expressions/class/fields-after-same-line-static-gen-static-private-methods.js @@ -25,17 +25,15 @@ info: | var C = class { - static *m() { return 42; } static #xVal; static #yVal; + static *m() { return 42; } ; static #x(value) { - this.#xVal = value; - return this.#xVal; + return value / 2; } static #y(value) { - this.#y = value; - return this.#yVal; + return value * 2; } static x() { - return this.#x(42); + return this.#x(84); } static y() { return this.#y(43); @@ -55,18 +53,18 @@ verifyProperty(C, "m", { }); // Test the private methods do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 1"); -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 2"); -assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 3"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 4"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 5"); -assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 6"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); // Test if private fields can be sucessfully accessed and set to value assert.sameValue(C.x(), 42, "test 7"); -assert.sameValue(C.y(), 43, "test 8"); +assert.sameValue(C.y(), 86, "test 8"); // Test the private fields do not appear as properties before after set to value -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 9"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); diff --git a/test/language/expressions/class/fields-after-same-line-static-method-rs-static-async-generator-method-privatename-identifier-alt.js b/test/language/expressions/class/fields-after-same-line-static-method-rs-static-async-generator-method-privatename-identifier-alt.js index 8b81ed9948..72fd281cbf 100644 --- a/test/language/expressions/class/fields-after-same-line-static-method-rs-static-async-generator-method-privatename-identifier-alt.js +++ b/test/language/expressions/class/fields-after-same-line-static-method-rs-static-async-generator-method-privatename-identifier-alt.js @@ -61,41 +61,41 @@ info: | var C = class { - static m() { return 42; } static async #$(value) { + static m() { return 42; } static async * #$(value) { yield await value; } - static async #_(value) { + static async * #_(value) { yield await value; } - static async #o(value) { + static async * #o(value) { yield await value; } - static async #℘(value) { + static async * #℘(value) { yield await value; } - static async #ZW_‌_NJ(value) { + static async * #ZW_‌_NJ(value) { yield await value; } - static async #ZW_‍_J(value) { + static async * #ZW_‍_J(value) { yield await value; }; - static async $(value) { - yield * await this.#$(value); + static get $() { + return this.#$; } - static async _(value) { - yield * await this.#_(value); + static get _() { + return this.#_; } - static async o(value) { - yield * await this.#o(value); + static get o() { + return this.#o; } - static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/expressions/class/fields-after-same-line-static-method-rs-static-async-generator-method-privatename-identifier.js b/test/language/expressions/class/fields-after-same-line-static-method-rs-static-async-generator-method-privatename-identifier.js index dba6451cf2..08ac599fc1 100644 --- a/test/language/expressions/class/fields-after-same-line-static-method-rs-static-async-generator-method-privatename-identifier.js +++ b/test/language/expressions/class/fields-after-same-line-static-method-rs-static-async-generator-method-privatename-identifier.js @@ -62,40 +62,40 @@ info: | var C = class { static m() { return 42; } static async * #$(value) { - yield await value; + yield * await value; } static async * #_(value) { - yield await value; + yield * await value; } static async * #\u{6F}(value) { - yield await value; + yield * await value; } static async * #\u2118(value) { - yield await value; + yield * await value; } static async * #ZW_\u200C_NJ(value) { - yield await value; + yield * await value; } static async * #ZW_\u200D_J(value) { - yield await value; + yield * await value; }; - static async * $(value) { - yield * await this.#$(value); + static async * $() { + return this.#$; } - static async * _(value) { - yield * await this.#_(value); + static async * _() { + return this.#_; } - static async * \u{6F}(value) { - yield * await this.#\u{6F}(value); + static async * \u{6F}() { + return this.#\u{6F}; } - static async * \u2118(value) { - yield * await this.#\u2118(value); + static async * \u2118() { + return this.#\u2118; } - static async * ZW_\u200C_NJ(value) { - yield * await this.#ZW_\u200C_NJ(value); + static async * ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static async * ZW_\u200D_J(value) { - yield * await this.#ZW_\u200D_J(value); + static async * ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/expressions/class/fields-after-same-line-static-method-rs-static-generator-method-privatename-identifier-alt.js b/test/language/expressions/class/fields-after-same-line-static-method-rs-static-generator-method-privatename-identifier-alt.js index 8ea5bb1746..c6d12d3884 100644 --- a/test/language/expressions/class/fields-after-same-line-static-method-rs-static-generator-method-privatename-identifier-alt.js +++ b/test/language/expressions/class/fields-after-same-line-static-method-rs-static-generator-method-privatename-identifier-alt.js @@ -62,40 +62,40 @@ info: | var C = class { static m() { return 42; } static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #o(value) { - yield value; + yield * value; } static * #℘(value) { - yield value; + yield * value; } static * #ZW_‌_NJ(value) { - yield value; + yield * value; } static * #ZW_‍_J(value) { - yield value; + yield * value; }; - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * o(value) { - yield this.#o(value); + static get o() { + return this.#o; } - static * ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static * ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static * ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/expressions/class/fields-after-same-line-static-method-rs-static-generator-method-privatename-identifier.js b/test/language/expressions/class/fields-after-same-line-static-method-rs-static-generator-method-privatename-identifier.js index f1ce1992d4..4233c9282d 100644 --- a/test/language/expressions/class/fields-after-same-line-static-method-rs-static-generator-method-privatename-identifier.js +++ b/test/language/expressions/class/fields-after-same-line-static-method-rs-static-generator-method-privatename-identifier.js @@ -62,40 +62,40 @@ info: | var C = class { static m() { return 42; } static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #\u{6F}(value) { - yield value; + yield * value; } static * #\u2118(value) { - yield value; + yield * value; } static * #ZW_\u200C_NJ(value) { - yield value; + yield * value; } static * #ZW_\u200D_J(value) { - yield value; + yield * value; }; - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * \u{6F}(value) { - yield this.#\u{6F}(value); + static get \u{6F}() { + return this.#\u{6F}; } - static * \u2118(value) { - yield this.#\u2118(value); + static get \u2118() { + return this.#\u2118; } - static * ZW_\u200C_NJ(value) { - yield this.#ZW_\u200C_NJ(value); + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static * ZW_\u200D_J(value) { - yield this.#ZW_\u200D_J(value); + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/expressions/class/fields-after-same-line-static-method-static-private-methods-with-fields.js b/test/language/expressions/class/fields-after-same-line-static-method-static-private-methods-with-fields.js new file mode 100644 index 0000000000..39c4a87e38 --- /dev/null +++ b/test/language/expressions/class/fields-after-same-line-static-method-static-private-methods-with-fields.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-private-methods-with-fields.case +// - src/class-fields/productions/cls-expr-after-same-line-static-method.template +/*--- +description: static private methods with fields (field definitions after a static method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + static m() { return 42; } static #xVal; static #yVal; + static #x(value) { + this.#xVal = value; + return this.#xVal; + } + static #y(value) { + this.#yVal = value; + return this.#yVal; + } + static x() { + return this.#x(42); + } + static y() { + return this.#y(43); + } +} + +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, +}); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7"); +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8"); +assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11"); +assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 13"); +assert.sameValue(C.y(), 43, "test 14"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16"); + +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18"); diff --git a/test/language/expressions/class/fields-after-same-line-static-method-static-private-methods.js b/test/language/expressions/class/fields-after-same-line-static-method-static-private-methods.js index 8cb2832729..d79182d748 100644 --- a/test/language/expressions/class/fields-after-same-line-static-method-static-private-methods.js +++ b/test/language/expressions/class/fields-after-same-line-static-method-static-private-methods.js @@ -25,17 +25,15 @@ info: | var C = class { - static m() { return 42; } static #xVal; static #yVal; + static m() { return 42; } ; static #x(value) { - this.#xVal = value; - return this.#xVal; + return value / 2; } static #y(value) { - this.#y = value; - return this.#yVal; + return value * 2; } static x() { - return this.#x(42); + return this.#x(84); } static y() { return this.#y(43); @@ -55,18 +53,18 @@ verifyProperty(C, "m", { }); // Test the private methods do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 1"); -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 2"); -assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 3"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 4"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 5"); -assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 6"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); // Test if private fields can be sucessfully accessed and set to value assert.sameValue(C.x(), 42, "test 7"); -assert.sameValue(C.y(), 43, "test 8"); +assert.sameValue(C.y(), 86, "test 8"); // Test the private fields do not appear as properties before after set to value -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 9"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); diff --git a/test/language/expressions/class/fields-multiple-definitions-rs-static-async-generator-method-privatename-identifier-alt.js b/test/language/expressions/class/fields-multiple-definitions-rs-static-async-generator-method-privatename-identifier-alt.js index 5ccf01a63f..2d1c0a1057 100644 --- a/test/language/expressions/class/fields-multiple-definitions-rs-static-async-generator-method-privatename-identifier-alt.js +++ b/test/language/expressions/class/fields-multiple-definitions-rs-static-async-generator-method-privatename-identifier-alt.js @@ -63,43 +63,43 @@ info: | var C = class { foo = "foobar"; m() { return 42 } - static async #$(value) { + static async * #$(value) { yield await value; } - static async #_(value) { + static async * #_(value) { yield await value; } - static async #o(value) { + static async * #o(value) { yield await value; } - static async #℘(value) { + static async * #℘(value) { yield await value; } - static async #ZW_‌_NJ(value) { + static async * #ZW_‌_NJ(value) { yield await value; } - static async #ZW_‍_J(value) { + static async * #ZW_‍_J(value) { yield await value; } m2() { return 39 } bar = "barbaz"; - static async $(value) { - yield * await this.#$(value); + static get $() { + return this.#$; } - static async _(value) { - yield * await this.#_(value); + static get _() { + return this.#_; } - static async o(value) { - yield * await this.#o(value); + static get o() { + return this.#o; } - static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/expressions/class/fields-multiple-definitions-rs-static-async-generator-method-privatename-identifier.js b/test/language/expressions/class/fields-multiple-definitions-rs-static-async-generator-method-privatename-identifier.js index 4e45cd1f00..60c154bcfc 100644 --- a/test/language/expressions/class/fields-multiple-definitions-rs-static-async-generator-method-privatename-identifier.js +++ b/test/language/expressions/class/fields-multiple-definitions-rs-static-async-generator-method-privatename-identifier.js @@ -64,42 +64,42 @@ var C = class { foo = "foobar"; m() { return 42 } static async * #$(value) { - yield await value; + yield * await value; } static async * #_(value) { - yield await value; + yield * await value; } static async * #\u{6F}(value) { - yield await value; + yield * await value; } static async * #\u2118(value) { - yield await value; + yield * await value; } static async * #ZW_\u200C_NJ(value) { - yield await value; + yield * await value; } static async * #ZW_\u200D_J(value) { - yield await value; + yield * await value; } m2() { return 39 } bar = "barbaz"; - static async * $(value) { - yield * await this.#$(value); + static async * $() { + return this.#$; } - static async * _(value) { - yield * await this.#_(value); + static async * _() { + return this.#_; } - static async * \u{6F}(value) { - yield * await this.#\u{6F}(value); + static async * \u{6F}() { + return this.#\u{6F}; } - static async * \u2118(value) { - yield * await this.#\u2118(value); + static async * \u2118() { + return this.#\u2118; } - static async * ZW_\u200C_NJ(value) { - yield * await this.#ZW_\u200C_NJ(value); + static async * ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static async * ZW_\u200D_J(value) { - yield * await this.#ZW_\u200D_J(value); + static async * ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/expressions/class/fields-multiple-definitions-rs-static-generator-method-privatename-identifier-alt.js b/test/language/expressions/class/fields-multiple-definitions-rs-static-generator-method-privatename-identifier-alt.js index b72e78cfb0..ca6a339d7c 100644 --- a/test/language/expressions/class/fields-multiple-definitions-rs-static-generator-method-privatename-identifier-alt.js +++ b/test/language/expressions/class/fields-multiple-definitions-rs-static-generator-method-privatename-identifier-alt.js @@ -64,42 +64,42 @@ var C = class { foo = "foobar"; m() { return 42 } static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #o(value) { - yield value; + yield * value; } static * #℘(value) { - yield value; + yield * value; } static * #ZW_‌_NJ(value) { - yield value; + yield * value; } static * #ZW_‍_J(value) { - yield value; + yield * value; } m2() { return 39 } bar = "barbaz"; - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * o(value) { - yield this.#o(value); + static get o() { + return this.#o; } - static * ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static * ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static * ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/expressions/class/fields-multiple-definitions-rs-static-generator-method-privatename-identifier.js b/test/language/expressions/class/fields-multiple-definitions-rs-static-generator-method-privatename-identifier.js index 4aa37a2528..020842fa4c 100644 --- a/test/language/expressions/class/fields-multiple-definitions-rs-static-generator-method-privatename-identifier.js +++ b/test/language/expressions/class/fields-multiple-definitions-rs-static-generator-method-privatename-identifier.js @@ -64,42 +64,42 @@ var C = class { foo = "foobar"; m() { return 42 } static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #\u{6F}(value) { - yield value; + yield * value; } static * #\u2118(value) { - yield value; + yield * value; } static * #ZW_\u200C_NJ(value) { - yield value; + yield * value; } static * #ZW_\u200D_J(value) { - yield value; + yield * value; } m2() { return 39 } bar = "barbaz"; - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * \u{6F}(value) { - yield this.#\u{6F}(value); + static get \u{6F}() { + return this.#\u{6F}; } - static * \u2118(value) { - yield this.#\u2118(value); + static get \u2118() { + return this.#\u2118; } - static * ZW_\u200C_NJ(value) { - yield this.#ZW_\u200C_NJ(value); + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static * ZW_\u200D_J(value) { - yield this.#ZW_\u200D_J(value); + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/expressions/class/fields-multiple-definitions-static-private-methods-with-fields.js b/test/language/expressions/class/fields-multiple-definitions-static-private-methods-with-fields.js new file mode 100644 index 0000000000..effd613865 --- /dev/null +++ b/test/language/expressions/class/fields-multiple-definitions-static-private-methods-with-fields.js @@ -0,0 +1,119 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-private-methods-with-fields.case +// - src/class-fields/productions/cls-expr-multiple-definitions.template +/*--- +description: static private methods with fields (multiple fields definitions) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + foo = "foobar"; + m() { return 42 } + static #xVal; static #yVal + m2() { return 39 } + bar = "barbaz"; + static #x(value) { + this.#xVal = value; + return this.#xVal; + } + static #y(value) { + this.#yVal = value; + return this.#yVal; + } + static x() { + return this.#x(42); + } + static y() { + return this.#y(43); + } +} + +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, +}); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7"); +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8"); +assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11"); +assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 13"); +assert.sameValue(C.y(), 43, "test 14"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16"); + +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18"); diff --git a/test/language/expressions/class/fields-multiple-definitions-static-private-methods.js b/test/language/expressions/class/fields-multiple-definitions-static-private-methods.js index dec012b261..073971189b 100644 --- a/test/language/expressions/class/fields-multiple-definitions-static-private-methods.js +++ b/test/language/expressions/class/fields-multiple-definitions-static-private-methods.js @@ -27,19 +27,17 @@ info: | var C = class { foo = "foobar"; m() { return 42 } - static #xVal; static #yVal + m2() { return 39 } bar = "barbaz"; static #x(value) { - this.#xVal = value; - return this.#xVal; + return value / 2; } static #y(value) { - this.#y = value; - return this.#yVal; + return value * 2; } static x() { - return this.#x(42); + return this.#x(84); } static y() { return this.#y(43); @@ -91,18 +89,18 @@ verifyProperty(c, "bar", { }); // Test the private methods do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 1"); -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 2"); -assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 3"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 4"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 5"); -assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 6"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); // Test if private fields can be sucessfully accessed and set to value assert.sameValue(C.x(), 42, "test 7"); -assert.sameValue(C.y(), 43, "test 8"); +assert.sameValue(C.y(), 86, "test 8"); // Test the private fields do not appear as properties before after set to value -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 9"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); diff --git a/test/language/expressions/class/fields-multiple-stacked-definitions-rs-static-async-generator-method-privatename-identifier-alt.js b/test/language/expressions/class/fields-multiple-stacked-definitions-rs-static-async-generator-method-privatename-identifier-alt.js index 779ab2384b..5eb792a6bf 100644 --- a/test/language/expressions/class/fields-multiple-stacked-definitions-rs-static-async-generator-method-privatename-identifier-alt.js +++ b/test/language/expressions/class/fields-multiple-stacked-definitions-rs-static-async-generator-method-privatename-identifier-alt.js @@ -61,43 +61,43 @@ info: | var C = class { - static async #$(value) { + static async * #$(value) { yield await value; } - static async #_(value) { + static async * #_(value) { yield await value; } - static async #o(value) { + static async * #o(value) { yield await value; } - static async #℘(value) { + static async * #℘(value) { yield await value; } - static async #ZW_‌_NJ(value) { + static async * #ZW_‌_NJ(value) { yield await value; } - static async #ZW_‍_J(value) { + static async * #ZW_‍_J(value) { yield await value; } foo = "foobar" bar = "barbaz"; - static async $(value) { - yield * await this.#$(value); + static get $() { + return this.#$; } - static async _(value) { - yield * await this.#_(value); + static get _() { + return this.#_; } - static async o(value) { - yield * await this.#o(value); + static get o() { + return this.#o; } - static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/expressions/class/fields-multiple-stacked-definitions-rs-static-async-generator-method-privatename-identifier.js b/test/language/expressions/class/fields-multiple-stacked-definitions-rs-static-async-generator-method-privatename-identifier.js index 8960c89dfb..ff89ffcfd8 100644 --- a/test/language/expressions/class/fields-multiple-stacked-definitions-rs-static-async-generator-method-privatename-identifier.js +++ b/test/language/expressions/class/fields-multiple-stacked-definitions-rs-static-async-generator-method-privatename-identifier.js @@ -62,42 +62,42 @@ info: | var C = class { static async * #$(value) { - yield await value; + yield * await value; } static async * #_(value) { - yield await value; + yield * await value; } static async * #\u{6F}(value) { - yield await value; + yield * await value; } static async * #\u2118(value) { - yield await value; + yield * await value; } static async * #ZW_\u200C_NJ(value) { - yield await value; + yield * await value; } static async * #ZW_\u200D_J(value) { - yield await value; + yield * await value; } foo = "foobar" bar = "barbaz"; - static async * $(value) { - yield * await this.#$(value); + static async * $() { + return this.#$; } - static async * _(value) { - yield * await this.#_(value); + static async * _() { + return this.#_; } - static async * \u{6F}(value) { - yield * await this.#\u{6F}(value); + static async * \u{6F}() { + return this.#\u{6F}; } - static async * \u2118(value) { - yield * await this.#\u2118(value); + static async * \u2118() { + return this.#\u2118; } - static async * ZW_\u200C_NJ(value) { - yield * await this.#ZW_\u200C_NJ(value); + static async * ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static async * ZW_\u200D_J(value) { - yield * await this.#ZW_\u200D_J(value); + static async * ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/expressions/class/fields-multiple-stacked-definitions-rs-static-generator-method-privatename-identifier-alt.js b/test/language/expressions/class/fields-multiple-stacked-definitions-rs-static-generator-method-privatename-identifier-alt.js index 4840c98d97..7f8e83b6c0 100644 --- a/test/language/expressions/class/fields-multiple-stacked-definitions-rs-static-generator-method-privatename-identifier-alt.js +++ b/test/language/expressions/class/fields-multiple-stacked-definitions-rs-static-generator-method-privatename-identifier-alt.js @@ -62,42 +62,42 @@ info: | var C = class { static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #o(value) { - yield value; + yield * value; } static * #℘(value) { - yield value; + yield * value; } static * #ZW_‌_NJ(value) { - yield value; + yield * value; } static * #ZW_‍_J(value) { - yield value; + yield * value; } foo = "foobar" bar = "barbaz"; - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * o(value) { - yield this.#o(value); + static get o() { + return this.#o; } - static * ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static * ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static * ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/expressions/class/fields-multiple-stacked-definitions-rs-static-generator-method-privatename-identifier.js b/test/language/expressions/class/fields-multiple-stacked-definitions-rs-static-generator-method-privatename-identifier.js index d1ef00fc02..9400b141e6 100644 --- a/test/language/expressions/class/fields-multiple-stacked-definitions-rs-static-generator-method-privatename-identifier.js +++ b/test/language/expressions/class/fields-multiple-stacked-definitions-rs-static-generator-method-privatename-identifier.js @@ -62,42 +62,42 @@ info: | var C = class { static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #\u{6F}(value) { - yield value; + yield * value; } static * #\u2118(value) { - yield value; + yield * value; } static * #ZW_\u200C_NJ(value) { - yield value; + yield * value; } static * #ZW_\u200D_J(value) { - yield value; + yield * value; } foo = "foobar" bar = "barbaz"; - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * \u{6F}(value) { - yield this.#\u{6F}(value); + static get \u{6F}() { + return this.#\u{6F}; } - static * \u2118(value) { - yield this.#\u2118(value); + static get \u2118() { + return this.#\u2118; } - static * ZW_\u200C_NJ(value) { - yield this.#ZW_\u200C_NJ(value); + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static * ZW_\u200D_J(value) { - yield this.#ZW_\u200D_J(value); + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/expressions/class/fields-multiple-stacked-definitions-static-private-methods-with-fields.js b/test/language/expressions/class/fields-multiple-stacked-definitions-static-private-methods-with-fields.js new file mode 100644 index 0000000000..ff6b10b567 --- /dev/null +++ b/test/language/expressions/class/fields-multiple-stacked-definitions-static-private-methods-with-fields.js @@ -0,0 +1,97 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-private-methods-with-fields.case +// - src/class-fields/productions/cls-expr-multiple-stacked-definitions.template +/*--- +description: static private methods with fields (multiple stacked fields definitions through ASI) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + static #xVal; static #yVal + foo = "foobar" + bar = "barbaz"; + static #x(value) { + this.#xVal = value; + return this.#xVal; + } + static #y(value) { + this.#yVal = value; + return this.#yVal; + } + static x() { + return this.#x(42); + } + static y() { + return this.#y(43); + } +} + +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, +}); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7"); +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8"); +assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11"); +assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 13"); +assert.sameValue(C.y(), 43, "test 14"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16"); + +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18"); diff --git a/test/language/expressions/class/fields-multiple-stacked-definitions-static-private-methods.js b/test/language/expressions/class/fields-multiple-stacked-definitions-static-private-methods.js index 85791c2060..72f98a2383 100644 --- a/test/language/expressions/class/fields-multiple-stacked-definitions-static-private-methods.js +++ b/test/language/expressions/class/fields-multiple-stacked-definitions-static-private-methods.js @@ -25,19 +25,17 @@ info: | var C = class { - static #xVal; static #yVal + foo = "foobar" bar = "barbaz"; static #x(value) { - this.#xVal = value; - return this.#xVal; + return value / 2; } static #y(value) { - this.#y = value; - return this.#yVal; + return value * 2; } static x() { - return this.#x(42); + return this.#x(84); } static y() { return this.#y(43); @@ -69,18 +67,18 @@ verifyProperty(c, "bar", { }); // Test the private methods do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 1"); -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 2"); -assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 3"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 4"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 5"); -assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 6"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); // Test if private fields can be sucessfully accessed and set to value assert.sameValue(C.x(), 42, "test 7"); -assert.sameValue(C.y(), 43, "test 8"); +assert.sameValue(C.y(), 86, "test 8"); // Test the private fields do not appear as properties before after set to value -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 9"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); diff --git a/test/language/expressions/class/fields-new-no-sc-line-method-rs-static-async-generator-method-privatename-identifier-alt.js b/test/language/expressions/class/fields-new-no-sc-line-method-rs-static-async-generator-method-privatename-identifier-alt.js index 042ffc2567..5199118527 100644 --- a/test/language/expressions/class/fields-new-no-sc-line-method-rs-static-async-generator-method-privatename-identifier-alt.js +++ b/test/language/expressions/class/fields-new-no-sc-line-method-rs-static-async-generator-method-privatename-identifier-alt.js @@ -61,42 +61,42 @@ info: | var C = class { - static async #$(value) { + static async * #$(value) { yield await value; } - static async #_(value) { + static async * #_(value) { yield await value; } - static async #o(value) { + static async * #o(value) { yield await value; } - static async #℘(value) { + static async * #℘(value) { yield await value; } - static async #ZW_‌_NJ(value) { + static async * #ZW_‌_NJ(value) { yield await value; } - static async #ZW_‍_J(value) { + static async * #ZW_‍_J(value) { yield await value; } m() { return 42; } - static async $(value) { - yield * await this.#$(value); + static get $() { + return this.#$; } - static async _(value) { - yield * await this.#_(value); + static get _() { + return this.#_; } - static async o(value) { - yield * await this.#o(value); + static get o() { + return this.#o; } - static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/expressions/class/fields-new-no-sc-line-method-rs-static-async-generator-method-privatename-identifier.js b/test/language/expressions/class/fields-new-no-sc-line-method-rs-static-async-generator-method-privatename-identifier.js index 76a4c887ec..ddbdd56fe2 100644 --- a/test/language/expressions/class/fields-new-no-sc-line-method-rs-static-async-generator-method-privatename-identifier.js +++ b/test/language/expressions/class/fields-new-no-sc-line-method-rs-static-async-generator-method-privatename-identifier.js @@ -62,41 +62,41 @@ info: | var C = class { static async * #$(value) { - yield await value; + yield * await value; } static async * #_(value) { - yield await value; + yield * await value; } static async * #\u{6F}(value) { - yield await value; + yield * await value; } static async * #\u2118(value) { - yield await value; + yield * await value; } static async * #ZW_\u200C_NJ(value) { - yield await value; + yield * await value; } static async * #ZW_\u200D_J(value) { - yield await value; + yield * await value; } m() { return 42; } - static async * $(value) { - yield * await this.#$(value); + static async * $() { + return this.#$; } - static async * _(value) { - yield * await this.#_(value); + static async * _() { + return this.#_; } - static async * \u{6F}(value) { - yield * await this.#\u{6F}(value); + static async * \u{6F}() { + return this.#\u{6F}; } - static async * \u2118(value) { - yield * await this.#\u2118(value); + static async * \u2118() { + return this.#\u2118; } - static async * ZW_\u200C_NJ(value) { - yield * await this.#ZW_\u200C_NJ(value); + static async * ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static async * ZW_\u200D_J(value) { - yield * await this.#ZW_\u200D_J(value); + static async * ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/expressions/class/fields-new-no-sc-line-method-rs-static-generator-method-privatename-identifier-alt.js b/test/language/expressions/class/fields-new-no-sc-line-method-rs-static-generator-method-privatename-identifier-alt.js index 33950f9664..3fb1465028 100644 --- a/test/language/expressions/class/fields-new-no-sc-line-method-rs-static-generator-method-privatename-identifier-alt.js +++ b/test/language/expressions/class/fields-new-no-sc-line-method-rs-static-generator-method-privatename-identifier-alt.js @@ -62,41 +62,41 @@ info: | var C = class { static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #o(value) { - yield value; + yield * value; } static * #℘(value) { - yield value; + yield * value; } static * #ZW_‌_NJ(value) { - yield value; + yield * value; } static * #ZW_‍_J(value) { - yield value; + yield * value; } m() { return 42; } - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * o(value) { - yield this.#o(value); + static get o() { + return this.#o; } - static * ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static * ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static * ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/expressions/class/fields-new-no-sc-line-method-rs-static-generator-method-privatename-identifier.js b/test/language/expressions/class/fields-new-no-sc-line-method-rs-static-generator-method-privatename-identifier.js index ada54f0158..6f689fd462 100644 --- a/test/language/expressions/class/fields-new-no-sc-line-method-rs-static-generator-method-privatename-identifier.js +++ b/test/language/expressions/class/fields-new-no-sc-line-method-rs-static-generator-method-privatename-identifier.js @@ -62,41 +62,41 @@ info: | var C = class { static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #\u{6F}(value) { - yield value; + yield * value; } static * #\u2118(value) { - yield value; + yield * value; } static * #ZW_\u200C_NJ(value) { - yield value; + yield * value; } static * #ZW_\u200D_J(value) { - yield value; + yield * value; } m() { return 42; } - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * \u{6F}(value) { - yield this.#\u{6F}(value); + static get \u{6F}() { + return this.#\u{6F}; } - static * \u2118(value) { - yield this.#\u2118(value); + static get \u2118() { + return this.#\u2118; } - static * ZW_\u200C_NJ(value) { - yield this.#ZW_\u200C_NJ(value); + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static * ZW_\u200D_J(value) { - yield this.#ZW_\u200D_J(value); + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/expressions/class/fields-new-no-sc-line-method-static-private-methods-with-fields.js b/test/language/expressions/class/fields-new-no-sc-line-method-static-private-methods-with-fields.js new file mode 100644 index 0000000000..00856fe625 --- /dev/null +++ b/test/language/expressions/class/fields-new-no-sc-line-method-static-private-methods-with-fields.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-private-methods-with-fields.case +// - src/class-fields/productions/cls-expr-new-no-sc-line-method.template +/*--- +description: static private methods with fields (field definitions followed by a method in a new line without a semicolon) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + static #xVal; static #yVal + m() { return 42; } + static #x(value) { + this.#xVal = value; + return this.#xVal; + } + static #y(value) { + this.#yVal = value; + return this.#yVal; + } + static x() { + return this.#x(42); + } + static y() { + return this.#y(43); + } +} + +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, +}); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7"); +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8"); +assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11"); +assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 13"); +assert.sameValue(C.y(), 43, "test 14"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16"); + +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18"); diff --git a/test/language/expressions/class/fields-new-no-sc-line-method-static-private-methods.js b/test/language/expressions/class/fields-new-no-sc-line-method-static-private-methods.js index 5c41cadc9a..7c57006363 100644 --- a/test/language/expressions/class/fields-new-no-sc-line-method-static-private-methods.js +++ b/test/language/expressions/class/fields-new-no-sc-line-method-static-private-methods.js @@ -25,18 +25,16 @@ info: | var C = class { - static #xVal; static #yVal + m() { return 42; } static #x(value) { - this.#xVal = value; - return this.#xVal; + return value / 2; } static #y(value) { - this.#y = value; - return this.#yVal; + return value * 2; } static x() { - return this.#x(42); + return this.#x(84); } static y() { return this.#y(43); @@ -56,18 +54,18 @@ verifyProperty(C.prototype, "m", { }); // Test the private methods do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 1"); -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 2"); -assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 3"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 4"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 5"); -assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 6"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); // Test if private fields can be sucessfully accessed and set to value assert.sameValue(C.x(), 42, "test 7"); -assert.sameValue(C.y(), 43, "test 8"); +assert.sameValue(C.y(), 86, "test 8"); // Test the private fields do not appear as properties before after set to value -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 9"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); diff --git a/test/language/expressions/class/fields-new-sc-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js b/test/language/expressions/class/fields-new-sc-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js index c4b9e37137..2feaf8acde 100644 --- a/test/language/expressions/class/fields-new-sc-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js +++ b/test/language/expressions/class/fields-new-sc-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js @@ -61,42 +61,42 @@ info: | var C = class { - static async #$(value) { + static async * #$(value) { yield await value; } - static async #_(value) { + static async * #_(value) { yield await value; } - static async #o(value) { + static async * #o(value) { yield await value; } - static async #℘(value) { + static async * #℘(value) { yield await value; } - static async #ZW_‌_NJ(value) { + static async * #ZW_‌_NJ(value) { yield await value; } - static async #ZW_‍_J(value) { + static async * #ZW_‍_J(value) { yield await value; }; *m() { return 42; } - static async $(value) { - yield * await this.#$(value); + static get $() { + return this.#$; } - static async _(value) { - yield * await this.#_(value); + static get _() { + return this.#_; } - static async o(value) { - yield * await this.#o(value); + static get o() { + return this.#o; } - static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/expressions/class/fields-new-sc-line-gen-rs-static-async-generator-method-privatename-identifier.js b/test/language/expressions/class/fields-new-sc-line-gen-rs-static-async-generator-method-privatename-identifier.js index 941da6fcbf..fee12a971c 100644 --- a/test/language/expressions/class/fields-new-sc-line-gen-rs-static-async-generator-method-privatename-identifier.js +++ b/test/language/expressions/class/fields-new-sc-line-gen-rs-static-async-generator-method-privatename-identifier.js @@ -62,41 +62,41 @@ info: | var C = class { static async * #$(value) { - yield await value; + yield * await value; } static async * #_(value) { - yield await value; + yield * await value; } static async * #\u{6F}(value) { - yield await value; + yield * await value; } static async * #\u2118(value) { - yield await value; + yield * await value; } static async * #ZW_\u200C_NJ(value) { - yield await value; + yield * await value; } static async * #ZW_\u200D_J(value) { - yield await value; + yield * await value; }; *m() { return 42; } - static async * $(value) { - yield * await this.#$(value); + static async * $() { + return this.#$; } - static async * _(value) { - yield * await this.#_(value); + static async * _() { + return this.#_; } - static async * \u{6F}(value) { - yield * await this.#\u{6F}(value); + static async * \u{6F}() { + return this.#\u{6F}; } - static async * \u2118(value) { - yield * await this.#\u2118(value); + static async * \u2118() { + return this.#\u2118; } - static async * ZW_\u200C_NJ(value) { - yield * await this.#ZW_\u200C_NJ(value); + static async * ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static async * ZW_\u200D_J(value) { - yield * await this.#ZW_\u200D_J(value); + static async * ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/expressions/class/fields-new-sc-line-gen-rs-static-generator-method-privatename-identifier-alt.js b/test/language/expressions/class/fields-new-sc-line-gen-rs-static-generator-method-privatename-identifier-alt.js index d7a6c8ef22..5de6b1771b 100644 --- a/test/language/expressions/class/fields-new-sc-line-gen-rs-static-generator-method-privatename-identifier-alt.js +++ b/test/language/expressions/class/fields-new-sc-line-gen-rs-static-generator-method-privatename-identifier-alt.js @@ -62,41 +62,41 @@ info: | var C = class { static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #o(value) { - yield value; + yield * value; } static * #℘(value) { - yield value; + yield * value; } static * #ZW_‌_NJ(value) { - yield value; + yield * value; } static * #ZW_‍_J(value) { - yield value; + yield * value; }; *m() { return 42; } - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * o(value) { - yield this.#o(value); + static get o() { + return this.#o; } - static * ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static * ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static * ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/expressions/class/fields-new-sc-line-gen-rs-static-generator-method-privatename-identifier.js b/test/language/expressions/class/fields-new-sc-line-gen-rs-static-generator-method-privatename-identifier.js index 154156c8e6..4829ffee53 100644 --- a/test/language/expressions/class/fields-new-sc-line-gen-rs-static-generator-method-privatename-identifier.js +++ b/test/language/expressions/class/fields-new-sc-line-gen-rs-static-generator-method-privatename-identifier.js @@ -62,41 +62,41 @@ info: | var C = class { static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #\u{6F}(value) { - yield value; + yield * value; } static * #\u2118(value) { - yield value; + yield * value; } static * #ZW_\u200C_NJ(value) { - yield value; + yield * value; } static * #ZW_\u200D_J(value) { - yield value; + yield * value; }; *m() { return 42; } - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * \u{6F}(value) { - yield this.#\u{6F}(value); + static get \u{6F}() { + return this.#\u{6F}; } - static * \u2118(value) { - yield this.#\u2118(value); + static get \u2118() { + return this.#\u2118; } - static * ZW_\u200C_NJ(value) { - yield this.#ZW_\u200C_NJ(value); + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static * ZW_\u200D_J(value) { - yield this.#ZW_\u200D_J(value); + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/expressions/class/fields-new-sc-line-gen-static-private-methods-with-fields.js b/test/language/expressions/class/fields-new-sc-line-gen-static-private-methods-with-fields.js new file mode 100644 index 0000000000..d6ec72256e --- /dev/null +++ b/test/language/expressions/class/fields-new-sc-line-gen-static-private-methods-with-fields.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-private-methods-with-fields.case +// - src/class-fields/productions/cls-expr-new-sc-line-generator.template +/*--- +description: static private methods with fields (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public, + generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + static #xVal; static #yVal; + *m() { return 42; } + static #x(value) { + this.#xVal = value; + return this.#xVal; + } + static #y(value) { + this.#yVal = value; + return this.#yVal; + } + static x() { + return this.#x(42); + } + static y() { + return this.#y(43); + } +} + +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, +}); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7"); +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8"); +assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11"); +assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 13"); +assert.sameValue(C.y(), 43, "test 14"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16"); + +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18"); diff --git a/test/language/expressions/class/fields-new-sc-line-gen-static-private-methods.js b/test/language/expressions/class/fields-new-sc-line-gen-static-private-methods.js index 525cb72141..42dfb674ce 100644 --- a/test/language/expressions/class/fields-new-sc-line-gen-static-private-methods.js +++ b/test/language/expressions/class/fields-new-sc-line-gen-static-private-methods.js @@ -25,18 +25,16 @@ info: | var C = class { - static #xVal; static #yVal; + ; *m() { return 42; } static #x(value) { - this.#xVal = value; - return this.#xVal; + return value / 2; } static #y(value) { - this.#y = value; - return this.#yVal; + return value * 2; } static x() { - return this.#x(42); + return this.#x(84); } static y() { return this.#y(43); @@ -56,18 +54,18 @@ verifyProperty(C.prototype, "m", { }); // Test the private methods do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 1"); -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 2"); -assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 3"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 4"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 5"); -assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 6"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); // Test if private fields can be sucessfully accessed and set to value assert.sameValue(C.x(), 42, "test 7"); -assert.sameValue(C.y(), 43, "test 8"); +assert.sameValue(C.y(), 86, "test 8"); // Test the private fields do not appear as properties before after set to value -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 9"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); diff --git a/test/language/expressions/class/fields-new-sc-line-method-rs-static-async-generator-method-privatename-identifier-alt.js b/test/language/expressions/class/fields-new-sc-line-method-rs-static-async-generator-method-privatename-identifier-alt.js index 89265d3fc2..3da00f169a 100644 --- a/test/language/expressions/class/fields-new-sc-line-method-rs-static-async-generator-method-privatename-identifier-alt.js +++ b/test/language/expressions/class/fields-new-sc-line-method-rs-static-async-generator-method-privatename-identifier-alt.js @@ -61,42 +61,42 @@ info: | var C = class { - static async #$(value) { + static async * #$(value) { yield await value; } - static async #_(value) { + static async * #_(value) { yield await value; } - static async #o(value) { + static async * #o(value) { yield await value; } - static async #℘(value) { + static async * #℘(value) { yield await value; } - static async #ZW_‌_NJ(value) { + static async * #ZW_‌_NJ(value) { yield await value; } - static async #ZW_‍_J(value) { + static async * #ZW_‍_J(value) { yield await value; }; m() { return 42; } - static async $(value) { - yield * await this.#$(value); + static get $() { + return this.#$; } - static async _(value) { - yield * await this.#_(value); + static get _() { + return this.#_; } - static async o(value) { - yield * await this.#o(value); + static get o() { + return this.#o; } - static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/expressions/class/fields-new-sc-line-method-rs-static-async-generator-method-privatename-identifier.js b/test/language/expressions/class/fields-new-sc-line-method-rs-static-async-generator-method-privatename-identifier.js index 616f3a3f7a..4566198a9d 100644 --- a/test/language/expressions/class/fields-new-sc-line-method-rs-static-async-generator-method-privatename-identifier.js +++ b/test/language/expressions/class/fields-new-sc-line-method-rs-static-async-generator-method-privatename-identifier.js @@ -62,41 +62,41 @@ info: | var C = class { static async * #$(value) { - yield await value; + yield * await value; } static async * #_(value) { - yield await value; + yield * await value; } static async * #\u{6F}(value) { - yield await value; + yield * await value; } static async * #\u2118(value) { - yield await value; + yield * await value; } static async * #ZW_\u200C_NJ(value) { - yield await value; + yield * await value; } static async * #ZW_\u200D_J(value) { - yield await value; + yield * await value; }; m() { return 42; } - static async * $(value) { - yield * await this.#$(value); + static async * $() { + return this.#$; } - static async * _(value) { - yield * await this.#_(value); + static async * _() { + return this.#_; } - static async * \u{6F}(value) { - yield * await this.#\u{6F}(value); + static async * \u{6F}() { + return this.#\u{6F}; } - static async * \u2118(value) { - yield * await this.#\u2118(value); + static async * \u2118() { + return this.#\u2118; } - static async * ZW_\u200C_NJ(value) { - yield * await this.#ZW_\u200C_NJ(value); + static async * ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static async * ZW_\u200D_J(value) { - yield * await this.#ZW_\u200D_J(value); + static async * ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/expressions/class/fields-new-sc-line-method-rs-static-generator-method-privatename-identifier-alt.js b/test/language/expressions/class/fields-new-sc-line-method-rs-static-generator-method-privatename-identifier-alt.js index d3ec9ff36e..dd76e7f092 100644 --- a/test/language/expressions/class/fields-new-sc-line-method-rs-static-generator-method-privatename-identifier-alt.js +++ b/test/language/expressions/class/fields-new-sc-line-method-rs-static-generator-method-privatename-identifier-alt.js @@ -62,41 +62,41 @@ info: | var C = class { static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #o(value) { - yield value; + yield * value; } static * #℘(value) { - yield value; + yield * value; } static * #ZW_‌_NJ(value) { - yield value; + yield * value; } static * #ZW_‍_J(value) { - yield value; + yield * value; }; m() { return 42; } - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * o(value) { - yield this.#o(value); + static get o() { + return this.#o; } - static * ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static * ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static * ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/expressions/class/fields-new-sc-line-method-rs-static-generator-method-privatename-identifier.js b/test/language/expressions/class/fields-new-sc-line-method-rs-static-generator-method-privatename-identifier.js index ad929a09c7..21dd9fda45 100644 --- a/test/language/expressions/class/fields-new-sc-line-method-rs-static-generator-method-privatename-identifier.js +++ b/test/language/expressions/class/fields-new-sc-line-method-rs-static-generator-method-privatename-identifier.js @@ -62,41 +62,41 @@ info: | var C = class { static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #\u{6F}(value) { - yield value; + yield * value; } static * #\u2118(value) { - yield value; + yield * value; } static * #ZW_\u200C_NJ(value) { - yield value; + yield * value; } static * #ZW_\u200D_J(value) { - yield value; + yield * value; }; m() { return 42; } - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * \u{6F}(value) { - yield this.#\u{6F}(value); + static get \u{6F}() { + return this.#\u{6F}; } - static * \u2118(value) { - yield this.#\u2118(value); + static get \u2118() { + return this.#\u2118; } - static * ZW_\u200C_NJ(value) { - yield this.#ZW_\u200C_NJ(value); + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static * ZW_\u200D_J(value) { - yield this.#ZW_\u200D_J(value); + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/expressions/class/fields-new-sc-line-method-static-private-methods-with-fields.js b/test/language/expressions/class/fields-new-sc-line-method-static-private-methods-with-fields.js new file mode 100644 index 0000000000..0e2c4a2976 --- /dev/null +++ b/test/language/expressions/class/fields-new-sc-line-method-static-private-methods-with-fields.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-private-methods-with-fields.case +// - src/class-fields/productions/cls-expr-new-sc-line-method.template +/*--- +description: static private methods with fields (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + static #xVal; static #yVal; + m() { return 42; } + static #x(value) { + this.#xVal = value; + return this.#xVal; + } + static #y(value) { + this.#yVal = value; + return this.#yVal; + } + static x() { + return this.#x(42); + } + static y() { + return this.#y(43); + } +} + +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, +}); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7"); +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8"); +assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11"); +assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 13"); +assert.sameValue(C.y(), 43, "test 14"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16"); + +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18"); diff --git a/test/language/expressions/class/fields-new-sc-line-method-static-private-methods.js b/test/language/expressions/class/fields-new-sc-line-method-static-private-methods.js index 4074913bf3..6352a38fbf 100644 --- a/test/language/expressions/class/fields-new-sc-line-method-static-private-methods.js +++ b/test/language/expressions/class/fields-new-sc-line-method-static-private-methods.js @@ -25,18 +25,16 @@ info: | var C = class { - static #xVal; static #yVal; + ; m() { return 42; } static #x(value) { - this.#xVal = value; - return this.#xVal; + return value / 2; } static #y(value) { - this.#y = value; - return this.#yVal; + return value * 2; } static x() { - return this.#x(42); + return this.#x(84); } static y() { return this.#y(43); @@ -56,18 +54,18 @@ verifyProperty(C.prototype, "m", { }); // Test the private methods do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 1"); -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 2"); -assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 3"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 4"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 5"); -assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 6"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); // Test if private fields can be sucessfully accessed and set to value assert.sameValue(C.x(), 42, "test 7"); -assert.sameValue(C.y(), 43, "test 8"); +assert.sameValue(C.y(), 86, "test 8"); // Test the private fields do not appear as properties before after set to value -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 9"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); diff --git a/test/language/expressions/class/fields-regular-definitions-rs-static-async-generator-method-privatename-identifier-alt.js b/test/language/expressions/class/fields-regular-definitions-rs-static-async-generator-method-privatename-identifier-alt.js index d656a76097..eb3667958e 100644 --- a/test/language/expressions/class/fields-regular-definitions-rs-static-async-generator-method-privatename-identifier-alt.js +++ b/test/language/expressions/class/fields-regular-definitions-rs-static-async-generator-method-privatename-identifier-alt.js @@ -60,41 +60,41 @@ info: | var C = class { - static async #$(value) { + static async * #$(value) { yield await value; } - static async #_(value) { + static async * #_(value) { yield await value; } - static async #o(value) { + static async * #o(value) { yield await value; } - static async #℘(value) { + static async * #℘(value) { yield await value; } - static async #ZW_‌_NJ(value) { + static async * #ZW_‌_NJ(value) { yield await value; } - static async #ZW_‍_J(value) { + static async * #ZW_‍_J(value) { yield await value; } - static async $(value) { - yield * await this.#$(value); + static get $() { + return this.#$; } - static async _(value) { - yield * await this.#_(value); + static get _() { + return this.#_; } - static async o(value) { - yield * await this.#o(value); + static get o() { + return this.#o; } - static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/expressions/class/fields-regular-definitions-rs-static-async-generator-method-privatename-identifier.js b/test/language/expressions/class/fields-regular-definitions-rs-static-async-generator-method-privatename-identifier.js index 6ee58c844c..6ed93f3153 100644 --- a/test/language/expressions/class/fields-regular-definitions-rs-static-async-generator-method-privatename-identifier.js +++ b/test/language/expressions/class/fields-regular-definitions-rs-static-async-generator-method-privatename-identifier.js @@ -61,40 +61,40 @@ info: | var C = class { static async * #$(value) { - yield await value; + yield * await value; } static async * #_(value) { - yield await value; + yield * await value; } static async * #\u{6F}(value) { - yield await value; + yield * await value; } static async * #\u2118(value) { - yield await value; + yield * await value; } static async * #ZW_\u200C_NJ(value) { - yield await value; + yield * await value; } static async * #ZW_\u200D_J(value) { - yield await value; + yield * await value; } - static async * $(value) { - yield * await this.#$(value); + static async * $() { + return this.#$; } - static async * _(value) { - yield * await this.#_(value); + static async * _() { + return this.#_; } - static async * \u{6F}(value) { - yield * await this.#\u{6F}(value); + static async * \u{6F}() { + return this.#\u{6F}; } - static async * \u2118(value) { - yield * await this.#\u2118(value); + static async * \u2118() { + return this.#\u2118; } - static async * ZW_\u200C_NJ(value) { - yield * await this.#ZW_\u200C_NJ(value); + static async * ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static async * ZW_\u200D_J(value) { - yield * await this.#ZW_\u200D_J(value); + static async * ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/expressions/class/fields-regular-definitions-rs-static-generator-method-privatename-identifier-alt.js b/test/language/expressions/class/fields-regular-definitions-rs-static-generator-method-privatename-identifier-alt.js index 6dc6cf0c17..cd41048da9 100644 --- a/test/language/expressions/class/fields-regular-definitions-rs-static-generator-method-privatename-identifier-alt.js +++ b/test/language/expressions/class/fields-regular-definitions-rs-static-generator-method-privatename-identifier-alt.js @@ -61,40 +61,40 @@ info: | var C = class { static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #o(value) { - yield value; + yield * value; } static * #℘(value) { - yield value; + yield * value; } static * #ZW_‌_NJ(value) { - yield value; + yield * value; } static * #ZW_‍_J(value) { - yield value; + yield * value; } - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * o(value) { - yield this.#o(value); + static get o() { + return this.#o; } - static * ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static * ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static * ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/expressions/class/fields-regular-definitions-rs-static-generator-method-privatename-identifier.js b/test/language/expressions/class/fields-regular-definitions-rs-static-generator-method-privatename-identifier.js index d5a380ed39..0c8c0ef053 100644 --- a/test/language/expressions/class/fields-regular-definitions-rs-static-generator-method-privatename-identifier.js +++ b/test/language/expressions/class/fields-regular-definitions-rs-static-generator-method-privatename-identifier.js @@ -61,40 +61,40 @@ info: | var C = class { static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #\u{6F}(value) { - yield value; + yield * value; } static * #\u2118(value) { - yield value; + yield * value; } static * #ZW_\u200C_NJ(value) { - yield value; + yield * value; } static * #ZW_\u200D_J(value) { - yield value; + yield * value; } - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * \u{6F}(value) { - yield this.#\u{6F}(value); + static get \u{6F}() { + return this.#\u{6F}; } - static * \u2118(value) { - yield this.#\u2118(value); + static get \u2118() { + return this.#\u2118; } - static * ZW_\u200C_NJ(value) { - yield this.#ZW_\u200C_NJ(value); + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static * ZW_\u200D_J(value) { - yield this.#ZW_\u200D_J(value); + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/expressions/class/fields-regular-definitions-static-private-methods-with-fields.js b/test/language/expressions/class/fields-regular-definitions-static-private-methods-with-fields.js new file mode 100644 index 0000000000..5014d5a16c --- /dev/null +++ b/test/language/expressions/class/fields-regular-definitions-static-private-methods-with-fields.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-private-methods-with-fields.case +// - src/class-fields/productions/cls-expr-regular-definitions.template +/*--- +description: static private methods with fields (regular fields defintion) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + static #xVal; static #yVal + static #x(value) { + this.#xVal = value; + return this.#xVal; + } + static #y(value) { + this.#yVal = value; + return this.#yVal; + } + static x() { + return this.#x(42); + } + static y() { + return this.#y(43); + } +} + +var c = new C(); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7"); +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8"); +assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11"); +assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 13"); +assert.sameValue(C.y(), 43, "test 14"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16"); + +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18"); diff --git a/test/language/expressions/class/fields-regular-definitions-static-private-methods.js b/test/language/expressions/class/fields-regular-definitions-static-private-methods.js index e1ef400f13..6e8a5312b9 100644 --- a/test/language/expressions/class/fields-regular-definitions-static-private-methods.js +++ b/test/language/expressions/class/fields-regular-definitions-static-private-methods.js @@ -24,17 +24,15 @@ info: | var C = class { - static #xVal; static #yVal + static #x(value) { - this.#xVal = value; - return this.#xVal; + return value / 2; } static #y(value) { - this.#y = value; - return this.#yVal; + return value * 2; } static x() { - return this.#x(42); + return this.#x(84); } static y() { return this.#y(43); @@ -44,18 +42,18 @@ var C = class { var c = new C(); // Test the private methods do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 1"); -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 2"); -assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 3"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 4"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 5"); -assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 6"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); // Test if private fields can be sucessfully accessed and set to value assert.sameValue(C.x(), 42, "test 7"); -assert.sameValue(C.y(), 43, "test 8"); +assert.sameValue(C.y(), 86, "test 8"); // Test the private fields do not appear as properties before after set to value -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 9"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); 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 index 7f8d920fec..348fbf9798 100644 --- 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 @@ -39,41 +39,51 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: 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: undefined, - enumerable: true, - writable: true, - configurable: 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, "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: undefined, + 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-gen-computed-symbol-names.js b/test/language/expressions/class/fields-same-line-async-gen-computed-symbol-names.js index a8d955ec20..dcbd8b973f 100644 --- 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 @@ -40,35 +40,45 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: 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.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, 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); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-gen-grammar-privatename-identifier-semantics-stringvalue.js b/test/language/expressions/class/fields-same-line-async-gen-grammar-privatename-identifier-semantics-stringvalue.js index b748989fa0..0545679928 100644 --- a/test/language/expressions/class/fields-same-line-async-gen-grammar-privatename-identifier-semantics-stringvalue.js +++ b/test/language/expressions/class/fields-same-line-async-gen-grammar-privatename-identifier-semantics-stringvalue.js @@ -98,12 +98,22 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(c.o(1), 1); -assert.sameValue(c.℘(1), 1); -assert.sameValue(c.ZW_‌_NJ(1), 1); -assert.sameValue(c.ZW_‍_J(1), 1); - 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(c.o(1), 1); + assert.sameValue(c.℘(1), 1); + assert.sameValue(c.ZW_‌_NJ(1), 1); + assert.sameValue(c.ZW_‍_J(1), 1); + } + + return Promise.resolve(assertions()); }, $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 index 861efccce1..8e727897ac 100644 --- 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 @@ -40,38 +40,48 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: 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.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 + }); + + 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 + }); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-gen-private-names.js b/test/language/expressions/class/fields-same-line-async-gen-private-names.js index 05ddab3fe4..dc2c8f8f7c 100644 --- a/test/language/expressions/class/fields-same-line-async-gen-private-names.js +++ b/test/language/expressions/class/fields-same-line-async-gen-private-names.js @@ -47,24 +47,34 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -// Test the private fields do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); -assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); -assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); - -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); -assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); -assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); - -// Test if private fields can be sucessfully accessed and set to value -assert.sameValue(c.x(), 42, "test 7"); -assert.sameValue(c.y(), 43, "test 8"); - -// Test the private fields do not appear as properties before after set to value -assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 9"); -assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 10"); - 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') + } + } + // Test the private fields do not appear as properties before set to value + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + + // Test if private fields can be sucessfully accessed and set to value + assert.sameValue(c.x(), 42, "test 7"); + assert.sameValue(c.y(), 43, "test 8"); + + // Test the private fields do not appear as properties before after set to value + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 9"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 10"); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-gen-rs-field-identifier-initializer.js b/test/language/expressions/class/fields-same-line-async-gen-rs-field-identifier-initializer.js index 19577f96c5..481ae0f9e4 100644 --- a/test/language/expressions/class/fields-same-line-async-gen-rs-field-identifier-initializer.js +++ b/test/language/expressions/class/fields-same-line-async-gen-rs-field-identifier-initializer.js @@ -74,14 +74,24 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(c.$, 1); -assert.sameValue(c._, 1); -assert.sameValue(c.\u{6F}, 1); -assert.sameValue(c.\u2118, 1); -assert.sameValue(c.ZW_\u200C_NJ, 1); -assert.sameValue(c.ZW_\u200D_J, 1); - 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(c.$, 1); + assert.sameValue(c._, 1); + assert.sameValue(c.\u{6F}, 1); + assert.sameValue(c.\u2118, 1); + assert.sameValue(c.ZW_\u200C_NJ, 1); + assert.sameValue(c.ZW_\u200D_J, 1); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-gen-rs-field-identifier.js b/test/language/expressions/class/fields-same-line-async-gen-rs-field-identifier.js index 998d5833e2..0d541830d8 100644 --- a/test/language/expressions/class/fields-same-line-async-gen-rs-field-identifier.js +++ b/test/language/expressions/class/fields-same-line-async-gen-rs-field-identifier.js @@ -74,21 +74,31 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -c.$ = 1; -c._ = 1; -c.\u{6F} = 1; -c.\u2118 = 1; -c.ZW_\u200C_NJ = 1; -c.ZW_\u200D_J = 1; - -assert.sameValue(c.$, 1); -assert.sameValue(c._, 1); -assert.sameValue(c.\u{6F}, 1); -assert.sameValue(c.\u2118, 1); -assert.sameValue(c.ZW_\u200C_NJ, 1); -assert.sameValue(c.ZW_\u200D_J, 1); - 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') + } + } + c.$ = 1; + c._ = 1; + c.\u{6F} = 1; + c.\u2118 = 1; + c.ZW_\u200C_NJ = 1; + c.ZW_\u200D_J = 1; + + assert.sameValue(c.$, 1); + assert.sameValue(c._, 1); + assert.sameValue(c.\u{6F}, 1); + assert.sameValue(c.\u2118, 1); + assert.sameValue(c.ZW_\u200C_NJ, 1); + assert.sameValue(c.ZW_\u200D_J, 1); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-gen-rs-privatename-identifier-alt.js b/test/language/expressions/class/fields-same-line-async-gen-rs-privatename-identifier-alt.js index 7c5a1ade62..51a25b6add 100644 --- a/test/language/expressions/class/fields-same-line-async-gen-rs-privatename-identifier-alt.js +++ b/test/language/expressions/class/fields-same-line-async-gen-rs-privatename-identifier-alt.js @@ -95,15 +95,25 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(c.$(1), 1); -assert.sameValue(c._(1), 1); -assert.sameValue(c.\u{6F}(1), 1); -assert.sameValue(c.℘(1), 1); -assert.sameValue(c.ZW_‌_NJ(1), 1); -assert.sameValue(c.ZW_‍_J(1), 1); - - 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(c.$(1), 1); + assert.sameValue(c._(1), 1); + assert.sameValue(c.\u{6F}(1), 1); + assert.sameValue(c.℘(1), 1); + assert.sameValue(c.ZW_‌_NJ(1), 1); + assert.sameValue(c.ZW_‍_J(1), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-gen-rs-privatename-identifier-initializer-alt.js b/test/language/expressions/class/fields-same-line-async-gen-rs-privatename-identifier-initializer-alt.js index 0414c25392..846a3ebf41 100644 --- a/test/language/expressions/class/fields-same-line-async-gen-rs-privatename-identifier-initializer-alt.js +++ b/test/language/expressions/class/fields-same-line-async-gen-rs-privatename-identifier-initializer-alt.js @@ -89,15 +89,25 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(c.$(), 1); -assert.sameValue(c._(), 1); -assert.sameValue(c.\u{6F}(), 1); -assert.sameValue(c.℘(), 1); -assert.sameValue(c.ZW_‌_NJ(), 1); -assert.sameValue(c.ZW_‍_J(), 1); - - 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(c.$(), 1); + assert.sameValue(c._(), 1); + assert.sameValue(c.\u{6F}(), 1); + assert.sameValue(c.℘(), 1); + assert.sameValue(c.ZW_‌_NJ(), 1); + assert.sameValue(c.ZW_‍_J(), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-gen-rs-privatename-identifier-initializer.js b/test/language/expressions/class/fields-same-line-async-gen-rs-privatename-identifier-initializer.js index 26e2bbeb28..742906c892 100644 --- a/test/language/expressions/class/fields-same-line-async-gen-rs-privatename-identifier-initializer.js +++ b/test/language/expressions/class/fields-same-line-async-gen-rs-privatename-identifier-initializer.js @@ -89,15 +89,25 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(c.$(), 1); -assert.sameValue(c._(), 1); -assert.sameValue(c.\u{6F}(), 1); -assert.sameValue(c.\u2118(), 1); -assert.sameValue(c.ZW_\u200C_NJ(), 1); -assert.sameValue(c.ZW_\u200D_J(), 1); - - 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(c.$(), 1); + assert.sameValue(c._(), 1); + assert.sameValue(c.\u{6F}(), 1); + assert.sameValue(c.\u2118(), 1); + assert.sameValue(c.ZW_\u200C_NJ(), 1); + assert.sameValue(c.ZW_\u200D_J(), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-gen-rs-privatename-identifier.js b/test/language/expressions/class/fields-same-line-async-gen-rs-privatename-identifier.js index db34f0e027..16deb05d5c 100644 --- a/test/language/expressions/class/fields-same-line-async-gen-rs-privatename-identifier.js +++ b/test/language/expressions/class/fields-same-line-async-gen-rs-privatename-identifier.js @@ -95,15 +95,25 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(c.$(1), 1); -assert.sameValue(c._(1), 1); -assert.sameValue(c.\u{6F}(1), 1); -assert.sameValue(c.\u2118(1), 1); -assert.sameValue(c.ZW_\u200C_NJ(1), 1); -assert.sameValue(c.ZW_\u200D_J(1), 1); - - 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(c.$(1), 1); + assert.sameValue(c._(1), 1); + assert.sameValue(c.\u{6F}(1), 1); + assert.sameValue(c.\u2118(1), 1); + assert.sameValue(c.ZW_\u200C_NJ(1), 1); + assert.sameValue(c.ZW_\u200D_J(1), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-gen-rs-static-async-generator-method-privatename-identifier-alt.js b/test/language/expressions/class/fields-same-line-async-gen-rs-static-async-generator-method-privatename-identifier-alt.js index 60267b241e..5858b16d65 100644 --- a/test/language/expressions/class/fields-same-line-async-gen-rs-static-async-generator-method-privatename-identifier-alt.js +++ b/test/language/expressions/class/fields-same-line-async-gen-rs-static-async-generator-method-privatename-identifier-alt.js @@ -61,41 +61,41 @@ info: | var C = class { - async *m() { return 42; } static async #$(value) { + async *m() { return 42; } static async * #$(value) { yield await value; } - static async #_(value) { + static async * #_(value) { yield await value; } - static async #o(value) { + static async * #o(value) { yield await value; } - static async #℘(value) { + static async * #℘(value) { yield await value; } - static async #ZW_‌_NJ(value) { + static async * #ZW_‌_NJ(value) { yield await value; } - static async #ZW_‍_J(value) { + static async * #ZW_‍_J(value) { yield await value; }; - static async $(value) { - yield * await this.#$(value); + static get $() { + return this.#$; } - static async _(value) { - yield * await this.#_(value); + static get _() { + return this.#_; } - static async o(value) { - yield * await this.#o(value); + static get o() { + return this.#o; } - static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } @@ -111,25 +111,35 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -Promise.all([ - C.$(1).next(), - C._(1).next(), - C.o(1).next(), - C.℘(1).next(), // DO NOT CHANGE THE NAME OF THIS FIELD - C.ZW_‌_NJ(1).next(), // DO NOT CHANGE THE NAME OF THIS FIELD - C.ZW_‍_J(1).next(), // DO NOT CHANGE THE NAME OF THIS FIELD -]).then(results => { - - assert.sameValue(results[0].value, 1); - assert.sameValue(results[1].value, 1); - assert.sameValue(results[2].value, 1); - assert.sameValue(results[3].value, 1); - assert.sameValue(results[4].value, 1); - assert.sameValue(results[5].value, 1); - -}, $DONE).then($DONE, $DONE); - 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') + } + } + Promise.all([ + C.$(1).next(), + C._(1).next(), + C.o(1).next(), + C.℘(1).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‌_NJ(1).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‍_J(1).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + ]).then(results => { + + assert.sameValue(results[0].value, 1); + assert.sameValue(results[1].value, 1); + assert.sameValue(results[2].value, 1); + assert.sameValue(results[3].value, 1); + assert.sameValue(results[4].value, 1); + assert.sameValue(results[5].value, 1); + + }, $DONE).then($DONE, $DONE); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-gen-rs-static-async-generator-method-privatename-identifier.js b/test/language/expressions/class/fields-same-line-async-gen-rs-static-async-generator-method-privatename-identifier.js index f43c71c90b..b15158abc9 100644 --- a/test/language/expressions/class/fields-same-line-async-gen-rs-static-async-generator-method-privatename-identifier.js +++ b/test/language/expressions/class/fields-same-line-async-gen-rs-static-async-generator-method-privatename-identifier.js @@ -62,40 +62,40 @@ info: | var C = class { async *m() { return 42; } static async * #$(value) { - yield await value; + yield * await value; } static async * #_(value) { - yield await value; + yield * await value; } static async * #\u{6F}(value) { - yield await value; + yield * await value; } static async * #\u2118(value) { - yield await value; + yield * await value; } static async * #ZW_\u200C_NJ(value) { - yield await value; + yield * await value; } static async * #ZW_\u200D_J(value) { - yield await value; + yield * await value; }; - static async * $(value) { - yield * await this.#$(value); + static async * $() { + return this.#$; } - static async * _(value) { - yield * await this.#_(value); + static async * _() { + return this.#_; } - static async * \u{6F}(value) { - yield * await this.#\u{6F}(value); + static async * \u{6F}() { + return this.#\u{6F}; } - static async * \u2118(value) { - yield * await this.#\u2118(value); + static async * \u2118() { + return this.#\u2118; } - static async * ZW_\u200C_NJ(value) { - yield * await this.#ZW_\u200C_NJ(value); + static async * ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static async * ZW_\u200D_J(value) { - yield * await this.#ZW_\u200D_J(value); + static async * ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } @@ -111,26 +111,36 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -Promise.all([ - C.$(1).next(), - C._(1).next(), - C.\u{6F}(1).next(), - C.\u2118(1).next(), - C.ZW_\u200C_NJ(1).next(), - C.ZW_\u200D_J(1).next(), -]).then(results => { - - assert.sameValue(results[0].value, 1); - assert.sameValue(results[1].value, 1); - assert.sameValue(results[2].value, 1); - assert.sameValue(results[3].value, 1); - assert.sameValue(results[4].value, 1); - assert.sameValue(results[5].value, 1); - -}, $DONE).then($DONE, $DONE); - - 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') + } + } + Promise.all([ + C.$(1).next(), + C._(1).next(), + C.\u{6F}(1).next(), + C.\u2118(1).next(), + C.ZW_\u200C_NJ(1).next(), + C.ZW_\u200D_J(1).next(), + ]).then(results => { + + assert.sameValue(results[0].value, 1); + assert.sameValue(results[1].value, 1); + assert.sameValue(results[2].value, 1); + assert.sameValue(results[3].value, 1); + assert.sameValue(results[4].value, 1); + assert.sameValue(results[5].value, 1); + + }, $DONE).then($DONE, $DONE); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-gen-rs-static-async-method-privatename-identifier-alt.js b/test/language/expressions/class/fields-same-line-async-gen-rs-static-async-method-privatename-identifier-alt.js index c49fe30888..360aedabc3 100644 --- a/test/language/expressions/class/fields-same-line-async-gen-rs-static-async-method-privatename-identifier-alt.js +++ b/test/language/expressions/class/fields-same-line-async-gen-rs-static-async-method-privatename-identifier-alt.js @@ -111,25 +111,35 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -Promise.all([ - C.$(1), - C._(1), - C.o(1), - C.℘(1), // DO NOT CHANGE THE NAME OF THIS FIELD - C.ZW_‌_NJ(1), // DO NOT CHANGE THE NAME OF THIS FIELD - C.ZW_‍_J(1), // DO NOT CHANGE THE NAME OF THIS FIELD -]).then(results => { - - assert.sameValue(results[0], 1); - assert.sameValue(results[1], 1); - assert.sameValue(results[2], 1); - assert.sameValue(results[3], 1); - assert.sameValue(results[4], 1); - assert.sameValue(results[5], 1); - -}, $DONE).then($DONE, $DONE); - 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') + } + } + Promise.all([ + C.$(1), + C._(1), + C.o(1), + C.℘(1), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‌_NJ(1), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‍_J(1), // DO NOT CHANGE THE NAME OF THIS FIELD + ]).then(results => { + + assert.sameValue(results[0], 1); + assert.sameValue(results[1], 1); + assert.sameValue(results[2], 1); + assert.sameValue(results[3], 1); + assert.sameValue(results[4], 1); + assert.sameValue(results[5], 1); + + }, $DONE).then($DONE, $DONE); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-gen-rs-static-async-method-privatename-identifier.js b/test/language/expressions/class/fields-same-line-async-gen-rs-static-async-method-privatename-identifier.js index 5a04dc9dd4..df4afec816 100644 --- a/test/language/expressions/class/fields-same-line-async-gen-rs-static-async-method-privatename-identifier.js +++ b/test/language/expressions/class/fields-same-line-async-gen-rs-static-async-method-privatename-identifier.js @@ -111,26 +111,36 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -Promise.all([ - C.$(1), - C._(1), - C.\u{6F}(1), - C.\u2118(1), - C.ZW_\u200C_NJ(1), - C.ZW_\u200D_J(1), -]).then(results => { - - assert.sameValue(results[0], 1); - assert.sameValue(results[1], 1); - assert.sameValue(results[2], 1); - assert.sameValue(results[3], 1); - assert.sameValue(results[4], 1); - assert.sameValue(results[5], 1); - -}, $DONE).then($DONE, $DONE); - - 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') + } + } + Promise.all([ + C.$(1), + C._(1), + C.\u{6F}(1), + C.\u2118(1), + C.ZW_\u200C_NJ(1), + C.ZW_\u200D_J(1), + ]).then(results => { + + assert.sameValue(results[0], 1); + assert.sameValue(results[1], 1); + assert.sameValue(results[2], 1); + assert.sameValue(results[3], 1); + assert.sameValue(results[4], 1); + assert.sameValue(results[5], 1); + + }, $DONE).then($DONE, $DONE); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-gen-rs-static-generator-method-privatename-identifier-alt.js b/test/language/expressions/class/fields-same-line-async-gen-rs-static-generator-method-privatename-identifier-alt.js index a2735fc801..0d367c08f1 100644 --- a/test/language/expressions/class/fields-same-line-async-gen-rs-static-generator-method-privatename-identifier-alt.js +++ b/test/language/expressions/class/fields-same-line-async-gen-rs-static-generator-method-privatename-identifier-alt.js @@ -62,40 +62,40 @@ info: | var C = class { async *m() { return 42; } static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #o(value) { - yield value; + yield * value; } static * #℘(value) { - yield value; + yield * value; } static * #ZW_‌_NJ(value) { - yield value; + yield * value; } static * #ZW_‍_J(value) { - yield value; + yield * value; }; - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * o(value) { - yield this.#o(value); + static get o() { + return this.#o; } - static * ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static * ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static * ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } @@ -111,14 +111,24 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1).next().value, 1); -assert.sameValue(C._(1).next().value, 1); -assert.sameValue(C.o(1).next().value, 1); -assert.sameValue(C.℘(1).next().value, 1); -assert.sameValue(C.ZW_‌_NJ(1).next().value, 1); -assert.sameValue(C.ZW_‍_J(1).next().value, 1); - 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(C.$(1).next().value, 1); + assert.sameValue(C._(1).next().value, 1); + assert.sameValue(C.o(1).next().value, 1); + assert.sameValue(C.℘(1).next().value, 1); + assert.sameValue(C.ZW_‌_NJ(1).next().value, 1); + assert.sameValue(C.ZW_‍_J(1).next().value, 1); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-gen-rs-static-generator-method-privatename-identifier.js b/test/language/expressions/class/fields-same-line-async-gen-rs-static-generator-method-privatename-identifier.js index 3d4332e3cb..00758cd361 100644 --- a/test/language/expressions/class/fields-same-line-async-gen-rs-static-generator-method-privatename-identifier.js +++ b/test/language/expressions/class/fields-same-line-async-gen-rs-static-generator-method-privatename-identifier.js @@ -62,40 +62,40 @@ info: | var C = class { async *m() { return 42; } static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #\u{6F}(value) { - yield value; + yield * value; } static * #\u2118(value) { - yield value; + yield * value; } static * #ZW_\u200C_NJ(value) { - yield value; + yield * value; } static * #ZW_\u200D_J(value) { - yield value; + yield * value; }; - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * \u{6F}(value) { - yield this.#\u{6F}(value); + static get \u{6F}() { + return this.#\u{6F}; } - static * \u2118(value) { - yield this.#\u2118(value); + static get \u2118() { + return this.#\u2118; } - static * ZW_\u200C_NJ(value) { - yield this.#ZW_\u200C_NJ(value); + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static * ZW_\u200D_J(value) { - yield this.#ZW_\u200D_J(value); + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } @@ -111,15 +111,25 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1).next().value, 1); -assert.sameValue(C._(1).next().value, 1); -assert.sameValue(C.\u{6F}(1).next().value, 1); -assert.sameValue(C.\u2118(1).next().value, 1); -assert.sameValue(C.ZW_\u200C_NJ(1).next().value, 1); -assert.sameValue(C.ZW_\u200D_J(1).next().value, 1); - - 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(C.$(1).next().value, 1); + assert.sameValue(C._(1).next().value, 1); + assert.sameValue(C.\u{6F}(1).next().value, 1); + assert.sameValue(C.\u2118(1).next().value, 1); + assert.sameValue(C.ZW_\u200C_NJ(1).next().value, 1); + assert.sameValue(C.ZW_\u200D_J(1).next().value, 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-gen-rs-static-method-privatename-identifier-alt.js b/test/language/expressions/class/fields-same-line-async-gen-rs-static-method-privatename-identifier-alt.js index f996692565..4fe3d61879 100644 --- a/test/language/expressions/class/fields-same-line-async-gen-rs-static-method-privatename-identifier-alt.js +++ b/test/language/expressions/class/fields-same-line-async-gen-rs-static-method-privatename-identifier-alt.js @@ -108,15 +108,25 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1), 1); -assert.sameValue(C._(1), 1); -assert.sameValue(C.o(1), 1); -assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD -assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD -assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD - - 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(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.o(1), 1); + assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-gen-rs-static-method-privatename-identifier.js b/test/language/expressions/class/fields-same-line-async-gen-rs-static-method-privatename-identifier.js index f412f24f64..744a6314b4 100644 --- a/test/language/expressions/class/fields-same-line-async-gen-rs-static-method-privatename-identifier.js +++ b/test/language/expressions/class/fields-same-line-async-gen-rs-static-method-privatename-identifier.js @@ -108,15 +108,25 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1), 1); -assert.sameValue(C._(1), 1); -assert.sameValue(C.\u{6F}(1), 1); -assert.sameValue(C.\u2118(1), 1); -assert.sameValue(C.ZW_\u200C_NJ(1), 1); -assert.sameValue(C.ZW_\u200D_J(1), 1); - - 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(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.\u{6F}(1), 1); + assert.sameValue(C.\u2118(1), 1); + assert.sameValue(C.ZW_\u200C_NJ(1), 1); + assert.sameValue(C.ZW_\u200D_J(1), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-gen-rs-static-privatename-identifier-alt-by-classname.js b/test/language/expressions/class/fields-same-line-async-gen-rs-static-privatename-identifier-alt-by-classname.js index 4a67be1fdd..62b242c0b2 100644 --- a/test/language/expressions/class/fields-same-line-async-gen-rs-static-privatename-identifier-alt-by-classname.js +++ b/test/language/expressions/class/fields-same-line-async-gen-rs-static-privatename-identifier-alt-by-classname.js @@ -96,15 +96,25 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1), 1); -assert.sameValue(C._(1), 1); -assert.sameValue(C.o(1), 1); -assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD -assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD -assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD - - 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(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.o(1), 1); + assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-gen-rs-static-privatename-identifier-alt.js b/test/language/expressions/class/fields-same-line-async-gen-rs-static-privatename-identifier-alt.js index 5bbb93a64f..26509ce6ce 100644 --- a/test/language/expressions/class/fields-same-line-async-gen-rs-static-privatename-identifier-alt.js +++ b/test/language/expressions/class/fields-same-line-async-gen-rs-static-privatename-identifier-alt.js @@ -96,15 +96,25 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1), 1); -assert.sameValue(C._(1), 1); -assert.sameValue(C.o(1), 1); -assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD -assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD -assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD - - 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(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.o(1), 1); + assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-gen-rs-static-privatename-identifier-by-classname.js b/test/language/expressions/class/fields-same-line-async-gen-rs-static-privatename-identifier-by-classname.js index 1ee0e6c603..5b10ecd98d 100644 --- a/test/language/expressions/class/fields-same-line-async-gen-rs-static-privatename-identifier-by-classname.js +++ b/test/language/expressions/class/fields-same-line-async-gen-rs-static-privatename-identifier-by-classname.js @@ -96,15 +96,25 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1), 1); -assert.sameValue(C._(1), 1); -assert.sameValue(C.\u{6F}(1), 1); -assert.sameValue(C.\u2118(1), 1); -assert.sameValue(C.ZW_\u200C_NJ(1), 1); -assert.sameValue(C.ZW_\u200D_J(1), 1); - - 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(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.\u{6F}(1), 1); + assert.sameValue(C.\u2118(1), 1); + assert.sameValue(C.ZW_\u200C_NJ(1), 1); + assert.sameValue(C.ZW_\u200D_J(1), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js b/test/language/expressions/class/fields-same-line-async-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js index 0fcad31030..9ac4140759 100644 --- a/test/language/expressions/class/fields-same-line-async-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js +++ b/test/language/expressions/class/fields-same-line-async-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js @@ -90,15 +90,25 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(), 1); -assert.sameValue(C._(), 1); -assert.sameValue(C.\u{6F}(), 1); -assert.sameValue(C.℘(), 1); -assert.sameValue(C.ZW_‌_NJ(), 1); -assert.sameValue(C.ZW_‍_J(), 1); - - 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(C.$(), 1); + assert.sameValue(C._(), 1); + assert.sameValue(C.\u{6F}(), 1); + assert.sameValue(C.℘(), 1); + assert.sameValue(C.ZW_‌_NJ(), 1); + assert.sameValue(C.ZW_‍_J(), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-gen-rs-static-privatename-identifier-initializer-alt.js b/test/language/expressions/class/fields-same-line-async-gen-rs-static-privatename-identifier-initializer-alt.js index 7c61c13b20..063799717f 100644 --- a/test/language/expressions/class/fields-same-line-async-gen-rs-static-privatename-identifier-initializer-alt.js +++ b/test/language/expressions/class/fields-same-line-async-gen-rs-static-privatename-identifier-initializer-alt.js @@ -90,15 +90,25 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(), 1); -assert.sameValue(C._(), 1); -assert.sameValue(C.\u{6F}(), 1); -assert.sameValue(C.℘(), 1); -assert.sameValue(C.ZW_‌_NJ(), 1); -assert.sameValue(C.ZW_‍_J(), 1); - - 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(C.$(), 1); + assert.sameValue(C._(), 1); + assert.sameValue(C.\u{6F}(), 1); + assert.sameValue(C.℘(), 1); + assert.sameValue(C.ZW_‌_NJ(), 1); + assert.sameValue(C.ZW_‍_J(), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-gen-rs-static-privatename-identifier-initializer.js b/test/language/expressions/class/fields-same-line-async-gen-rs-static-privatename-identifier-initializer.js index 8fec6d6252..4e73cf6130 100644 --- a/test/language/expressions/class/fields-same-line-async-gen-rs-static-privatename-identifier-initializer.js +++ b/test/language/expressions/class/fields-same-line-async-gen-rs-static-privatename-identifier-initializer.js @@ -90,15 +90,25 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(), 1); -assert.sameValue(C._(), 1); -assert.sameValue(C.\u{6F}(), 1); -assert.sameValue(C.\u2118(), 1); -assert.sameValue(C.ZW_\u200C_NJ(), 1); -assert.sameValue(C.ZW_\u200D_J(), 1); - - 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(C.$(), 1); + assert.sameValue(C._(), 1); + assert.sameValue(C.\u{6F}(), 1); + assert.sameValue(C.\u2118(), 1); + assert.sameValue(C.ZW_\u200C_NJ(), 1); + assert.sameValue(C.ZW_\u200D_J(), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-gen-rs-static-privatename-identifier.js b/test/language/expressions/class/fields-same-line-async-gen-rs-static-privatename-identifier.js index ef41a0853a..faf913c0aa 100644 --- a/test/language/expressions/class/fields-same-line-async-gen-rs-static-privatename-identifier.js +++ b/test/language/expressions/class/fields-same-line-async-gen-rs-static-privatename-identifier.js @@ -96,15 +96,25 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1), 1); -assert.sameValue(C._(1), 1); -assert.sameValue(C.\u{6F}(1), 1); -assert.sameValue(C.\u2118(1), 1); -assert.sameValue(C.ZW_\u200C_NJ(1), 1); -assert.sameValue(C.ZW_\u200D_J(1), 1); - - 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(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.\u{6F}(1), 1); + assert.sameValue(C.\u2118(1), 1); + assert.sameValue(C.ZW_\u200C_NJ(1), 1); + assert.sameValue(C.ZW_\u200D_J(1), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-gen-static-private-fields.js b/test/language/expressions/class/fields-same-line-async-gen-static-private-fields.js index 40d189e4db..8d3c3eecfb 100644 --- a/test/language/expressions/class/fields-same-line-async-gen-static-private-fields.js +++ b/test/language/expressions/class/fields-same-line-async-gen-static-private-fields.js @@ -47,24 +47,34 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -// Test the private fields do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); -assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); -assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); - -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); -assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); -assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); - -// Test if private fields can be sucessfully accessed and set to value -assert.sameValue(C.x(), 42, "test 7"); -assert.sameValue(C.y(), 43, "test 8"); - -// Test the private fields do not appear as properties before after set to value -assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); -assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); - 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') + } + } + // Test the private fields do not appear as properties before set to value + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + + // Test if private fields can be sucessfully accessed and set to value + assert.sameValue(C.x(), 42, "test 7"); + assert.sameValue(C.y(), 43, "test 8"); + + // Test the private fields do not appear as properties before after set to value + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-gen-static-private-methods-with-fields.js b/test/language/expressions/class/fields-same-line-async-gen-static-private-methods-with-fields.js new file mode 100644 index 0000000000..b54546d135 --- /dev/null +++ b/test/language/expressions/class/fields-same-line-async-gen-static-private-methods-with-fields.js @@ -0,0 +1,98 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-private-methods-with-fields.case +// - src/class-fields/productions/cls-expr-after-same-line-async-gen.template +/*--- +description: static private methods with fields (field definitions after an async generator in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public, + async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + async *m() { return 42; } static #xVal; static #yVal; + static #x(value) { + this.#xVal = value; + return this.#xVal; + } + static #y(value) { + this.#yVal = value; + return this.#yVal; + } + static x() { + return this.#x(42); + } + static y() { + return this.#y(43); + } +} + +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') + } + } + // Test the private methods do not appear as properties before set to value + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7"); + assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8"); + assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10"); + assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11"); + assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12"); + + // Test if private fields can be sucessfully accessed and set to value + assert.sameValue(C.x(), 42, "test 13"); + assert.sameValue(C.y(), 43, "test 14"); + + // Test the private fields do not appear as properties before after set to value + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16"); + + assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17"); + assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18"); + } + + return Promise.resolve(assertions()); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-gen-static-private-methods.js b/test/language/expressions/class/fields-same-line-async-gen-static-private-methods.js index 2bbac54e1b..f70b80a505 100644 --- a/test/language/expressions/class/fields-same-line-async-gen-static-private-methods.js +++ b/test/language/expressions/class/fields-same-line-async-gen-static-private-methods.js @@ -25,17 +25,15 @@ info: | var C = class { - async *m() { return 42; } static #xVal; static #yVal; + async *m() { return 42; } ; static #x(value) { - this.#xVal = value; - return this.#xVal; + return value / 2; } static #y(value) { - this.#y = value; - return this.#yVal; + return value * 2; } static x() { - return this.#x(42); + return this.#x(84); } static y() { return this.#y(43); @@ -53,24 +51,34 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -// Test the private methods do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 1"); -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 2"); -assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 3"); - -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 4"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 5"); -assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 6"); - -// Test if private fields can be sucessfully accessed and set to value -assert.sameValue(C.x(), 42, "test 7"); -assert.sameValue(C.y(), 43, "test 8"); - -// Test the private fields do not appear as properties before after set to value -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 9"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 10"); - 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') + } + } + // Test the private methods do not appear as properties before set to value + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + + // Test if private fields can be sucessfully accessed and set to value + assert.sameValue(C.x(), 42, "test 7"); + assert.sameValue(C.y(), 86, "test 8"); + + // Test the private fields do not appear as properties before after set to value + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); + } + + return Promise.resolve(assertions()); }, $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 index 108d2cf8f1..a843f8cabb 100644 --- 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 @@ -38,47 +38,57 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: 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: undefined, - 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: 39, - enumerable: true, - writable: true, - configurable: true -}); - -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "d"), false); -assert.sameValue(Object.hasOwnProperty.call(C, "d"), false); - -verifyProperty(c, "d", { - value: 42, - enumerable: true, - writable: true, - configurable: 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: undefined, + 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: 39, + enumerable: true, + writable: true, + configurable: true + }); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "d"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "d"), false); + + verifyProperty(c, "d", { + 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-computed-names.js b/test/language/expressions/class/fields-same-line-async-method-computed-names.js index c358d94b9b..a57afbd307 100644 --- 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 @@ -39,40 +39,50 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: 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: undefined, - enumerable: true, - writable: true, - configurable: 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, "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: undefined, + 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-computed-symbol-names.js b/test/language/expressions/class/fields-same-line-async-method-computed-symbol-names.js index b211484c3b..55c28114a7 100644 --- 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 @@ -40,34 +40,44 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: 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); + + 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, 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); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-method-grammar-privatename-identifier-semantics-stringvalue.js b/test/language/expressions/class/fields-same-line-async-method-grammar-privatename-identifier-semantics-stringvalue.js index dc9750b233..8edf845943 100644 --- a/test/language/expressions/class/fields-same-line-async-method-grammar-privatename-identifier-semantics-stringvalue.js +++ b/test/language/expressions/class/fields-same-line-async-method-grammar-privatename-identifier-semantics-stringvalue.js @@ -98,11 +98,21 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(c.o(1), 1); -assert.sameValue(c.℘(1), 1); -assert.sameValue(c.ZW_‌_NJ(1), 1); -assert.sameValue(c.ZW_‍_J(1), 1); - 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(c.o(1), 1); + assert.sameValue(c.℘(1), 1); + assert.sameValue(c.ZW_‌_NJ(1), 1); + assert.sameValue(c.ZW_‍_J(1), 1); + } + + return Promise.resolve(assertions()); }, $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 index b4dbeb9bc4..4923ef63f4 100644 --- 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 @@ -40,37 +40,47 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: 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); + + 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 + }); + + 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 + }); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-method-private-names.js b/test/language/expressions/class/fields-same-line-async-method-private-names.js index dab4667908..aa67b1faf9 100644 --- a/test/language/expressions/class/fields-same-line-async-method-private-names.js +++ b/test/language/expressions/class/fields-same-line-async-method-private-names.js @@ -47,23 +47,33 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -// Test the private fields do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); -assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); -assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); - -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); -assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); -assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); - -// Test if private fields can be sucessfully accessed and set to value -assert.sameValue(c.x(), 42, "test 7"); -assert.sameValue(c.y(), 43, "test 8"); - -// Test the private fields do not appear as properties before after set to value -assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 9"); -assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 10"); - 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') + } + } + // Test the private fields do not appear as properties before set to value + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + + // Test if private fields can be sucessfully accessed and set to value + assert.sameValue(c.x(), 42, "test 7"); + assert.sameValue(c.y(), 43, "test 8"); + + // Test the private fields do not appear as properties before after set to value + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 9"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 10"); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-method-rs-field-identifier-initializer.js b/test/language/expressions/class/fields-same-line-async-method-rs-field-identifier-initializer.js index 7492d169e4..56dd742b10 100644 --- a/test/language/expressions/class/fields-same-line-async-method-rs-field-identifier-initializer.js +++ b/test/language/expressions/class/fields-same-line-async-method-rs-field-identifier-initializer.js @@ -74,13 +74,23 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(c.$, 1); -assert.sameValue(c._, 1); -assert.sameValue(c.\u{6F}, 1); -assert.sameValue(c.\u2118, 1); -assert.sameValue(c.ZW_\u200C_NJ, 1); -assert.sameValue(c.ZW_\u200D_J, 1); - 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(c.$, 1); + assert.sameValue(c._, 1); + assert.sameValue(c.\u{6F}, 1); + assert.sameValue(c.\u2118, 1); + assert.sameValue(c.ZW_\u200C_NJ, 1); + assert.sameValue(c.ZW_\u200D_J, 1); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-method-rs-field-identifier.js b/test/language/expressions/class/fields-same-line-async-method-rs-field-identifier.js index 418b6bb5cb..d338ef06b7 100644 --- a/test/language/expressions/class/fields-same-line-async-method-rs-field-identifier.js +++ b/test/language/expressions/class/fields-same-line-async-method-rs-field-identifier.js @@ -74,20 +74,30 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -c.$ = 1; -c._ = 1; -c.\u{6F} = 1; -c.\u2118 = 1; -c.ZW_\u200C_NJ = 1; -c.ZW_\u200D_J = 1; - -assert.sameValue(c.$, 1); -assert.sameValue(c._, 1); -assert.sameValue(c.\u{6F}, 1); -assert.sameValue(c.\u2118, 1); -assert.sameValue(c.ZW_\u200C_NJ, 1); -assert.sameValue(c.ZW_\u200D_J, 1); - 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') + } + } + c.$ = 1; + c._ = 1; + c.\u{6F} = 1; + c.\u2118 = 1; + c.ZW_\u200C_NJ = 1; + c.ZW_\u200D_J = 1; + + assert.sameValue(c.$, 1); + assert.sameValue(c._, 1); + assert.sameValue(c.\u{6F}, 1); + assert.sameValue(c.\u2118, 1); + assert.sameValue(c.ZW_\u200C_NJ, 1); + assert.sameValue(c.ZW_\u200D_J, 1); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-method-rs-privatename-identifier-alt.js b/test/language/expressions/class/fields-same-line-async-method-rs-privatename-identifier-alt.js index 5f99dd5ece..a93dd1dace 100644 --- a/test/language/expressions/class/fields-same-line-async-method-rs-privatename-identifier-alt.js +++ b/test/language/expressions/class/fields-same-line-async-method-rs-privatename-identifier-alt.js @@ -95,14 +95,24 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(c.$(1), 1); -assert.sameValue(c._(1), 1); -assert.sameValue(c.\u{6F}(1), 1); -assert.sameValue(c.℘(1), 1); -assert.sameValue(c.ZW_‌_NJ(1), 1); -assert.sameValue(c.ZW_‍_J(1), 1); - - 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(c.$(1), 1); + assert.sameValue(c._(1), 1); + assert.sameValue(c.\u{6F}(1), 1); + assert.sameValue(c.℘(1), 1); + assert.sameValue(c.ZW_‌_NJ(1), 1); + assert.sameValue(c.ZW_‍_J(1), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-method-rs-privatename-identifier-initializer-alt.js b/test/language/expressions/class/fields-same-line-async-method-rs-privatename-identifier-initializer-alt.js index 2ad6e564e1..c611f6abb8 100644 --- a/test/language/expressions/class/fields-same-line-async-method-rs-privatename-identifier-initializer-alt.js +++ b/test/language/expressions/class/fields-same-line-async-method-rs-privatename-identifier-initializer-alt.js @@ -89,14 +89,24 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(c.$(), 1); -assert.sameValue(c._(), 1); -assert.sameValue(c.\u{6F}(), 1); -assert.sameValue(c.℘(), 1); -assert.sameValue(c.ZW_‌_NJ(), 1); -assert.sameValue(c.ZW_‍_J(), 1); - - 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(c.$(), 1); + assert.sameValue(c._(), 1); + assert.sameValue(c.\u{6F}(), 1); + assert.sameValue(c.℘(), 1); + assert.sameValue(c.ZW_‌_NJ(), 1); + assert.sameValue(c.ZW_‍_J(), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-method-rs-privatename-identifier-initializer.js b/test/language/expressions/class/fields-same-line-async-method-rs-privatename-identifier-initializer.js index 43367d150e..7bd37f635b 100644 --- a/test/language/expressions/class/fields-same-line-async-method-rs-privatename-identifier-initializer.js +++ b/test/language/expressions/class/fields-same-line-async-method-rs-privatename-identifier-initializer.js @@ -89,14 +89,24 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(c.$(), 1); -assert.sameValue(c._(), 1); -assert.sameValue(c.\u{6F}(), 1); -assert.sameValue(c.\u2118(), 1); -assert.sameValue(c.ZW_\u200C_NJ(), 1); -assert.sameValue(c.ZW_\u200D_J(), 1); - - 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(c.$(), 1); + assert.sameValue(c._(), 1); + assert.sameValue(c.\u{6F}(), 1); + assert.sameValue(c.\u2118(), 1); + assert.sameValue(c.ZW_\u200C_NJ(), 1); + assert.sameValue(c.ZW_\u200D_J(), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-method-rs-privatename-identifier.js b/test/language/expressions/class/fields-same-line-async-method-rs-privatename-identifier.js index 3ec6a7ceb2..8be0a72eff 100644 --- a/test/language/expressions/class/fields-same-line-async-method-rs-privatename-identifier.js +++ b/test/language/expressions/class/fields-same-line-async-method-rs-privatename-identifier.js @@ -95,14 +95,24 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(c.$(1), 1); -assert.sameValue(c._(1), 1); -assert.sameValue(c.\u{6F}(1), 1); -assert.sameValue(c.\u2118(1), 1); -assert.sameValue(c.ZW_\u200C_NJ(1), 1); -assert.sameValue(c.ZW_\u200D_J(1), 1); - - 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(c.$(1), 1); + assert.sameValue(c._(1), 1); + assert.sameValue(c.\u{6F}(1), 1); + assert.sameValue(c.\u2118(1), 1); + assert.sameValue(c.ZW_\u200C_NJ(1), 1); + assert.sameValue(c.ZW_\u200D_J(1), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-method-rs-static-async-generator-method-privatename-identifier-alt.js b/test/language/expressions/class/fields-same-line-async-method-rs-static-async-generator-method-privatename-identifier-alt.js index 26bf78ab93..f2d7070a42 100644 --- a/test/language/expressions/class/fields-same-line-async-method-rs-static-async-generator-method-privatename-identifier-alt.js +++ b/test/language/expressions/class/fields-same-line-async-method-rs-static-async-generator-method-privatename-identifier-alt.js @@ -61,41 +61,41 @@ info: | var C = class { - async m() { return 42; } static async #$(value) { + async m() { return 42; } static async * #$(value) { yield await value; } - static async #_(value) { + static async * #_(value) { yield await value; } - static async #o(value) { + static async * #o(value) { yield await value; } - static async #℘(value) { + static async * #℘(value) { yield await value; } - static async #ZW_‌_NJ(value) { + static async * #ZW_‌_NJ(value) { yield await value; } - static async #ZW_‍_J(value) { + static async * #ZW_‍_J(value) { yield await value; }; - static async $(value) { - yield * await this.#$(value); + static get $() { + return this.#$; } - static async _(value) { - yield * await this.#_(value); + static get _() { + return this.#_; } - static async o(value) { - yield * await this.#o(value); + static get o() { + return this.#o; } - static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } @@ -111,24 +111,34 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -Promise.all([ - C.$(1).next(), - C._(1).next(), - C.o(1).next(), - C.℘(1).next(), // DO NOT CHANGE THE NAME OF THIS FIELD - C.ZW_‌_NJ(1).next(), // DO NOT CHANGE THE NAME OF THIS FIELD - C.ZW_‍_J(1).next(), // DO NOT CHANGE THE NAME OF THIS FIELD -]).then(results => { - - assert.sameValue(results[0].value, 1); - assert.sameValue(results[1].value, 1); - assert.sameValue(results[2].value, 1); - assert.sameValue(results[3].value, 1); - assert.sameValue(results[4].value, 1); - assert.sameValue(results[5].value, 1); - -}, $DONE).then($DONE, $DONE); - 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') + } + } + Promise.all([ + C.$(1).next(), + C._(1).next(), + C.o(1).next(), + C.℘(1).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‌_NJ(1).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‍_J(1).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + ]).then(results => { + + assert.sameValue(results[0].value, 1); + assert.sameValue(results[1].value, 1); + assert.sameValue(results[2].value, 1); + assert.sameValue(results[3].value, 1); + assert.sameValue(results[4].value, 1); + assert.sameValue(results[5].value, 1); + + }, $DONE).then($DONE, $DONE); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-method-rs-static-async-generator-method-privatename-identifier.js b/test/language/expressions/class/fields-same-line-async-method-rs-static-async-generator-method-privatename-identifier.js index e5122fd210..b7e573ad48 100644 --- a/test/language/expressions/class/fields-same-line-async-method-rs-static-async-generator-method-privatename-identifier.js +++ b/test/language/expressions/class/fields-same-line-async-method-rs-static-async-generator-method-privatename-identifier.js @@ -62,40 +62,40 @@ info: | var C = class { async m() { return 42; } static async * #$(value) { - yield await value; + yield * await value; } static async * #_(value) { - yield await value; + yield * await value; } static async * #\u{6F}(value) { - yield await value; + yield * await value; } static async * #\u2118(value) { - yield await value; + yield * await value; } static async * #ZW_\u200C_NJ(value) { - yield await value; + yield * await value; } static async * #ZW_\u200D_J(value) { - yield await value; + yield * await value; }; - static async * $(value) { - yield * await this.#$(value); + static async * $() { + return this.#$; } - static async * _(value) { - yield * await this.#_(value); + static async * _() { + return this.#_; } - static async * \u{6F}(value) { - yield * await this.#\u{6F}(value); + static async * \u{6F}() { + return this.#\u{6F}; } - static async * \u2118(value) { - yield * await this.#\u2118(value); + static async * \u2118() { + return this.#\u2118; } - static async * ZW_\u200C_NJ(value) { - yield * await this.#ZW_\u200C_NJ(value); + static async * ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static async * ZW_\u200D_J(value) { - yield * await this.#ZW_\u200D_J(value); + static async * ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } @@ -111,25 +111,35 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -Promise.all([ - C.$(1).next(), - C._(1).next(), - C.\u{6F}(1).next(), - C.\u2118(1).next(), - C.ZW_\u200C_NJ(1).next(), - C.ZW_\u200D_J(1).next(), -]).then(results => { - - assert.sameValue(results[0].value, 1); - assert.sameValue(results[1].value, 1); - assert.sameValue(results[2].value, 1); - assert.sameValue(results[3].value, 1); - assert.sameValue(results[4].value, 1); - assert.sameValue(results[5].value, 1); - -}, $DONE).then($DONE, $DONE); - - 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') + } + } + Promise.all([ + C.$(1).next(), + C._(1).next(), + C.\u{6F}(1).next(), + C.\u2118(1).next(), + C.ZW_\u200C_NJ(1).next(), + C.ZW_\u200D_J(1).next(), + ]).then(results => { + + assert.sameValue(results[0].value, 1); + assert.sameValue(results[1].value, 1); + assert.sameValue(results[2].value, 1); + assert.sameValue(results[3].value, 1); + assert.sameValue(results[4].value, 1); + assert.sameValue(results[5].value, 1); + + }, $DONE).then($DONE, $DONE); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-method-rs-static-async-method-privatename-identifier-alt.js b/test/language/expressions/class/fields-same-line-async-method-rs-static-async-method-privatename-identifier-alt.js index 7a831c45c6..51560cd3ce 100644 --- a/test/language/expressions/class/fields-same-line-async-method-rs-static-async-method-privatename-identifier-alt.js +++ b/test/language/expressions/class/fields-same-line-async-method-rs-static-async-method-privatename-identifier-alt.js @@ -111,24 +111,34 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -Promise.all([ - C.$(1), - C._(1), - C.o(1), - C.℘(1), // DO NOT CHANGE THE NAME OF THIS FIELD - C.ZW_‌_NJ(1), // DO NOT CHANGE THE NAME OF THIS FIELD - C.ZW_‍_J(1), // DO NOT CHANGE THE NAME OF THIS FIELD -]).then(results => { - - assert.sameValue(results[0], 1); - assert.sameValue(results[1], 1); - assert.sameValue(results[2], 1); - assert.sameValue(results[3], 1); - assert.sameValue(results[4], 1); - assert.sameValue(results[5], 1); - -}, $DONE).then($DONE, $DONE); - 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') + } + } + Promise.all([ + C.$(1), + C._(1), + C.o(1), + C.℘(1), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‌_NJ(1), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‍_J(1), // DO NOT CHANGE THE NAME OF THIS FIELD + ]).then(results => { + + assert.sameValue(results[0], 1); + assert.sameValue(results[1], 1); + assert.sameValue(results[2], 1); + assert.sameValue(results[3], 1); + assert.sameValue(results[4], 1); + assert.sameValue(results[5], 1); + + }, $DONE).then($DONE, $DONE); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-method-rs-static-async-method-privatename-identifier.js b/test/language/expressions/class/fields-same-line-async-method-rs-static-async-method-privatename-identifier.js index 8a32100ecc..7612ed4cb3 100644 --- a/test/language/expressions/class/fields-same-line-async-method-rs-static-async-method-privatename-identifier.js +++ b/test/language/expressions/class/fields-same-line-async-method-rs-static-async-method-privatename-identifier.js @@ -111,25 +111,35 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -Promise.all([ - C.$(1), - C._(1), - C.\u{6F}(1), - C.\u2118(1), - C.ZW_\u200C_NJ(1), - C.ZW_\u200D_J(1), -]).then(results => { - - assert.sameValue(results[0], 1); - assert.sameValue(results[1], 1); - assert.sameValue(results[2], 1); - assert.sameValue(results[3], 1); - assert.sameValue(results[4], 1); - assert.sameValue(results[5], 1); - -}, $DONE).then($DONE, $DONE); - - 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') + } + } + Promise.all([ + C.$(1), + C._(1), + C.\u{6F}(1), + C.\u2118(1), + C.ZW_\u200C_NJ(1), + C.ZW_\u200D_J(1), + ]).then(results => { + + assert.sameValue(results[0], 1); + assert.sameValue(results[1], 1); + assert.sameValue(results[2], 1); + assert.sameValue(results[3], 1); + assert.sameValue(results[4], 1); + assert.sameValue(results[5], 1); + + }, $DONE).then($DONE, $DONE); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-method-rs-static-generator-method-privatename-identifier-alt.js b/test/language/expressions/class/fields-same-line-async-method-rs-static-generator-method-privatename-identifier-alt.js index 54ebe240d2..cf0352f99b 100644 --- a/test/language/expressions/class/fields-same-line-async-method-rs-static-generator-method-privatename-identifier-alt.js +++ b/test/language/expressions/class/fields-same-line-async-method-rs-static-generator-method-privatename-identifier-alt.js @@ -62,40 +62,40 @@ info: | var C = class { async m() { return 42; } static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #o(value) { - yield value; + yield * value; } static * #℘(value) { - yield value; + yield * value; } static * #ZW_‌_NJ(value) { - yield value; + yield * value; } static * #ZW_‍_J(value) { - yield value; + yield * value; }; - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * o(value) { - yield this.#o(value); + static get o() { + return this.#o; } - static * ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static * ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static * ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } @@ -111,13 +111,23 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1).next().value, 1); -assert.sameValue(C._(1).next().value, 1); -assert.sameValue(C.o(1).next().value, 1); -assert.sameValue(C.℘(1).next().value, 1); -assert.sameValue(C.ZW_‌_NJ(1).next().value, 1); -assert.sameValue(C.ZW_‍_J(1).next().value, 1); - 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(C.$(1).next().value, 1); + assert.sameValue(C._(1).next().value, 1); + assert.sameValue(C.o(1).next().value, 1); + assert.sameValue(C.℘(1).next().value, 1); + assert.sameValue(C.ZW_‌_NJ(1).next().value, 1); + assert.sameValue(C.ZW_‍_J(1).next().value, 1); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-method-rs-static-generator-method-privatename-identifier.js b/test/language/expressions/class/fields-same-line-async-method-rs-static-generator-method-privatename-identifier.js index cf3e86f543..485d37f1d6 100644 --- a/test/language/expressions/class/fields-same-line-async-method-rs-static-generator-method-privatename-identifier.js +++ b/test/language/expressions/class/fields-same-line-async-method-rs-static-generator-method-privatename-identifier.js @@ -62,40 +62,40 @@ info: | var C = class { async m() { return 42; } static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #\u{6F}(value) { - yield value; + yield * value; } static * #\u2118(value) { - yield value; + yield * value; } static * #ZW_\u200C_NJ(value) { - yield value; + yield * value; } static * #ZW_\u200D_J(value) { - yield value; + yield * value; }; - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * \u{6F}(value) { - yield this.#\u{6F}(value); + static get \u{6F}() { + return this.#\u{6F}; } - static * \u2118(value) { - yield this.#\u2118(value); + static get \u2118() { + return this.#\u2118; } - static * ZW_\u200C_NJ(value) { - yield this.#ZW_\u200C_NJ(value); + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static * ZW_\u200D_J(value) { - yield this.#ZW_\u200D_J(value); + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } @@ -111,14 +111,24 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1).next().value, 1); -assert.sameValue(C._(1).next().value, 1); -assert.sameValue(C.\u{6F}(1).next().value, 1); -assert.sameValue(C.\u2118(1).next().value, 1); -assert.sameValue(C.ZW_\u200C_NJ(1).next().value, 1); -assert.sameValue(C.ZW_\u200D_J(1).next().value, 1); - - 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(C.$(1).next().value, 1); + assert.sameValue(C._(1).next().value, 1); + assert.sameValue(C.\u{6F}(1).next().value, 1); + assert.sameValue(C.\u2118(1).next().value, 1); + assert.sameValue(C.ZW_\u200C_NJ(1).next().value, 1); + assert.sameValue(C.ZW_\u200D_J(1).next().value, 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-method-rs-static-method-privatename-identifier-alt.js b/test/language/expressions/class/fields-same-line-async-method-rs-static-method-privatename-identifier-alt.js index fc0ec082b3..36beb62fd0 100644 --- a/test/language/expressions/class/fields-same-line-async-method-rs-static-method-privatename-identifier-alt.js +++ b/test/language/expressions/class/fields-same-line-async-method-rs-static-method-privatename-identifier-alt.js @@ -108,14 +108,24 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1), 1); -assert.sameValue(C._(1), 1); -assert.sameValue(C.o(1), 1); -assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD -assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD -assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD - - 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(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.o(1), 1); + assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-method-rs-static-method-privatename-identifier.js b/test/language/expressions/class/fields-same-line-async-method-rs-static-method-privatename-identifier.js index bfeede6da5..ac2f83f229 100644 --- a/test/language/expressions/class/fields-same-line-async-method-rs-static-method-privatename-identifier.js +++ b/test/language/expressions/class/fields-same-line-async-method-rs-static-method-privatename-identifier.js @@ -108,14 +108,24 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1), 1); -assert.sameValue(C._(1), 1); -assert.sameValue(C.\u{6F}(1), 1); -assert.sameValue(C.\u2118(1), 1); -assert.sameValue(C.ZW_\u200C_NJ(1), 1); -assert.sameValue(C.ZW_\u200D_J(1), 1); - - 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(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.\u{6F}(1), 1); + assert.sameValue(C.\u2118(1), 1); + assert.sameValue(C.ZW_\u200C_NJ(1), 1); + assert.sameValue(C.ZW_\u200D_J(1), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-method-rs-static-privatename-identifier-alt-by-classname.js b/test/language/expressions/class/fields-same-line-async-method-rs-static-privatename-identifier-alt-by-classname.js index bc9f3384d3..4cfdf2fbd3 100644 --- a/test/language/expressions/class/fields-same-line-async-method-rs-static-privatename-identifier-alt-by-classname.js +++ b/test/language/expressions/class/fields-same-line-async-method-rs-static-privatename-identifier-alt-by-classname.js @@ -96,14 +96,24 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1), 1); -assert.sameValue(C._(1), 1); -assert.sameValue(C.o(1), 1); -assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD -assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD -assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD - - 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(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.o(1), 1); + assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-method-rs-static-privatename-identifier-alt.js b/test/language/expressions/class/fields-same-line-async-method-rs-static-privatename-identifier-alt.js index 3fe7bf6f27..66e5920a2a 100644 --- a/test/language/expressions/class/fields-same-line-async-method-rs-static-privatename-identifier-alt.js +++ b/test/language/expressions/class/fields-same-line-async-method-rs-static-privatename-identifier-alt.js @@ -96,14 +96,24 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1), 1); -assert.sameValue(C._(1), 1); -assert.sameValue(C.o(1), 1); -assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD -assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD -assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD - - 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(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.o(1), 1); + assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-method-rs-static-privatename-identifier-by-classname.js b/test/language/expressions/class/fields-same-line-async-method-rs-static-privatename-identifier-by-classname.js index db6376c81f..e1801401fc 100644 --- a/test/language/expressions/class/fields-same-line-async-method-rs-static-privatename-identifier-by-classname.js +++ b/test/language/expressions/class/fields-same-line-async-method-rs-static-privatename-identifier-by-classname.js @@ -96,14 +96,24 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1), 1); -assert.sameValue(C._(1), 1); -assert.sameValue(C.\u{6F}(1), 1); -assert.sameValue(C.\u2118(1), 1); -assert.sameValue(C.ZW_\u200C_NJ(1), 1); -assert.sameValue(C.ZW_\u200D_J(1), 1); - - 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(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.\u{6F}(1), 1); + assert.sameValue(C.\u2118(1), 1); + assert.sameValue(C.ZW_\u200C_NJ(1), 1); + assert.sameValue(C.ZW_\u200D_J(1), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-method-rs-static-privatename-identifier-initializer-alt-by-classname.js b/test/language/expressions/class/fields-same-line-async-method-rs-static-privatename-identifier-initializer-alt-by-classname.js index 2a6168162d..206001ef52 100644 --- a/test/language/expressions/class/fields-same-line-async-method-rs-static-privatename-identifier-initializer-alt-by-classname.js +++ b/test/language/expressions/class/fields-same-line-async-method-rs-static-privatename-identifier-initializer-alt-by-classname.js @@ -90,14 +90,24 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(), 1); -assert.sameValue(C._(), 1); -assert.sameValue(C.\u{6F}(), 1); -assert.sameValue(C.℘(), 1); -assert.sameValue(C.ZW_‌_NJ(), 1); -assert.sameValue(C.ZW_‍_J(), 1); - - 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(C.$(), 1); + assert.sameValue(C._(), 1); + assert.sameValue(C.\u{6F}(), 1); + assert.sameValue(C.℘(), 1); + assert.sameValue(C.ZW_‌_NJ(), 1); + assert.sameValue(C.ZW_‍_J(), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-method-rs-static-privatename-identifier-initializer-alt.js b/test/language/expressions/class/fields-same-line-async-method-rs-static-privatename-identifier-initializer-alt.js index c5c15676b3..5149c0353c 100644 --- a/test/language/expressions/class/fields-same-line-async-method-rs-static-privatename-identifier-initializer-alt.js +++ b/test/language/expressions/class/fields-same-line-async-method-rs-static-privatename-identifier-initializer-alt.js @@ -90,14 +90,24 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(), 1); -assert.sameValue(C._(), 1); -assert.sameValue(C.\u{6F}(), 1); -assert.sameValue(C.℘(), 1); -assert.sameValue(C.ZW_‌_NJ(), 1); -assert.sameValue(C.ZW_‍_J(), 1); - - 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(C.$(), 1); + assert.sameValue(C._(), 1); + assert.sameValue(C.\u{6F}(), 1); + assert.sameValue(C.℘(), 1); + assert.sameValue(C.ZW_‌_NJ(), 1); + assert.sameValue(C.ZW_‍_J(), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-method-rs-static-privatename-identifier-initializer.js b/test/language/expressions/class/fields-same-line-async-method-rs-static-privatename-identifier-initializer.js index b372055420..193d57da26 100644 --- a/test/language/expressions/class/fields-same-line-async-method-rs-static-privatename-identifier-initializer.js +++ b/test/language/expressions/class/fields-same-line-async-method-rs-static-privatename-identifier-initializer.js @@ -90,14 +90,24 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(), 1); -assert.sameValue(C._(), 1); -assert.sameValue(C.\u{6F}(), 1); -assert.sameValue(C.\u2118(), 1); -assert.sameValue(C.ZW_\u200C_NJ(), 1); -assert.sameValue(C.ZW_\u200D_J(), 1); - - 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(C.$(), 1); + assert.sameValue(C._(), 1); + assert.sameValue(C.\u{6F}(), 1); + assert.sameValue(C.\u2118(), 1); + assert.sameValue(C.ZW_\u200C_NJ(), 1); + assert.sameValue(C.ZW_\u200D_J(), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-method-rs-static-privatename-identifier.js b/test/language/expressions/class/fields-same-line-async-method-rs-static-privatename-identifier.js index ca85618524..da93e94361 100644 --- a/test/language/expressions/class/fields-same-line-async-method-rs-static-privatename-identifier.js +++ b/test/language/expressions/class/fields-same-line-async-method-rs-static-privatename-identifier.js @@ -96,14 +96,24 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1), 1); -assert.sameValue(C._(1), 1); -assert.sameValue(C.\u{6F}(1), 1); -assert.sameValue(C.\u2118(1), 1); -assert.sameValue(C.ZW_\u200C_NJ(1), 1); -assert.sameValue(C.ZW_\u200D_J(1), 1); - - 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(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.\u{6F}(1), 1); + assert.sameValue(C.\u2118(1), 1); + assert.sameValue(C.ZW_\u200C_NJ(1), 1); + assert.sameValue(C.ZW_\u200D_J(1), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-method-static-private-fields.js b/test/language/expressions/class/fields-same-line-async-method-static-private-fields.js index 2370de7b56..d942db06c9 100644 --- a/test/language/expressions/class/fields-same-line-async-method-static-private-fields.js +++ b/test/language/expressions/class/fields-same-line-async-method-static-private-fields.js @@ -47,23 +47,33 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -// Test the private fields do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); -assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); -assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); - -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); -assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); -assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); - -// Test if private fields can be sucessfully accessed and set to value -assert.sameValue(C.x(), 42, "test 7"); -assert.sameValue(C.y(), 43, "test 8"); - -// Test the private fields do not appear as properties before after set to value -assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); -assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); - 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') + } + } + // Test the private fields do not appear as properties before set to value + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + + // Test if private fields can be sucessfully accessed and set to value + assert.sameValue(C.x(), 42, "test 7"); + assert.sameValue(C.y(), 43, "test 8"); + + // Test the private fields do not appear as properties before after set to value + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-method-static-private-methods-with-fields.js b/test/language/expressions/class/fields-same-line-async-method-static-private-methods-with-fields.js new file mode 100644 index 0000000000..700484810f --- /dev/null +++ b/test/language/expressions/class/fields-same-line-async-method-static-private-methods-with-fields.js @@ -0,0 +1,97 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-private-methods-with-fields.case +// - src/class-fields/productions/cls-expr-after-same-line-async-method.template +/*--- +description: static private methods with fields (field definitions after an async method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public, + async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + async m() { return 42; } static #xVal; static #yVal; + static #x(value) { + this.#xVal = value; + return this.#xVal; + } + static #y(value) { + this.#yVal = value; + return this.#yVal; + } + static x() { + return this.#x(42); + } + static y() { + return this.#y(43); + } +} + +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') + } + } + // Test the private methods do not appear as properties before set to value + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7"); + assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8"); + assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10"); + assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11"); + assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12"); + + // Test if private fields can be sucessfully accessed and set to value + assert.sameValue(C.x(), 42, "test 13"); + assert.sameValue(C.y(), 43, "test 14"); + + // Test the private fields do not appear as properties before after set to value + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16"); + + assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17"); + assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18"); + } + + return Promise.resolve(assertions()); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/expressions/class/fields-same-line-async-method-static-private-methods.js b/test/language/expressions/class/fields-same-line-async-method-static-private-methods.js index fadd09677c..af8f5b912c 100644 --- a/test/language/expressions/class/fields-same-line-async-method-static-private-methods.js +++ b/test/language/expressions/class/fields-same-line-async-method-static-private-methods.js @@ -25,17 +25,15 @@ info: | var C = class { - async m() { return 42; } static #xVal; static #yVal; + async m() { return 42; } ; static #x(value) { - this.#xVal = value; - return this.#xVal; + return value / 2; } static #y(value) { - this.#y = value; - return this.#yVal; + return value * 2; } static x() { - return this.#x(42); + return this.#x(84); } static y() { return this.#y(43); @@ -53,23 +51,33 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -// Test the private methods do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 1"); -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 2"); -assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 3"); - -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 4"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 5"); -assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 6"); - -// Test if private fields can be sucessfully accessed and set to value -assert.sameValue(C.x(), 42, "test 7"); -assert.sameValue(C.y(), 43, "test 8"); - -// Test the private fields do not appear as properties before after set to value -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 9"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 10"); - 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') + } + } + // Test the private methods do not appear as properties before set to value + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + + // Test if private fields can be sucessfully accessed and set to value + assert.sameValue(C.x(), 42, "test 7"); + assert.sameValue(C.y(), 86, "test 8"); + + // Test the private fields do not appear as properties before after set to value + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); + } + + return Promise.resolve(assertions()); }, $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 index a311fd7c94..73f67f4a9a 100644 --- 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 @@ -38,46 +38,56 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: 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: undefined, - 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: 39, - enumerable: true, - writable: true, - configurable: true -}); - -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "d"), false); -assert.sameValue(Object.hasOwnProperty.call(C, "d"), false); - -verifyProperty(c, "d", { - value: 42, - enumerable: true, - writable: true, - configurable: 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: undefined, + 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: 39, + enumerable: true, + writable: true, + configurable: true + }); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "d"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "d"), false); + + verifyProperty(c, "d", { + 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-rs-static-async-generator-method-privatename-identifier-alt.js b/test/language/expressions/class/fields-same-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js index 66d0cc40fd..c0f6451faf 100644 --- a/test/language/expressions/class/fields-same-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js +++ b/test/language/expressions/class/fields-same-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js @@ -61,41 +61,41 @@ info: | var C = class { - static async #$(value) { + static async * #$(value) { yield await value; } - static async #_(value) { + static async * #_(value) { yield await value; } - static async #o(value) { + static async * #o(value) { yield await value; } - static async #℘(value) { + static async * #℘(value) { yield await value; } - static async #ZW_‌_NJ(value) { + static async * #ZW_‌_NJ(value) { yield await value; } - static async #ZW_‍_J(value) { + static async * #ZW_‍_J(value) { yield await value; }; *m() { return 42; } - static async $(value) { - yield * await this.#$(value); + static get $() { + return this.#$; } - static async _(value) { - yield * await this.#_(value); + static get _() { + return this.#_; } - static async o(value) { - yield * await this.#o(value); + static get o() { + return this.#o; } - static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/expressions/class/fields-same-line-gen-rs-static-async-generator-method-privatename-identifier.js b/test/language/expressions/class/fields-same-line-gen-rs-static-async-generator-method-privatename-identifier.js index beb17a4454..5c42a9ecee 100644 --- a/test/language/expressions/class/fields-same-line-gen-rs-static-async-generator-method-privatename-identifier.js +++ b/test/language/expressions/class/fields-same-line-gen-rs-static-async-generator-method-privatename-identifier.js @@ -62,40 +62,40 @@ info: | var C = class { static async * #$(value) { - yield await value; + yield * await value; } static async * #_(value) { - yield await value; + yield * await value; } static async * #\u{6F}(value) { - yield await value; + yield * await value; } static async * #\u2118(value) { - yield await value; + yield * await value; } static async * #ZW_\u200C_NJ(value) { - yield await value; + yield * await value; } static async * #ZW_\u200D_J(value) { - yield await value; + yield * await value; }; *m() { return 42; } - static async * $(value) { - yield * await this.#$(value); + static async * $() { + return this.#$; } - static async * _(value) { - yield * await this.#_(value); + static async * _() { + return this.#_; } - static async * \u{6F}(value) { - yield * await this.#\u{6F}(value); + static async * \u{6F}() { + return this.#\u{6F}; } - static async * \u2118(value) { - yield * await this.#\u2118(value); + static async * \u2118() { + return this.#\u2118; } - static async * ZW_\u200C_NJ(value) { - yield * await this.#ZW_\u200C_NJ(value); + static async * ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static async * ZW_\u200D_J(value) { - yield * await this.#ZW_\u200D_J(value); + static async * ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/expressions/class/fields-same-line-gen-rs-static-generator-method-privatename-identifier-alt.js b/test/language/expressions/class/fields-same-line-gen-rs-static-generator-method-privatename-identifier-alt.js index ca5a52108f..a6b44f4160 100644 --- a/test/language/expressions/class/fields-same-line-gen-rs-static-generator-method-privatename-identifier-alt.js +++ b/test/language/expressions/class/fields-same-line-gen-rs-static-generator-method-privatename-identifier-alt.js @@ -62,40 +62,40 @@ info: | var C = class { static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #o(value) { - yield value; + yield * value; } static * #℘(value) { - yield value; + yield * value; } static * #ZW_‌_NJ(value) { - yield value; + yield * value; } static * #ZW_‍_J(value) { - yield value; + yield * value; }; *m() { return 42; } - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * o(value) { - yield this.#o(value); + static get o() { + return this.#o; } - static * ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static * ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static * ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/expressions/class/fields-same-line-gen-rs-static-generator-method-privatename-identifier.js b/test/language/expressions/class/fields-same-line-gen-rs-static-generator-method-privatename-identifier.js index ca34befd92..34ea16384f 100644 --- a/test/language/expressions/class/fields-same-line-gen-rs-static-generator-method-privatename-identifier.js +++ b/test/language/expressions/class/fields-same-line-gen-rs-static-generator-method-privatename-identifier.js @@ -62,40 +62,40 @@ info: | var C = class { static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #\u{6F}(value) { - yield value; + yield * value; } static * #\u2118(value) { - yield value; + yield * value; } static * #ZW_\u200C_NJ(value) { - yield value; + yield * value; } static * #ZW_\u200D_J(value) { - yield value; + yield * value; }; *m() { return 42; } - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * \u{6F}(value) { - yield this.#\u{6F}(value); + static get \u{6F}() { + return this.#\u{6F}; } - static * \u2118(value) { - yield this.#\u2118(value); + static get \u2118() { + return this.#\u2118; } - static * ZW_\u200C_NJ(value) { - yield this.#ZW_\u200C_NJ(value); + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static * ZW_\u200D_J(value) { - yield this.#ZW_\u200D_J(value); + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/expressions/class/fields-same-line-gen-static-private-methods-with-fields.js b/test/language/expressions/class/fields-same-line-gen-static-private-methods-with-fields.js new file mode 100644 index 0000000000..4c713a5023 --- /dev/null +++ b/test/language/expressions/class/fields-same-line-gen-static-private-methods-with-fields.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-private-methods-with-fields.case +// - src/class-fields/productions/cls-expr-same-line-generator.template +/*--- +description: static private methods with fields (field definitions followed by a generator method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public, + generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + static #xVal; static #yVal; *m() { return 42; } + static #x(value) { + this.#xVal = value; + return this.#xVal; + } + static #y(value) { + this.#yVal = value; + return this.#yVal; + } + static x() { + return this.#x(42); + } + static y() { + return this.#y(43); + } +} + +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, +}); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7"); +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8"); +assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11"); +assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 13"); +assert.sameValue(C.y(), 43, "test 14"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16"); + +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18"); diff --git a/test/language/expressions/class/fields-same-line-gen-static-private-methods.js b/test/language/expressions/class/fields-same-line-gen-static-private-methods.js index d659b01a94..4ef5906965 100644 --- a/test/language/expressions/class/fields-same-line-gen-static-private-methods.js +++ b/test/language/expressions/class/fields-same-line-gen-static-private-methods.js @@ -25,17 +25,15 @@ info: | var C = class { - static #xVal; static #yVal; *m() { return 42; } + ; *m() { return 42; } static #x(value) { - this.#xVal = value; - return this.#xVal; + return value / 2; } static #y(value) { - this.#y = value; - return this.#yVal; + return value * 2; } static x() { - return this.#x(42); + return this.#x(84); } static y() { return this.#y(43); @@ -55,18 +53,18 @@ verifyProperty(C.prototype, "m", { }); // Test the private methods do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 1"); -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 2"); -assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 3"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 4"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 5"); -assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 6"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); // Test if private fields can be sucessfully accessed and set to value assert.sameValue(C.x(), 42, "test 7"); -assert.sameValue(C.y(), 43, "test 8"); +assert.sameValue(C.y(), 86, "test 8"); // Test the private fields do not appear as properties before after set to value -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 9"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); diff --git a/test/language/expressions/class/fields-same-line-method-rs-static-async-generator-method-privatename-identifier-alt.js b/test/language/expressions/class/fields-same-line-method-rs-static-async-generator-method-privatename-identifier-alt.js index 8bd431c404..7a6d2a9308 100644 --- a/test/language/expressions/class/fields-same-line-method-rs-static-async-generator-method-privatename-identifier-alt.js +++ b/test/language/expressions/class/fields-same-line-method-rs-static-async-generator-method-privatename-identifier-alt.js @@ -61,41 +61,41 @@ info: | var C = class { - static async #$(value) { + static async * #$(value) { yield await value; } - static async #_(value) { + static async * #_(value) { yield await value; } - static async #o(value) { + static async * #o(value) { yield await value; } - static async #℘(value) { + static async * #℘(value) { yield await value; } - static async #ZW_‌_NJ(value) { + static async * #ZW_‌_NJ(value) { yield await value; } - static async #ZW_‍_J(value) { + static async * #ZW_‍_J(value) { yield await value; }; m() { return 42; } - static async $(value) { - yield * await this.#$(value); + static get $() { + return this.#$; } - static async _(value) { - yield * await this.#_(value); + static get _() { + return this.#_; } - static async o(value) { - yield * await this.#o(value); + static get o() { + return this.#o; } - static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/expressions/class/fields-same-line-method-rs-static-async-generator-method-privatename-identifier.js b/test/language/expressions/class/fields-same-line-method-rs-static-async-generator-method-privatename-identifier.js index ef3c0c7ad4..bd54b46961 100644 --- a/test/language/expressions/class/fields-same-line-method-rs-static-async-generator-method-privatename-identifier.js +++ b/test/language/expressions/class/fields-same-line-method-rs-static-async-generator-method-privatename-identifier.js @@ -62,40 +62,40 @@ info: | var C = class { static async * #$(value) { - yield await value; + yield * await value; } static async * #_(value) { - yield await value; + yield * await value; } static async * #\u{6F}(value) { - yield await value; + yield * await value; } static async * #\u2118(value) { - yield await value; + yield * await value; } static async * #ZW_\u200C_NJ(value) { - yield await value; + yield * await value; } static async * #ZW_\u200D_J(value) { - yield await value; + yield * await value; }; m() { return 42; } - static async * $(value) { - yield * await this.#$(value); + static async * $() { + return this.#$; } - static async * _(value) { - yield * await this.#_(value); + static async * _() { + return this.#_; } - static async * \u{6F}(value) { - yield * await this.#\u{6F}(value); + static async * \u{6F}() { + return this.#\u{6F}; } - static async * \u2118(value) { - yield * await this.#\u2118(value); + static async * \u2118() { + return this.#\u2118; } - static async * ZW_\u200C_NJ(value) { - yield * await this.#ZW_\u200C_NJ(value); + static async * ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static async * ZW_\u200D_J(value) { - yield * await this.#ZW_\u200D_J(value); + static async * ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/expressions/class/fields-same-line-method-rs-static-generator-method-privatename-identifier-alt.js b/test/language/expressions/class/fields-same-line-method-rs-static-generator-method-privatename-identifier-alt.js index 3cc1e09920..2dc77c4d4a 100644 --- a/test/language/expressions/class/fields-same-line-method-rs-static-generator-method-privatename-identifier-alt.js +++ b/test/language/expressions/class/fields-same-line-method-rs-static-generator-method-privatename-identifier-alt.js @@ -62,40 +62,40 @@ info: | var C = class { static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #o(value) { - yield value; + yield * value; } static * #℘(value) { - yield value; + yield * value; } static * #ZW_‌_NJ(value) { - yield value; + yield * value; } static * #ZW_‍_J(value) { - yield value; + yield * value; }; m() { return 42; } - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * o(value) { - yield this.#o(value); + static get o() { + return this.#o; } - static * ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static * ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static * ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/expressions/class/fields-same-line-method-rs-static-generator-method-privatename-identifier.js b/test/language/expressions/class/fields-same-line-method-rs-static-generator-method-privatename-identifier.js index 5dfeb484e6..1772d74c12 100644 --- a/test/language/expressions/class/fields-same-line-method-rs-static-generator-method-privatename-identifier.js +++ b/test/language/expressions/class/fields-same-line-method-rs-static-generator-method-privatename-identifier.js @@ -62,40 +62,40 @@ info: | var C = class { static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #\u{6F}(value) { - yield value; + yield * value; } static * #\u2118(value) { - yield value; + yield * value; } static * #ZW_\u200C_NJ(value) { - yield value; + yield * value; } static * #ZW_\u200D_J(value) { - yield value; + yield * value; }; m() { return 42; } - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * \u{6F}(value) { - yield this.#\u{6F}(value); + static get \u{6F}() { + return this.#\u{6F}; } - static * \u2118(value) { - yield this.#\u2118(value); + static get \u2118() { + return this.#\u2118; } - static * ZW_\u200C_NJ(value) { - yield this.#ZW_\u200C_NJ(value); + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static * ZW_\u200D_J(value) { - yield this.#ZW_\u200D_J(value); + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/expressions/class/fields-same-line-method-static-private-methods-with-fields.js b/test/language/expressions/class/fields-same-line-method-static-private-methods-with-fields.js new file mode 100644 index 0000000000..a694c74b4a --- /dev/null +++ b/test/language/expressions/class/fields-same-line-method-static-private-methods-with-fields.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-private-methods-with-fields.case +// - src/class-fields/productions/cls-expr-same-line-method.template +/*--- +description: static private methods with fields (field definitions followed by a method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + static #xVal; static #yVal; m() { return 42; } + static #x(value) { + this.#xVal = value; + return this.#xVal; + } + static #y(value) { + this.#yVal = value; + return this.#yVal; + } + static x() { + return this.#x(42); + } + static y() { + return this.#y(43); + } +} + +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, +}); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7"); +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8"); +assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11"); +assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 13"); +assert.sameValue(C.y(), 43, "test 14"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16"); + +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18"); diff --git a/test/language/expressions/class/fields-same-line-method-static-private-methods.js b/test/language/expressions/class/fields-same-line-method-static-private-methods.js index a1c0c40cd5..86046ecb28 100644 --- a/test/language/expressions/class/fields-same-line-method-static-private-methods.js +++ b/test/language/expressions/class/fields-same-line-method-static-private-methods.js @@ -25,17 +25,15 @@ info: | var C = class { - static #xVal; static #yVal; m() { return 42; } + ; m() { return 42; } static #x(value) { - this.#xVal = value; - return this.#xVal; + return value / 2; } static #y(value) { - this.#y = value; - return this.#yVal; + return value * 2; } static x() { - return this.#x(42); + return this.#x(84); } static y() { return this.#y(43); @@ -55,18 +53,18 @@ verifyProperty(C.prototype, "m", { }); // Test the private methods do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 1"); -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 2"); -assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 3"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 4"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 5"); -assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 6"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); // Test if private fields can be sucessfully accessed and set to value assert.sameValue(C.x(), 42, "test 7"); -assert.sameValue(C.y(), 43, "test 8"); +assert.sameValue(C.y(), 86, "test 8"); // Test the private fields do not appear as properties before after set to value -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 9"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); diff --git a/test/language/expressions/class/fields-wrapped-in-sc-rs-static-async-generator-method-privatename-identifier-alt.js b/test/language/expressions/class/fields-wrapped-in-sc-rs-static-async-generator-method-privatename-identifier-alt.js index 826c112aa8..f91bf29fbf 100644 --- a/test/language/expressions/class/fields-wrapped-in-sc-rs-static-async-generator-method-privatename-identifier-alt.js +++ b/test/language/expressions/class/fields-wrapped-in-sc-rs-static-async-generator-method-privatename-identifier-alt.js @@ -61,42 +61,42 @@ info: | var C = class { ;;;; - ;;;;;;static async #$(value) { + ;;;;;;static async * #$(value) { yield await value; } - static async #_(value) { + static async * #_(value) { yield await value; } - static async #o(value) { + static async * #o(value) { yield await value; } - static async #℘(value) { + static async * #℘(value) { yield await value; } - static async #ZW_‌_NJ(value) { + static async * #ZW_‌_NJ(value) { yield await value; } - static async #ZW_‍_J(value) { + static async * #ZW_‍_J(value) { yield await value; };;;;;;; ;;;; - static async $(value) { - yield * await this.#$(value); + static get $() { + return this.#$; } - static async _(value) { - yield * await this.#_(value); + static get _() { + return this.#_; } - static async o(value) { - yield * await this.#o(value); + static get o() { + return this.#o; } - static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/expressions/class/fields-wrapped-in-sc-rs-static-async-generator-method-privatename-identifier.js b/test/language/expressions/class/fields-wrapped-in-sc-rs-static-async-generator-method-privatename-identifier.js index 57027d8e82..55fecc3a8d 100644 --- a/test/language/expressions/class/fields-wrapped-in-sc-rs-static-async-generator-method-privatename-identifier.js +++ b/test/language/expressions/class/fields-wrapped-in-sc-rs-static-async-generator-method-privatename-identifier.js @@ -62,41 +62,41 @@ info: | var C = class { ;;;; ;;;;;;static async * #$(value) { - yield await value; + yield * await value; } static async * #_(value) { - yield await value; + yield * await value; } static async * #\u{6F}(value) { - yield await value; + yield * await value; } static async * #\u2118(value) { - yield await value; + yield * await value; } static async * #ZW_\u200C_NJ(value) { - yield await value; + yield * await value; } static async * #ZW_\u200D_J(value) { - yield await value; + yield * await value; };;;;;;; ;;;; - static async * $(value) { - yield * await this.#$(value); + static async * $() { + return this.#$; } - static async * _(value) { - yield * await this.#_(value); + static async * _() { + return this.#_; } - static async * \u{6F}(value) { - yield * await this.#\u{6F}(value); + static async * \u{6F}() { + return this.#\u{6F}; } - static async * \u2118(value) { - yield * await this.#\u2118(value); + static async * \u2118() { + return this.#\u2118; } - static async * ZW_\u200C_NJ(value) { - yield * await this.#ZW_\u200C_NJ(value); + static async * ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static async * ZW_\u200D_J(value) { - yield * await this.#ZW_\u200D_J(value); + static async * ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/expressions/class/fields-wrapped-in-sc-rs-static-generator-method-privatename-identifier-alt.js b/test/language/expressions/class/fields-wrapped-in-sc-rs-static-generator-method-privatename-identifier-alt.js index d4c4195bb9..234b1969af 100644 --- a/test/language/expressions/class/fields-wrapped-in-sc-rs-static-generator-method-privatename-identifier-alt.js +++ b/test/language/expressions/class/fields-wrapped-in-sc-rs-static-generator-method-privatename-identifier-alt.js @@ -62,41 +62,41 @@ info: | var C = class { ;;;; ;;;;;;static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #o(value) { - yield value; + yield * value; } static * #℘(value) { - yield value; + yield * value; } static * #ZW_‌_NJ(value) { - yield value; + yield * value; } static * #ZW_‍_J(value) { - yield value; + yield * value; };;;;;;; ;;;; - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * o(value) { - yield this.#o(value); + static get o() { + return this.#o; } - static * ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static * ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static * ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/expressions/class/fields-wrapped-in-sc-rs-static-generator-method-privatename-identifier.js b/test/language/expressions/class/fields-wrapped-in-sc-rs-static-generator-method-privatename-identifier.js index 4331108e29..71fb389cf8 100644 --- a/test/language/expressions/class/fields-wrapped-in-sc-rs-static-generator-method-privatename-identifier.js +++ b/test/language/expressions/class/fields-wrapped-in-sc-rs-static-generator-method-privatename-identifier.js @@ -62,41 +62,41 @@ info: | var C = class { ;;;; ;;;;;;static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #\u{6F}(value) { - yield value; + yield * value; } static * #\u2118(value) { - yield value; + yield * value; } static * #ZW_\u200C_NJ(value) { - yield value; + yield * value; } static * #ZW_\u200D_J(value) { - yield value; + yield * value; };;;;;;; ;;;; - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * \u{6F}(value) { - yield this.#\u{6F}(value); + static get \u{6F}() { + return this.#\u{6F}; } - static * \u2118(value) { - yield this.#\u2118(value); + static get \u2118() { + return this.#\u2118; } - static * ZW_\u200C_NJ(value) { - yield this.#ZW_\u200C_NJ(value); + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static * ZW_\u200D_J(value) { - yield this.#ZW_\u200D_J(value); + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/expressions/class/fields-wrapped-in-sc-static-private-methods-with-fields.js b/test/language/expressions/class/fields-wrapped-in-sc-static-private-methods-with-fields.js new file mode 100644 index 0000000000..8ff337d331 --- /dev/null +++ b/test/language/expressions/class/fields-wrapped-in-sc-static-private-methods-with-fields.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-private-methods-with-fields.case +// - src/class-fields/productions/cls-expr-wrapped-in-sc.template +/*--- +description: static private methods with fields (fields definition wrapped in semicolons) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +var C = class { + ;;;; + ;;;;;;static #xVal; static #yVal;;;;;;; + ;;;; + static #x(value) { + this.#xVal = value; + return this.#xVal; + } + static #y(value) { + this.#yVal = value; + return this.#yVal; + } + static x() { + return this.#x(42); + } + static y() { + return this.#y(43); + } +} + +var c = new C(); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7"); +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8"); +assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11"); +assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 13"); +assert.sameValue(C.y(), 43, "test 14"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16"); + +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18"); diff --git a/test/language/expressions/class/fields-wrapped-in-sc-static-private-methods.js b/test/language/expressions/class/fields-wrapped-in-sc-static-private-methods.js index 32636c420d..5dc4b0a3ac 100644 --- a/test/language/expressions/class/fields-wrapped-in-sc-static-private-methods.js +++ b/test/language/expressions/class/fields-wrapped-in-sc-static-private-methods.js @@ -25,18 +25,16 @@ info: | var C = class { ;;;; - ;;;;;;static #xVal; static #yVal;;;;;;; + ;;;;;;;;;;;;; ;;;; static #x(value) { - this.#xVal = value; - return this.#xVal; + return value / 2; } static #y(value) { - this.#y = value; - return this.#yVal; + return value * 2; } static x() { - return this.#x(42); + return this.#x(84); } static y() { return this.#y(43); @@ -46,18 +44,18 @@ var C = class { var c = new C(); // Test the private methods do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 1"); -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 2"); -assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 3"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 4"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 5"); -assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 6"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); // Test if private fields can be sucessfully accessed and set to value assert.sameValue(C.x(), 42, "test 7"); -assert.sameValue(C.y(), 43, "test 8"); +assert.sameValue(C.y(), 86, "test 8"); // Test the private fields do not appear as properties before after set to value -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 9"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); diff --git a/test/language/statements/class/fields-after-same-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js b/test/language/statements/class/fields-after-same-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js index 9371edf280..14a21f7e65 100644 --- a/test/language/statements/class/fields-after-same-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js +++ b/test/language/statements/class/fields-after-same-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js @@ -61,41 +61,41 @@ info: | class C { - *m() { return 42; } static async #$(value) { + *m() { return 42; } static async * #$(value) { yield await value; } - static async #_(value) { + static async * #_(value) { yield await value; } - static async #o(value) { + static async * #o(value) { yield await value; } - static async #℘(value) { + static async * #℘(value) { yield await value; } - static async #ZW_‌_NJ(value) { + static async * #ZW_‌_NJ(value) { yield await value; } - static async #ZW_‍_J(value) { + static async * #ZW_‍_J(value) { yield await value; }; - static async $(value) { - yield * await this.#$(value); + static get $() { + return this.#$; } - static async _(value) { - yield * await this.#_(value); + static get _() { + return this.#_; } - static async o(value) { - yield * await this.#o(value); + static get o() { + return this.#o; } - static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/statements/class/fields-after-same-line-gen-rs-static-async-generator-method-privatename-identifier.js b/test/language/statements/class/fields-after-same-line-gen-rs-static-async-generator-method-privatename-identifier.js index 530f0feddb..6d5be48070 100644 --- a/test/language/statements/class/fields-after-same-line-gen-rs-static-async-generator-method-privatename-identifier.js +++ b/test/language/statements/class/fields-after-same-line-gen-rs-static-async-generator-method-privatename-identifier.js @@ -62,40 +62,40 @@ info: | class C { *m() { return 42; } static async * #$(value) { - yield await value; + yield * await value; } static async * #_(value) { - yield await value; + yield * await value; } static async * #\u{6F}(value) { - yield await value; + yield * await value; } static async * #\u2118(value) { - yield await value; + yield * await value; } static async * #ZW_\u200C_NJ(value) { - yield await value; + yield * await value; } static async * #ZW_\u200D_J(value) { - yield await value; + yield * await value; }; - static async * $(value) { - yield * await this.#$(value); + static async * $() { + return this.#$; } - static async * _(value) { - yield * await this.#_(value); + static async * _() { + return this.#_; } - static async * \u{6F}(value) { - yield * await this.#\u{6F}(value); + static async * \u{6F}() { + return this.#\u{6F}; } - static async * \u2118(value) { - yield * await this.#\u2118(value); + static async * \u2118() { + return this.#\u2118; } - static async * ZW_\u200C_NJ(value) { - yield * await this.#ZW_\u200C_NJ(value); + static async * ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static async * ZW_\u200D_J(value) { - yield * await this.#ZW_\u200D_J(value); + static async * ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/statements/class/fields-after-same-line-gen-rs-static-generator-method-privatename-identifier-alt.js b/test/language/statements/class/fields-after-same-line-gen-rs-static-generator-method-privatename-identifier-alt.js index 7f9fdda341..580b11ce44 100644 --- a/test/language/statements/class/fields-after-same-line-gen-rs-static-generator-method-privatename-identifier-alt.js +++ b/test/language/statements/class/fields-after-same-line-gen-rs-static-generator-method-privatename-identifier-alt.js @@ -62,40 +62,40 @@ info: | class C { *m() { return 42; } static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #o(value) { - yield value; + yield * value; } static * #℘(value) { - yield value; + yield * value; } static * #ZW_‌_NJ(value) { - yield value; + yield * value; } static * #ZW_‍_J(value) { - yield value; + yield * value; }; - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * o(value) { - yield this.#o(value); + static get o() { + return this.#o; } - static * ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static * ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static * ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/statements/class/fields-after-same-line-gen-rs-static-generator-method-privatename-identifier.js b/test/language/statements/class/fields-after-same-line-gen-rs-static-generator-method-privatename-identifier.js index 0cefd9ca02..9e66159934 100644 --- a/test/language/statements/class/fields-after-same-line-gen-rs-static-generator-method-privatename-identifier.js +++ b/test/language/statements/class/fields-after-same-line-gen-rs-static-generator-method-privatename-identifier.js @@ -62,40 +62,40 @@ info: | class C { *m() { return 42; } static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #\u{6F}(value) { - yield value; + yield * value; } static * #\u2118(value) { - yield value; + yield * value; } static * #ZW_\u200C_NJ(value) { - yield value; + yield * value; } static * #ZW_\u200D_J(value) { - yield value; + yield * value; }; - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * \u{6F}(value) { - yield this.#\u{6F}(value); + static get \u{6F}() { + return this.#\u{6F}; } - static * \u2118(value) { - yield this.#\u2118(value); + static get \u2118() { + return this.#\u2118; } - static * ZW_\u200C_NJ(value) { - yield this.#ZW_\u200C_NJ(value); + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static * ZW_\u200D_J(value) { - yield this.#ZW_\u200D_J(value); + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/statements/class/fields-after-same-line-gen-static-private-methods-with-fields.js b/test/language/statements/class/fields-after-same-line-gen-static-private-methods-with-fields.js new file mode 100644 index 0000000000..f23a67eecf --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-gen-static-private-methods-with-fields.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-private-methods-with-fields.case +// - src/class-fields/productions/cls-decl-after-same-line-gen.template +/*--- +description: static private methods with fields (field definitions after a generator in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +class C { + *m() { return 42; } static #xVal; static #yVal; + static #x(value) { + this.#xVal = value; + return this.#xVal; + } + static #y(value) { + this.#yVal = value; + return this.#yVal; + } + static x() { + return this.#x(42); + } + static y() { + return this.#y(43); + } +} + +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, +}); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7"); +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8"); +assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11"); +assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 13"); +assert.sameValue(C.y(), 43, "test 14"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16"); + +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18"); diff --git a/test/language/statements/class/fields-after-same-line-gen-static-private-methods.js b/test/language/statements/class/fields-after-same-line-gen-static-private-methods.js index 00ed8463be..07a8b44bc0 100644 --- a/test/language/statements/class/fields-after-same-line-gen-static-private-methods.js +++ b/test/language/statements/class/fields-after-same-line-gen-static-private-methods.js @@ -25,17 +25,15 @@ info: | class C { - *m() { return 42; } static #xVal; static #yVal; + *m() { return 42; } ; static #x(value) { - this.#xVal = value; - return this.#xVal; + return value / 2; } static #y(value) { - this.#y = value; - return this.#yVal; + return value * 2; } static x() { - return this.#x(42); + return this.#x(84); } static y() { return this.#y(43); @@ -55,18 +53,18 @@ verifyProperty(C.prototype, "m", { }); // Test the private methods do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 1"); -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 2"); -assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 3"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 4"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 5"); -assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 6"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); // Test if private fields can be sucessfully accessed and set to value assert.sameValue(C.x(), 42, "test 7"); -assert.sameValue(C.y(), 43, "test 8"); +assert.sameValue(C.y(), 86, "test 8"); // Test the private fields do not appear as properties before after set to value -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 9"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); diff --git a/test/language/statements/class/fields-after-same-line-method-rs-static-async-generator-method-privatename-identifier-alt.js b/test/language/statements/class/fields-after-same-line-method-rs-static-async-generator-method-privatename-identifier-alt.js index 314c7a6157..395e1098bf 100644 --- a/test/language/statements/class/fields-after-same-line-method-rs-static-async-generator-method-privatename-identifier-alt.js +++ b/test/language/statements/class/fields-after-same-line-method-rs-static-async-generator-method-privatename-identifier-alt.js @@ -61,41 +61,41 @@ info: | class C { - m() { return 42; } static async #$(value) { + m() { return 42; } static async * #$(value) { yield await value; } - static async #_(value) { + static async * #_(value) { yield await value; } - static async #o(value) { + static async * #o(value) { yield await value; } - static async #℘(value) { + static async * #℘(value) { yield await value; } - static async #ZW_‌_NJ(value) { + static async * #ZW_‌_NJ(value) { yield await value; } - static async #ZW_‍_J(value) { + static async * #ZW_‍_J(value) { yield await value; }; - static async $(value) { - yield * await this.#$(value); + static get $() { + return this.#$; } - static async _(value) { - yield * await this.#_(value); + static get _() { + return this.#_; } - static async o(value) { - yield * await this.#o(value); + static get o() { + return this.#o; } - static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/statements/class/fields-after-same-line-method-rs-static-async-generator-method-privatename-identifier.js b/test/language/statements/class/fields-after-same-line-method-rs-static-async-generator-method-privatename-identifier.js index fcf17e7581..4d2481015e 100644 --- a/test/language/statements/class/fields-after-same-line-method-rs-static-async-generator-method-privatename-identifier.js +++ b/test/language/statements/class/fields-after-same-line-method-rs-static-async-generator-method-privatename-identifier.js @@ -62,40 +62,40 @@ info: | class C { m() { return 42; } static async * #$(value) { - yield await value; + yield * await value; } static async * #_(value) { - yield await value; + yield * await value; } static async * #\u{6F}(value) { - yield await value; + yield * await value; } static async * #\u2118(value) { - yield await value; + yield * await value; } static async * #ZW_\u200C_NJ(value) { - yield await value; + yield * await value; } static async * #ZW_\u200D_J(value) { - yield await value; + yield * await value; }; - static async * $(value) { - yield * await this.#$(value); + static async * $() { + return this.#$; } - static async * _(value) { - yield * await this.#_(value); + static async * _() { + return this.#_; } - static async * \u{6F}(value) { - yield * await this.#\u{6F}(value); + static async * \u{6F}() { + return this.#\u{6F}; } - static async * \u2118(value) { - yield * await this.#\u2118(value); + static async * \u2118() { + return this.#\u2118; } - static async * ZW_\u200C_NJ(value) { - yield * await this.#ZW_\u200C_NJ(value); + static async * ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static async * ZW_\u200D_J(value) { - yield * await this.#ZW_\u200D_J(value); + static async * ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/statements/class/fields-after-same-line-method-rs-static-generator-method-privatename-identifier-alt.js b/test/language/statements/class/fields-after-same-line-method-rs-static-generator-method-privatename-identifier-alt.js index 1ff8aa7651..4c0db20b25 100644 --- a/test/language/statements/class/fields-after-same-line-method-rs-static-generator-method-privatename-identifier-alt.js +++ b/test/language/statements/class/fields-after-same-line-method-rs-static-generator-method-privatename-identifier-alt.js @@ -62,40 +62,40 @@ info: | class C { m() { return 42; } static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #o(value) { - yield value; + yield * value; } static * #℘(value) { - yield value; + yield * value; } static * #ZW_‌_NJ(value) { - yield value; + yield * value; } static * #ZW_‍_J(value) { - yield value; + yield * value; }; - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * o(value) { - yield this.#o(value); + static get o() { + return this.#o; } - static * ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static * ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static * ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/statements/class/fields-after-same-line-method-rs-static-generator-method-privatename-identifier.js b/test/language/statements/class/fields-after-same-line-method-rs-static-generator-method-privatename-identifier.js index f0fd6fe03d..cc30c68602 100644 --- a/test/language/statements/class/fields-after-same-line-method-rs-static-generator-method-privatename-identifier.js +++ b/test/language/statements/class/fields-after-same-line-method-rs-static-generator-method-privatename-identifier.js @@ -62,40 +62,40 @@ info: | class C { m() { return 42; } static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #\u{6F}(value) { - yield value; + yield * value; } static * #\u2118(value) { - yield value; + yield * value; } static * #ZW_\u200C_NJ(value) { - yield value; + yield * value; } static * #ZW_\u200D_J(value) { - yield value; + yield * value; }; - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * \u{6F}(value) { - yield this.#\u{6F}(value); + static get \u{6F}() { + return this.#\u{6F}; } - static * \u2118(value) { - yield this.#\u2118(value); + static get \u2118() { + return this.#\u2118; } - static * ZW_\u200C_NJ(value) { - yield this.#ZW_\u200C_NJ(value); + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static * ZW_\u200D_J(value) { - yield this.#ZW_\u200D_J(value); + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/statements/class/fields-after-same-line-method-static-private-methods-with-fields.js b/test/language/statements/class/fields-after-same-line-method-static-private-methods-with-fields.js new file mode 100644 index 0000000000..022da1efd2 --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-method-static-private-methods-with-fields.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-private-methods-with-fields.case +// - src/class-fields/productions/cls-decl-after-same-line-method.template +/*--- +description: static private methods with fields (field definitions after a method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +class C { + m() { return 42; } static #xVal; static #yVal; + static #x(value) { + this.#xVal = value; + return this.#xVal; + } + static #y(value) { + this.#yVal = value; + return this.#yVal; + } + static x() { + return this.#x(42); + } + static y() { + return this.#y(43); + } +} + +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, +}); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7"); +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8"); +assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11"); +assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 13"); +assert.sameValue(C.y(), 43, "test 14"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16"); + +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18"); diff --git a/test/language/statements/class/fields-after-same-line-method-static-private-methods.js b/test/language/statements/class/fields-after-same-line-method-static-private-methods.js index afdbfc13c6..1d6cba4280 100644 --- a/test/language/statements/class/fields-after-same-line-method-static-private-methods.js +++ b/test/language/statements/class/fields-after-same-line-method-static-private-methods.js @@ -25,17 +25,15 @@ info: | class C { - m() { return 42; } static #xVal; static #yVal; + m() { return 42; } ; static #x(value) { - this.#xVal = value; - return this.#xVal; + return value / 2; } static #y(value) { - this.#y = value; - return this.#yVal; + return value * 2; } static x() { - return this.#x(42); + return this.#x(84); } static y() { return this.#y(43); @@ -55,18 +53,18 @@ verifyProperty(C.prototype, "m", { }); // Test the private methods do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 1"); -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 2"); -assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 3"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 4"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 5"); -assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 6"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); // Test if private fields can be sucessfully accessed and set to value assert.sameValue(C.x(), 42, "test 7"); -assert.sameValue(C.y(), 43, "test 8"); +assert.sameValue(C.y(), 86, "test 8"); // Test the private fields do not appear as properties before after set to value -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 9"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); 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 index f6d8311611..ee272af5c2 100644 --- 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 @@ -39,41 +39,51 @@ verifyProperty(C, "m", { writable: true, }, {restore: 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: undefined, - enumerable: true, - writable: true, - configurable: 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, "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: undefined, + 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-gen-computed-symbol-names.js b/test/language/statements/class/fields-after-same-line-static-async-gen-computed-symbol-names.js index 6d538d492d..dcbb623ebf 100644 --- 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 @@ -40,35 +40,45 @@ verifyProperty(C, "m", { writable: true, }, {restore: 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.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, 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); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-gen-grammar-privatename-identifier-semantics-stringvalue.js b/test/language/statements/class/fields-after-same-line-static-async-gen-grammar-privatename-identifier-semantics-stringvalue.js index 4193fd5db7..bd780916cc 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-gen-grammar-privatename-identifier-semantics-stringvalue.js +++ b/test/language/statements/class/fields-after-same-line-static-async-gen-grammar-privatename-identifier-semantics-stringvalue.js @@ -98,12 +98,22 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(c.o(1), 1); -assert.sameValue(c.℘(1), 1); -assert.sameValue(c.ZW_‌_NJ(1), 1); -assert.sameValue(c.ZW_‍_J(1), 1); - 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(c.o(1), 1); + assert.sameValue(c.℘(1), 1); + assert.sameValue(c.ZW_‌_NJ(1), 1); + assert.sameValue(c.ZW_‍_J(1), 1); + } + + return Promise.resolve(assertions()); }, $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 index d6dea1573b..23533d37d0 100644 --- 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 @@ -40,38 +40,48 @@ verifyProperty(C, "m", { writable: true, }, {restore: 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.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 + }); + + 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 + }); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-gen-private-names.js b/test/language/statements/class/fields-after-same-line-static-async-gen-private-names.js index 3262f4498c..732c84c1b4 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-gen-private-names.js +++ b/test/language/statements/class/fields-after-same-line-static-async-gen-private-names.js @@ -47,24 +47,34 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -// Test the private fields do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); -assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); -assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); - -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); -assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); -assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); - -// Test if private fields can be sucessfully accessed and set to value -assert.sameValue(c.x(), 42, "test 7"); -assert.sameValue(c.y(), 43, "test 8"); - -// Test the private fields do not appear as properties before after set to value -assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 9"); -assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 10"); - 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') + } + } + // Test the private fields do not appear as properties before set to value + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + + // Test if private fields can be sucessfully accessed and set to value + assert.sameValue(c.x(), 42, "test 7"); + assert.sameValue(c.y(), 43, "test 8"); + + // Test the private fields do not appear as properties before after set to value + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 9"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 10"); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-gen-rs-field-identifier-initializer.js b/test/language/statements/class/fields-after-same-line-static-async-gen-rs-field-identifier-initializer.js index c0d859ba0d..40616dda77 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-gen-rs-field-identifier-initializer.js +++ b/test/language/statements/class/fields-after-same-line-static-async-gen-rs-field-identifier-initializer.js @@ -74,14 +74,24 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(c.$, 1); -assert.sameValue(c._, 1); -assert.sameValue(c.\u{6F}, 1); -assert.sameValue(c.\u2118, 1); -assert.sameValue(c.ZW_\u200C_NJ, 1); -assert.sameValue(c.ZW_\u200D_J, 1); - 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(c.$, 1); + assert.sameValue(c._, 1); + assert.sameValue(c.\u{6F}, 1); + assert.sameValue(c.\u2118, 1); + assert.sameValue(c.ZW_\u200C_NJ, 1); + assert.sameValue(c.ZW_\u200D_J, 1); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-gen-rs-field-identifier.js b/test/language/statements/class/fields-after-same-line-static-async-gen-rs-field-identifier.js index 84fe450313..eb6b0dd387 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-gen-rs-field-identifier.js +++ b/test/language/statements/class/fields-after-same-line-static-async-gen-rs-field-identifier.js @@ -74,21 +74,31 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -c.$ = 1; -c._ = 1; -c.\u{6F} = 1; -c.\u2118 = 1; -c.ZW_\u200C_NJ = 1; -c.ZW_\u200D_J = 1; - -assert.sameValue(c.$, 1); -assert.sameValue(c._, 1); -assert.sameValue(c.\u{6F}, 1); -assert.sameValue(c.\u2118, 1); -assert.sameValue(c.ZW_\u200C_NJ, 1); -assert.sameValue(c.ZW_\u200D_J, 1); - 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') + } + } + c.$ = 1; + c._ = 1; + c.\u{6F} = 1; + c.\u2118 = 1; + c.ZW_\u200C_NJ = 1; + c.ZW_\u200D_J = 1; + + assert.sameValue(c.$, 1); + assert.sameValue(c._, 1); + assert.sameValue(c.\u{6F}, 1); + assert.sameValue(c.\u2118, 1); + assert.sameValue(c.ZW_\u200C_NJ, 1); + assert.sameValue(c.ZW_\u200D_J, 1); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-gen-rs-privatename-identifier-alt.js b/test/language/statements/class/fields-after-same-line-static-async-gen-rs-privatename-identifier-alt.js index 545545a679..b3bad0c17d 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-gen-rs-privatename-identifier-alt.js +++ b/test/language/statements/class/fields-after-same-line-static-async-gen-rs-privatename-identifier-alt.js @@ -95,15 +95,25 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(c.$(1), 1); -assert.sameValue(c._(1), 1); -assert.sameValue(c.\u{6F}(1), 1); -assert.sameValue(c.℘(1), 1); -assert.sameValue(c.ZW_‌_NJ(1), 1); -assert.sameValue(c.ZW_‍_J(1), 1); - - 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(c.$(1), 1); + assert.sameValue(c._(1), 1); + assert.sameValue(c.\u{6F}(1), 1); + assert.sameValue(c.℘(1), 1); + assert.sameValue(c.ZW_‌_NJ(1), 1); + assert.sameValue(c.ZW_‍_J(1), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-gen-rs-privatename-identifier-initializer-alt.js b/test/language/statements/class/fields-after-same-line-static-async-gen-rs-privatename-identifier-initializer-alt.js index 3e40782756..7b6b59504b 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-gen-rs-privatename-identifier-initializer-alt.js +++ b/test/language/statements/class/fields-after-same-line-static-async-gen-rs-privatename-identifier-initializer-alt.js @@ -89,15 +89,25 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(c.$(), 1); -assert.sameValue(c._(), 1); -assert.sameValue(c.\u{6F}(), 1); -assert.sameValue(c.℘(), 1); -assert.sameValue(c.ZW_‌_NJ(), 1); -assert.sameValue(c.ZW_‍_J(), 1); - - 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(c.$(), 1); + assert.sameValue(c._(), 1); + assert.sameValue(c.\u{6F}(), 1); + assert.sameValue(c.℘(), 1); + assert.sameValue(c.ZW_‌_NJ(), 1); + assert.sameValue(c.ZW_‍_J(), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-gen-rs-privatename-identifier-initializer.js b/test/language/statements/class/fields-after-same-line-static-async-gen-rs-privatename-identifier-initializer.js index 0bae129936..8f69917d79 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-gen-rs-privatename-identifier-initializer.js +++ b/test/language/statements/class/fields-after-same-line-static-async-gen-rs-privatename-identifier-initializer.js @@ -89,15 +89,25 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(c.$(), 1); -assert.sameValue(c._(), 1); -assert.sameValue(c.\u{6F}(), 1); -assert.sameValue(c.\u2118(), 1); -assert.sameValue(c.ZW_\u200C_NJ(), 1); -assert.sameValue(c.ZW_\u200D_J(), 1); - - 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(c.$(), 1); + assert.sameValue(c._(), 1); + assert.sameValue(c.\u{6F}(), 1); + assert.sameValue(c.\u2118(), 1); + assert.sameValue(c.ZW_\u200C_NJ(), 1); + assert.sameValue(c.ZW_\u200D_J(), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-gen-rs-privatename-identifier.js b/test/language/statements/class/fields-after-same-line-static-async-gen-rs-privatename-identifier.js index ae07249fe7..6b7dff8d51 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-gen-rs-privatename-identifier.js +++ b/test/language/statements/class/fields-after-same-line-static-async-gen-rs-privatename-identifier.js @@ -95,15 +95,25 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(c.$(1), 1); -assert.sameValue(c._(1), 1); -assert.sameValue(c.\u{6F}(1), 1); -assert.sameValue(c.\u2118(1), 1); -assert.sameValue(c.ZW_\u200C_NJ(1), 1); -assert.sameValue(c.ZW_\u200D_J(1), 1); - - 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(c.$(1), 1); + assert.sameValue(c._(1), 1); + assert.sameValue(c.\u{6F}(1), 1); + assert.sameValue(c.\u2118(1), 1); + assert.sameValue(c.ZW_\u200C_NJ(1), 1); + assert.sameValue(c.ZW_\u200D_J(1), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-async-generator-method-privatename-identifier-alt.js b/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-async-generator-method-privatename-identifier-alt.js index 69a1935680..929ab0f215 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-async-generator-method-privatename-identifier-alt.js +++ b/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-async-generator-method-privatename-identifier-alt.js @@ -61,41 +61,41 @@ info: | class C { - static async *m() { return 42; } static async #$(value) { + static async *m() { return 42; } static async * #$(value) { yield await value; } - static async #_(value) { + static async * #_(value) { yield await value; } - static async #o(value) { + static async * #o(value) { yield await value; } - static async #℘(value) { + static async * #℘(value) { yield await value; } - static async #ZW_‌_NJ(value) { + static async * #ZW_‌_NJ(value) { yield await value; } - static async #ZW_‍_J(value) { + static async * #ZW_‍_J(value) { yield await value; }; - static async $(value) { - yield * await this.#$(value); + static get $() { + return this.#$; } - static async _(value) { - yield * await this.#_(value); + static get _() { + return this.#_; } - static async o(value) { - yield * await this.#o(value); + static get o() { + return this.#o; } - static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } @@ -111,25 +111,35 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -Promise.all([ - C.$(1).next(), - C._(1).next(), - C.o(1).next(), - C.℘(1).next(), // DO NOT CHANGE THE NAME OF THIS FIELD - C.ZW_‌_NJ(1).next(), // DO NOT CHANGE THE NAME OF THIS FIELD - C.ZW_‍_J(1).next(), // DO NOT CHANGE THE NAME OF THIS FIELD -]).then(results => { - - assert.sameValue(results[0].value, 1); - assert.sameValue(results[1].value, 1); - assert.sameValue(results[2].value, 1); - assert.sameValue(results[3].value, 1); - assert.sameValue(results[4].value, 1); - assert.sameValue(results[5].value, 1); - -}, $DONE).then($DONE, $DONE); - 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') + } + } + Promise.all([ + C.$(1).next(), + C._(1).next(), + C.o(1).next(), + C.℘(1).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‌_NJ(1).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‍_J(1).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + ]).then(results => { + + assert.sameValue(results[0].value, 1); + assert.sameValue(results[1].value, 1); + assert.sameValue(results[2].value, 1); + assert.sameValue(results[3].value, 1); + assert.sameValue(results[4].value, 1); + assert.sameValue(results[5].value, 1); + + }, $DONE).then($DONE, $DONE); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-async-generator-method-privatename-identifier.js b/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-async-generator-method-privatename-identifier.js index 34953644e6..cac96c4d83 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-async-generator-method-privatename-identifier.js +++ b/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-async-generator-method-privatename-identifier.js @@ -62,40 +62,40 @@ info: | class C { static async *m() { return 42; } static async * #$(value) { - yield await value; + yield * await value; } static async * #_(value) { - yield await value; + yield * await value; } static async * #\u{6F}(value) { - yield await value; + yield * await value; } static async * #\u2118(value) { - yield await value; + yield * await value; } static async * #ZW_\u200C_NJ(value) { - yield await value; + yield * await value; } static async * #ZW_\u200D_J(value) { - yield await value; + yield * await value; }; - static async * $(value) { - yield * await this.#$(value); + static async * $() { + return this.#$; } - static async * _(value) { - yield * await this.#_(value); + static async * _() { + return this.#_; } - static async * \u{6F}(value) { - yield * await this.#\u{6F}(value); + static async * \u{6F}() { + return this.#\u{6F}; } - static async * \u2118(value) { - yield * await this.#\u2118(value); + static async * \u2118() { + return this.#\u2118; } - static async * ZW_\u200C_NJ(value) { - yield * await this.#ZW_\u200C_NJ(value); + static async * ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static async * ZW_\u200D_J(value) { - yield * await this.#ZW_\u200D_J(value); + static async * ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } @@ -111,26 +111,36 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -Promise.all([ - C.$(1).next(), - C._(1).next(), - C.\u{6F}(1).next(), - C.\u2118(1).next(), - C.ZW_\u200C_NJ(1).next(), - C.ZW_\u200D_J(1).next(), -]).then(results => { - - assert.sameValue(results[0].value, 1); - assert.sameValue(results[1].value, 1); - assert.sameValue(results[2].value, 1); - assert.sameValue(results[3].value, 1); - assert.sameValue(results[4].value, 1); - assert.sameValue(results[5].value, 1); - -}, $DONE).then($DONE, $DONE); - - 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') + } + } + Promise.all([ + C.$(1).next(), + C._(1).next(), + C.\u{6F}(1).next(), + C.\u2118(1).next(), + C.ZW_\u200C_NJ(1).next(), + C.ZW_\u200D_J(1).next(), + ]).then(results => { + + assert.sameValue(results[0].value, 1); + assert.sameValue(results[1].value, 1); + assert.sameValue(results[2].value, 1); + assert.sameValue(results[3].value, 1); + assert.sameValue(results[4].value, 1); + assert.sameValue(results[5].value, 1); + + }, $DONE).then($DONE, $DONE); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-async-method-privatename-identifier-alt.js b/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-async-method-privatename-identifier-alt.js index 894787f2c8..c9b7092ed7 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-async-method-privatename-identifier-alt.js +++ b/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-async-method-privatename-identifier-alt.js @@ -111,25 +111,35 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -Promise.all([ - C.$(1), - C._(1), - C.o(1), - C.℘(1), // DO NOT CHANGE THE NAME OF THIS FIELD - C.ZW_‌_NJ(1), // DO NOT CHANGE THE NAME OF THIS FIELD - C.ZW_‍_J(1), // DO NOT CHANGE THE NAME OF THIS FIELD -]).then(results => { - - assert.sameValue(results[0], 1); - assert.sameValue(results[1], 1); - assert.sameValue(results[2], 1); - assert.sameValue(results[3], 1); - assert.sameValue(results[4], 1); - assert.sameValue(results[5], 1); - -}, $DONE).then($DONE, $DONE); - 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') + } + } + Promise.all([ + C.$(1), + C._(1), + C.o(1), + C.℘(1), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‌_NJ(1), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‍_J(1), // DO NOT CHANGE THE NAME OF THIS FIELD + ]).then(results => { + + assert.sameValue(results[0], 1); + assert.sameValue(results[1], 1); + assert.sameValue(results[2], 1); + assert.sameValue(results[3], 1); + assert.sameValue(results[4], 1); + assert.sameValue(results[5], 1); + + }, $DONE).then($DONE, $DONE); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-async-method-privatename-identifier.js b/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-async-method-privatename-identifier.js index b99a59d829..f3be22f3ad 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-async-method-privatename-identifier.js +++ b/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-async-method-privatename-identifier.js @@ -111,26 +111,36 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -Promise.all([ - C.$(1), - C._(1), - C.\u{6F}(1), - C.\u2118(1), - C.ZW_\u200C_NJ(1), - C.ZW_\u200D_J(1), -]).then(results => { - - assert.sameValue(results[0], 1); - assert.sameValue(results[1], 1); - assert.sameValue(results[2], 1); - assert.sameValue(results[3], 1); - assert.sameValue(results[4], 1); - assert.sameValue(results[5], 1); - -}, $DONE).then($DONE, $DONE); - - 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') + } + } + Promise.all([ + C.$(1), + C._(1), + C.\u{6F}(1), + C.\u2118(1), + C.ZW_\u200C_NJ(1), + C.ZW_\u200D_J(1), + ]).then(results => { + + assert.sameValue(results[0], 1); + assert.sameValue(results[1], 1); + assert.sameValue(results[2], 1); + assert.sameValue(results[3], 1); + assert.sameValue(results[4], 1); + assert.sameValue(results[5], 1); + + }, $DONE).then($DONE, $DONE); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-generator-method-privatename-identifier-alt.js b/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-generator-method-privatename-identifier-alt.js index efb94dcd9f..c3c9c958c3 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-generator-method-privatename-identifier-alt.js +++ b/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-generator-method-privatename-identifier-alt.js @@ -62,40 +62,40 @@ info: | class C { static async *m() { return 42; } static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #o(value) { - yield value; + yield * value; } static * #℘(value) { - yield value; + yield * value; } static * #ZW_‌_NJ(value) { - yield value; + yield * value; } static * #ZW_‍_J(value) { - yield value; + yield * value; }; - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * o(value) { - yield this.#o(value); + static get o() { + return this.#o; } - static * ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static * ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static * ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } @@ -111,14 +111,24 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1).next().value, 1); -assert.sameValue(C._(1).next().value, 1); -assert.sameValue(C.o(1).next().value, 1); -assert.sameValue(C.℘(1).next().value, 1); -assert.sameValue(C.ZW_‌_NJ(1).next().value, 1); -assert.sameValue(C.ZW_‍_J(1).next().value, 1); - 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(C.$(1).next().value, 1); + assert.sameValue(C._(1).next().value, 1); + assert.sameValue(C.o(1).next().value, 1); + assert.sameValue(C.℘(1).next().value, 1); + assert.sameValue(C.ZW_‌_NJ(1).next().value, 1); + assert.sameValue(C.ZW_‍_J(1).next().value, 1); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-generator-method-privatename-identifier.js b/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-generator-method-privatename-identifier.js index e7b11c3084..b8a0a51ea6 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-generator-method-privatename-identifier.js +++ b/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-generator-method-privatename-identifier.js @@ -62,40 +62,40 @@ info: | class C { static async *m() { return 42; } static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #\u{6F}(value) { - yield value; + yield * value; } static * #\u2118(value) { - yield value; + yield * value; } static * #ZW_\u200C_NJ(value) { - yield value; + yield * value; } static * #ZW_\u200D_J(value) { - yield value; + yield * value; }; - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * \u{6F}(value) { - yield this.#\u{6F}(value); + static get \u{6F}() { + return this.#\u{6F}; } - static * \u2118(value) { - yield this.#\u2118(value); + static get \u2118() { + return this.#\u2118; } - static * ZW_\u200C_NJ(value) { - yield this.#ZW_\u200C_NJ(value); + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static * ZW_\u200D_J(value) { - yield this.#ZW_\u200D_J(value); + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } @@ -111,15 +111,25 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1).next().value, 1); -assert.sameValue(C._(1).next().value, 1); -assert.sameValue(C.\u{6F}(1).next().value, 1); -assert.sameValue(C.\u2118(1).next().value, 1); -assert.sameValue(C.ZW_\u200C_NJ(1).next().value, 1); -assert.sameValue(C.ZW_\u200D_J(1).next().value, 1); - - 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(C.$(1).next().value, 1); + assert.sameValue(C._(1).next().value, 1); + assert.sameValue(C.\u{6F}(1).next().value, 1); + assert.sameValue(C.\u2118(1).next().value, 1); + assert.sameValue(C.ZW_\u200C_NJ(1).next().value, 1); + assert.sameValue(C.ZW_\u200D_J(1).next().value, 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-method-privatename-identifier-alt.js b/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-method-privatename-identifier-alt.js index 2f1ced3434..4f9f46333f 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-method-privatename-identifier-alt.js +++ b/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-method-privatename-identifier-alt.js @@ -108,15 +108,25 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1), 1); -assert.sameValue(C._(1), 1); -assert.sameValue(C.o(1), 1); -assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD -assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD -assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD - - 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(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.o(1), 1); + assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-method-privatename-identifier.js b/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-method-privatename-identifier.js index 9bd6795357..cd6c967e8d 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-method-privatename-identifier.js +++ b/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-method-privatename-identifier.js @@ -108,15 +108,25 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1), 1); -assert.sameValue(C._(1), 1); -assert.sameValue(C.\u{6F}(1), 1); -assert.sameValue(C.\u2118(1), 1); -assert.sameValue(C.ZW_\u200C_NJ(1), 1); -assert.sameValue(C.ZW_\u200D_J(1), 1); - - 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(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.\u{6F}(1), 1); + assert.sameValue(C.\u2118(1), 1); + assert.sameValue(C.ZW_\u200C_NJ(1), 1); + assert.sameValue(C.ZW_\u200D_J(1), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier-alt-by-classname.js b/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier-alt-by-classname.js index e0c1b6eac9..45f75f47df 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier-alt-by-classname.js +++ b/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier-alt-by-classname.js @@ -96,15 +96,25 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1), 1); -assert.sameValue(C._(1), 1); -assert.sameValue(C.o(1), 1); -assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD -assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD -assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD - - 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(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.o(1), 1); + assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier-alt.js b/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier-alt.js index 74f43bce35..a1caab2926 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier-alt.js +++ b/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier-alt.js @@ -96,15 +96,25 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1), 1); -assert.sameValue(C._(1), 1); -assert.sameValue(C.o(1), 1); -assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD -assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD -assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD - - 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(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.o(1), 1); + assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier-by-classname.js b/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier-by-classname.js index 27fc914429..c06b603e54 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier-by-classname.js +++ b/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier-by-classname.js @@ -96,15 +96,25 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1), 1); -assert.sameValue(C._(1), 1); -assert.sameValue(C.\u{6F}(1), 1); -assert.sameValue(C.\u2118(1), 1); -assert.sameValue(C.ZW_\u200C_NJ(1), 1); -assert.sameValue(C.ZW_\u200D_J(1), 1); - - 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(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.\u{6F}(1), 1); + assert.sameValue(C.\u2118(1), 1); + assert.sameValue(C.ZW_\u200C_NJ(1), 1); + assert.sameValue(C.ZW_\u200D_J(1), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js b/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js index caeb85e57e..2efd42533b 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js +++ b/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js @@ -90,15 +90,25 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(), 1); -assert.sameValue(C._(), 1); -assert.sameValue(C.\u{6F}(), 1); -assert.sameValue(C.℘(), 1); -assert.sameValue(C.ZW_‌_NJ(), 1); -assert.sameValue(C.ZW_‍_J(), 1); - - 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(C.$(), 1); + assert.sameValue(C._(), 1); + assert.sameValue(C.\u{6F}(), 1); + assert.sameValue(C.℘(), 1); + assert.sameValue(C.ZW_‌_NJ(), 1); + assert.sameValue(C.ZW_‍_J(), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier-initializer-alt.js b/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier-initializer-alt.js index 5e596a3b25..2be74590f1 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier-initializer-alt.js +++ b/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier-initializer-alt.js @@ -90,15 +90,25 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(), 1); -assert.sameValue(C._(), 1); -assert.sameValue(C.\u{6F}(), 1); -assert.sameValue(C.℘(), 1); -assert.sameValue(C.ZW_‌_NJ(), 1); -assert.sameValue(C.ZW_‍_J(), 1); - - 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(C.$(), 1); + assert.sameValue(C._(), 1); + assert.sameValue(C.\u{6F}(), 1); + assert.sameValue(C.℘(), 1); + assert.sameValue(C.ZW_‌_NJ(), 1); + assert.sameValue(C.ZW_‍_J(), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier-initializer.js b/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier-initializer.js index b1ae4c245b..58aea799e8 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier-initializer.js +++ b/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier-initializer.js @@ -90,15 +90,25 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(), 1); -assert.sameValue(C._(), 1); -assert.sameValue(C.\u{6F}(), 1); -assert.sameValue(C.\u2118(), 1); -assert.sameValue(C.ZW_\u200C_NJ(), 1); -assert.sameValue(C.ZW_\u200D_J(), 1); - - 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(C.$(), 1); + assert.sameValue(C._(), 1); + assert.sameValue(C.\u{6F}(), 1); + assert.sameValue(C.\u2118(), 1); + assert.sameValue(C.ZW_\u200C_NJ(), 1); + assert.sameValue(C.ZW_\u200D_J(), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier.js b/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier.js index 1859796b85..112aa8349a 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier.js +++ b/test/language/statements/class/fields-after-same-line-static-async-gen-rs-static-privatename-identifier.js @@ -96,15 +96,25 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1), 1); -assert.sameValue(C._(1), 1); -assert.sameValue(C.\u{6F}(1), 1); -assert.sameValue(C.\u2118(1), 1); -assert.sameValue(C.ZW_\u200C_NJ(1), 1); -assert.sameValue(C.ZW_\u200D_J(1), 1); - - 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(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.\u{6F}(1), 1); + assert.sameValue(C.\u2118(1), 1); + assert.sameValue(C.ZW_\u200C_NJ(1), 1); + assert.sameValue(C.ZW_\u200D_J(1), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-gen-static-private-fields.js b/test/language/statements/class/fields-after-same-line-static-async-gen-static-private-fields.js index 2e337619da..9fb60f084c 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-gen-static-private-fields.js +++ b/test/language/statements/class/fields-after-same-line-static-async-gen-static-private-fields.js @@ -47,24 +47,34 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -// Test the private fields do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); -assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); -assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); - -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); -assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); -assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); - -// Test if private fields can be sucessfully accessed and set to value -assert.sameValue(C.x(), 42, "test 7"); -assert.sameValue(C.y(), 43, "test 8"); - -// Test the private fields do not appear as properties before after set to value -assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); -assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); - 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') + } + } + // Test the private fields do not appear as properties before set to value + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + + // Test if private fields can be sucessfully accessed and set to value + assert.sameValue(C.x(), 42, "test 7"); + assert.sameValue(C.y(), 43, "test 8"); + + // Test the private fields do not appear as properties before after set to value + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-gen-static-private-methods-with-fields.js b/test/language/statements/class/fields-after-same-line-static-async-gen-static-private-methods-with-fields.js new file mode 100644 index 0000000000..299d20e566 --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-static-async-gen-static-private-methods-with-fields.js @@ -0,0 +1,98 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-private-methods-with-fields.case +// - src/class-fields/productions/cls-decl-after-same-line-static-async-gen.template +/*--- +description: static private methods with fields (field definitions after a static async generator in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public, + async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +class C { + static async *m() { return 42; } static #xVal; static #yVal; + static #x(value) { + this.#xVal = value; + return this.#xVal; + } + static #y(value) { + this.#yVal = value; + return this.#yVal; + } + static x() { + return this.#x(42); + } + static y() { + return this.#y(43); + } +} + +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') + } + } + // Test the private methods do not appear as properties before set to value + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7"); + assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8"); + assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10"); + assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11"); + assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12"); + + // Test if private fields can be sucessfully accessed and set to value + assert.sameValue(C.x(), 42, "test 13"); + assert.sameValue(C.y(), 43, "test 14"); + + // Test the private fields do not appear as properties before after set to value + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16"); + + assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17"); + assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18"); + } + + return Promise.resolve(assertions()); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-gen-static-private-methods.js b/test/language/statements/class/fields-after-same-line-static-async-gen-static-private-methods.js index fb473a75a7..b85c107081 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-gen-static-private-methods.js +++ b/test/language/statements/class/fields-after-same-line-static-async-gen-static-private-methods.js @@ -25,17 +25,15 @@ info: | class C { - static async *m() { return 42; } static #xVal; static #yVal; + static async *m() { return 42; } ; static #x(value) { - this.#xVal = value; - return this.#xVal; + return value / 2; } static #y(value) { - this.#y = value; - return this.#yVal; + return value * 2; } static x() { - return this.#x(42); + return this.#x(84); } static y() { return this.#y(43); @@ -53,24 +51,34 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -// Test the private methods do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 1"); -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 2"); -assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 3"); - -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 4"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 5"); -assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 6"); - -// Test if private fields can be sucessfully accessed and set to value -assert.sameValue(C.x(), 42, "test 7"); -assert.sameValue(C.y(), 43, "test 8"); - -// Test the private fields do not appear as properties before after set to value -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 9"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 10"); - 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') + } + } + // Test the private methods do not appear as properties before set to value + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + + // Test if private fields can be sucessfully accessed and set to value + assert.sameValue(C.x(), 42, "test 7"); + assert.sameValue(C.y(), 86, "test 8"); + + // Test the private fields do not appear as properties before after set to value + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); + } + + return Promise.resolve(assertions()); }, $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 index 6b8d8536d3..54f379f589 100644 --- 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 @@ -38,47 +38,57 @@ verifyProperty(C, "m", { writable: true, }, {restore: 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: undefined, - 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: 39, - enumerable: true, - writable: true, - configurable: true -}); - -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "d"), false); -assert.sameValue(Object.hasOwnProperty.call(C, "d"), false); - -verifyProperty(c, "d", { - value: 42, - enumerable: true, - writable: true, - configurable: 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: undefined, + 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: 39, + enumerable: true, + writable: true, + configurable: true + }); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "d"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "d"), false); + + verifyProperty(c, "d", { + 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-computed-names.js b/test/language/statements/class/fields-after-same-line-static-async-method-computed-names.js index e628b3ac56..ac3c2270cf 100644 --- 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 @@ -39,40 +39,50 @@ verifyProperty(C, "m", { writable: true, }, {restore: 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: undefined, - enumerable: true, - writable: true, - configurable: 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, "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: undefined, + 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-computed-symbol-names.js b/test/language/statements/class/fields-after-same-line-static-async-method-computed-symbol-names.js index ebb19a426f..330995b9fc 100644 --- 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 @@ -40,34 +40,44 @@ verifyProperty(C, "m", { writable: true, }, {restore: 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); + + 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, 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); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-method-grammar-privatename-identifier-semantics-stringvalue.js b/test/language/statements/class/fields-after-same-line-static-async-method-grammar-privatename-identifier-semantics-stringvalue.js index e4b1f887e2..dd4e7b0778 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-method-grammar-privatename-identifier-semantics-stringvalue.js +++ b/test/language/statements/class/fields-after-same-line-static-async-method-grammar-privatename-identifier-semantics-stringvalue.js @@ -98,11 +98,21 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(c.o(1), 1); -assert.sameValue(c.℘(1), 1); -assert.sameValue(c.ZW_‌_NJ(1), 1); -assert.sameValue(c.ZW_‍_J(1), 1); - 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(c.o(1), 1); + assert.sameValue(c.℘(1), 1); + assert.sameValue(c.ZW_‌_NJ(1), 1); + assert.sameValue(c.ZW_‍_J(1), 1); + } + + return Promise.resolve(assertions()); }, $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 index 6593a6c52a..909e4787be 100644 --- 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 @@ -40,37 +40,47 @@ verifyProperty(C, "m", { writable: true, }, {restore: 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); + + 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 + }); + + 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 + }); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-method-private-names.js b/test/language/statements/class/fields-after-same-line-static-async-method-private-names.js index f37ea74df6..5562be772b 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-method-private-names.js +++ b/test/language/statements/class/fields-after-same-line-static-async-method-private-names.js @@ -47,23 +47,33 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -// Test the private fields do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); -assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); -assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); - -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); -assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); -assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); - -// Test if private fields can be sucessfully accessed and set to value -assert.sameValue(c.x(), 42, "test 7"); -assert.sameValue(c.y(), 43, "test 8"); - -// Test the private fields do not appear as properties before after set to value -assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 9"); -assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 10"); - 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') + } + } + // Test the private fields do not appear as properties before set to value + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + + // Test if private fields can be sucessfully accessed and set to value + assert.sameValue(c.x(), 42, "test 7"); + assert.sameValue(c.y(), 43, "test 8"); + + // Test the private fields do not appear as properties before after set to value + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 9"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 10"); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-method-rs-field-identifier-initializer.js b/test/language/statements/class/fields-after-same-line-static-async-method-rs-field-identifier-initializer.js index ccc54913a7..3c3a4e3a49 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-method-rs-field-identifier-initializer.js +++ b/test/language/statements/class/fields-after-same-line-static-async-method-rs-field-identifier-initializer.js @@ -74,13 +74,23 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(c.$, 1); -assert.sameValue(c._, 1); -assert.sameValue(c.\u{6F}, 1); -assert.sameValue(c.\u2118, 1); -assert.sameValue(c.ZW_\u200C_NJ, 1); -assert.sameValue(c.ZW_\u200D_J, 1); - 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(c.$, 1); + assert.sameValue(c._, 1); + assert.sameValue(c.\u{6F}, 1); + assert.sameValue(c.\u2118, 1); + assert.sameValue(c.ZW_\u200C_NJ, 1); + assert.sameValue(c.ZW_\u200D_J, 1); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-method-rs-field-identifier.js b/test/language/statements/class/fields-after-same-line-static-async-method-rs-field-identifier.js index 2fbf002c49..f6af541db4 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-method-rs-field-identifier.js +++ b/test/language/statements/class/fields-after-same-line-static-async-method-rs-field-identifier.js @@ -74,20 +74,30 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -c.$ = 1; -c._ = 1; -c.\u{6F} = 1; -c.\u2118 = 1; -c.ZW_\u200C_NJ = 1; -c.ZW_\u200D_J = 1; - -assert.sameValue(c.$, 1); -assert.sameValue(c._, 1); -assert.sameValue(c.\u{6F}, 1); -assert.sameValue(c.\u2118, 1); -assert.sameValue(c.ZW_\u200C_NJ, 1); -assert.sameValue(c.ZW_\u200D_J, 1); - 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') + } + } + c.$ = 1; + c._ = 1; + c.\u{6F} = 1; + c.\u2118 = 1; + c.ZW_\u200C_NJ = 1; + c.ZW_\u200D_J = 1; + + assert.sameValue(c.$, 1); + assert.sameValue(c._, 1); + assert.sameValue(c.\u{6F}, 1); + assert.sameValue(c.\u2118, 1); + assert.sameValue(c.ZW_\u200C_NJ, 1); + assert.sameValue(c.ZW_\u200D_J, 1); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-method-rs-privatename-identifier-alt.js b/test/language/statements/class/fields-after-same-line-static-async-method-rs-privatename-identifier-alt.js index eb06ab96dd..9b308dd2a1 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-method-rs-privatename-identifier-alt.js +++ b/test/language/statements/class/fields-after-same-line-static-async-method-rs-privatename-identifier-alt.js @@ -95,14 +95,24 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(c.$(1), 1); -assert.sameValue(c._(1), 1); -assert.sameValue(c.\u{6F}(1), 1); -assert.sameValue(c.℘(1), 1); -assert.sameValue(c.ZW_‌_NJ(1), 1); -assert.sameValue(c.ZW_‍_J(1), 1); - - 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(c.$(1), 1); + assert.sameValue(c._(1), 1); + assert.sameValue(c.\u{6F}(1), 1); + assert.sameValue(c.℘(1), 1); + assert.sameValue(c.ZW_‌_NJ(1), 1); + assert.sameValue(c.ZW_‍_J(1), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-method-rs-privatename-identifier-initializer-alt.js b/test/language/statements/class/fields-after-same-line-static-async-method-rs-privatename-identifier-initializer-alt.js index 6ac29798eb..77d3e9e6f0 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-method-rs-privatename-identifier-initializer-alt.js +++ b/test/language/statements/class/fields-after-same-line-static-async-method-rs-privatename-identifier-initializer-alt.js @@ -89,14 +89,24 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(c.$(), 1); -assert.sameValue(c._(), 1); -assert.sameValue(c.\u{6F}(), 1); -assert.sameValue(c.℘(), 1); -assert.sameValue(c.ZW_‌_NJ(), 1); -assert.sameValue(c.ZW_‍_J(), 1); - - 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(c.$(), 1); + assert.sameValue(c._(), 1); + assert.sameValue(c.\u{6F}(), 1); + assert.sameValue(c.℘(), 1); + assert.sameValue(c.ZW_‌_NJ(), 1); + assert.sameValue(c.ZW_‍_J(), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-method-rs-privatename-identifier-initializer.js b/test/language/statements/class/fields-after-same-line-static-async-method-rs-privatename-identifier-initializer.js index 4a717a34d0..30c955d44d 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-method-rs-privatename-identifier-initializer.js +++ b/test/language/statements/class/fields-after-same-line-static-async-method-rs-privatename-identifier-initializer.js @@ -89,14 +89,24 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(c.$(), 1); -assert.sameValue(c._(), 1); -assert.sameValue(c.\u{6F}(), 1); -assert.sameValue(c.\u2118(), 1); -assert.sameValue(c.ZW_\u200C_NJ(), 1); -assert.sameValue(c.ZW_\u200D_J(), 1); - - 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(c.$(), 1); + assert.sameValue(c._(), 1); + assert.sameValue(c.\u{6F}(), 1); + assert.sameValue(c.\u2118(), 1); + assert.sameValue(c.ZW_\u200C_NJ(), 1); + assert.sameValue(c.ZW_\u200D_J(), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-method-rs-privatename-identifier.js b/test/language/statements/class/fields-after-same-line-static-async-method-rs-privatename-identifier.js index 456a141c7a..61f1349e4d 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-method-rs-privatename-identifier.js +++ b/test/language/statements/class/fields-after-same-line-static-async-method-rs-privatename-identifier.js @@ -95,14 +95,24 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(c.$(1), 1); -assert.sameValue(c._(1), 1); -assert.sameValue(c.\u{6F}(1), 1); -assert.sameValue(c.\u2118(1), 1); -assert.sameValue(c.ZW_\u200C_NJ(1), 1); -assert.sameValue(c.ZW_\u200D_J(1), 1); - - 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(c.$(1), 1); + assert.sameValue(c._(1), 1); + assert.sameValue(c.\u{6F}(1), 1); + assert.sameValue(c.\u2118(1), 1); + assert.sameValue(c.ZW_\u200C_NJ(1), 1); + assert.sameValue(c.ZW_\u200D_J(1), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-async-generator-method-privatename-identifier-alt.js b/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-async-generator-method-privatename-identifier-alt.js index 2ae364efaf..423b2460d2 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-async-generator-method-privatename-identifier-alt.js +++ b/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-async-generator-method-privatename-identifier-alt.js @@ -61,41 +61,41 @@ info: | class C { - static async m() { return 42; } static async #$(value) { + static async m() { return 42; } static async * #$(value) { yield await value; } - static async #_(value) { + static async * #_(value) { yield await value; } - static async #o(value) { + static async * #o(value) { yield await value; } - static async #℘(value) { + static async * #℘(value) { yield await value; } - static async #ZW_‌_NJ(value) { + static async * #ZW_‌_NJ(value) { yield await value; } - static async #ZW_‍_J(value) { + static async * #ZW_‍_J(value) { yield await value; }; - static async $(value) { - yield * await this.#$(value); + static get $() { + return this.#$; } - static async _(value) { - yield * await this.#_(value); + static get _() { + return this.#_; } - static async o(value) { - yield * await this.#o(value); + static get o() { + return this.#o; } - static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } @@ -111,24 +111,34 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -Promise.all([ - C.$(1).next(), - C._(1).next(), - C.o(1).next(), - C.℘(1).next(), // DO NOT CHANGE THE NAME OF THIS FIELD - C.ZW_‌_NJ(1).next(), // DO NOT CHANGE THE NAME OF THIS FIELD - C.ZW_‍_J(1).next(), // DO NOT CHANGE THE NAME OF THIS FIELD -]).then(results => { - - assert.sameValue(results[0].value, 1); - assert.sameValue(results[1].value, 1); - assert.sameValue(results[2].value, 1); - assert.sameValue(results[3].value, 1); - assert.sameValue(results[4].value, 1); - assert.sameValue(results[5].value, 1); - -}, $DONE).then($DONE, $DONE); - 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') + } + } + Promise.all([ + C.$(1).next(), + C._(1).next(), + C.o(1).next(), + C.℘(1).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‌_NJ(1).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‍_J(1).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + ]).then(results => { + + assert.sameValue(results[0].value, 1); + assert.sameValue(results[1].value, 1); + assert.sameValue(results[2].value, 1); + assert.sameValue(results[3].value, 1); + assert.sameValue(results[4].value, 1); + assert.sameValue(results[5].value, 1); + + }, $DONE).then($DONE, $DONE); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-async-generator-method-privatename-identifier.js b/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-async-generator-method-privatename-identifier.js index 7a20229408..bc70b593d5 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-async-generator-method-privatename-identifier.js +++ b/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-async-generator-method-privatename-identifier.js @@ -62,40 +62,40 @@ info: | class C { static async m() { return 42; } static async * #$(value) { - yield await value; + yield * await value; } static async * #_(value) { - yield await value; + yield * await value; } static async * #\u{6F}(value) { - yield await value; + yield * await value; } static async * #\u2118(value) { - yield await value; + yield * await value; } static async * #ZW_\u200C_NJ(value) { - yield await value; + yield * await value; } static async * #ZW_\u200D_J(value) { - yield await value; + yield * await value; }; - static async * $(value) { - yield * await this.#$(value); + static async * $() { + return this.#$; } - static async * _(value) { - yield * await this.#_(value); + static async * _() { + return this.#_; } - static async * \u{6F}(value) { - yield * await this.#\u{6F}(value); + static async * \u{6F}() { + return this.#\u{6F}; } - static async * \u2118(value) { - yield * await this.#\u2118(value); + static async * \u2118() { + return this.#\u2118; } - static async * ZW_\u200C_NJ(value) { - yield * await this.#ZW_\u200C_NJ(value); + static async * ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static async * ZW_\u200D_J(value) { - yield * await this.#ZW_\u200D_J(value); + static async * ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } @@ -111,25 +111,35 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -Promise.all([ - C.$(1).next(), - C._(1).next(), - C.\u{6F}(1).next(), - C.\u2118(1).next(), - C.ZW_\u200C_NJ(1).next(), - C.ZW_\u200D_J(1).next(), -]).then(results => { - - assert.sameValue(results[0].value, 1); - assert.sameValue(results[1].value, 1); - assert.sameValue(results[2].value, 1); - assert.sameValue(results[3].value, 1); - assert.sameValue(results[4].value, 1); - assert.sameValue(results[5].value, 1); - -}, $DONE).then($DONE, $DONE); - - 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') + } + } + Promise.all([ + C.$(1).next(), + C._(1).next(), + C.\u{6F}(1).next(), + C.\u2118(1).next(), + C.ZW_\u200C_NJ(1).next(), + C.ZW_\u200D_J(1).next(), + ]).then(results => { + + assert.sameValue(results[0].value, 1); + assert.sameValue(results[1].value, 1); + assert.sameValue(results[2].value, 1); + assert.sameValue(results[3].value, 1); + assert.sameValue(results[4].value, 1); + assert.sameValue(results[5].value, 1); + + }, $DONE).then($DONE, $DONE); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-async-method-privatename-identifier-alt.js b/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-async-method-privatename-identifier-alt.js index cd55d42a01..7e15960948 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-async-method-privatename-identifier-alt.js +++ b/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-async-method-privatename-identifier-alt.js @@ -111,24 +111,34 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -Promise.all([ - C.$(1), - C._(1), - C.o(1), - C.℘(1), // DO NOT CHANGE THE NAME OF THIS FIELD - C.ZW_‌_NJ(1), // DO NOT CHANGE THE NAME OF THIS FIELD - C.ZW_‍_J(1), // DO NOT CHANGE THE NAME OF THIS FIELD -]).then(results => { - - assert.sameValue(results[0], 1); - assert.sameValue(results[1], 1); - assert.sameValue(results[2], 1); - assert.sameValue(results[3], 1); - assert.sameValue(results[4], 1); - assert.sameValue(results[5], 1); - -}, $DONE).then($DONE, $DONE); - 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') + } + } + Promise.all([ + C.$(1), + C._(1), + C.o(1), + C.℘(1), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‌_NJ(1), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‍_J(1), // DO NOT CHANGE THE NAME OF THIS FIELD + ]).then(results => { + + assert.sameValue(results[0], 1); + assert.sameValue(results[1], 1); + assert.sameValue(results[2], 1); + assert.sameValue(results[3], 1); + assert.sameValue(results[4], 1); + assert.sameValue(results[5], 1); + + }, $DONE).then($DONE, $DONE); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-async-method-privatename-identifier.js b/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-async-method-privatename-identifier.js index 8723f43953..60781e46e3 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-async-method-privatename-identifier.js +++ b/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-async-method-privatename-identifier.js @@ -111,25 +111,35 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -Promise.all([ - C.$(1), - C._(1), - C.\u{6F}(1), - C.\u2118(1), - C.ZW_\u200C_NJ(1), - C.ZW_\u200D_J(1), -]).then(results => { - - assert.sameValue(results[0], 1); - assert.sameValue(results[1], 1); - assert.sameValue(results[2], 1); - assert.sameValue(results[3], 1); - assert.sameValue(results[4], 1); - assert.sameValue(results[5], 1); - -}, $DONE).then($DONE, $DONE); - - 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') + } + } + Promise.all([ + C.$(1), + C._(1), + C.\u{6F}(1), + C.\u2118(1), + C.ZW_\u200C_NJ(1), + C.ZW_\u200D_J(1), + ]).then(results => { + + assert.sameValue(results[0], 1); + assert.sameValue(results[1], 1); + assert.sameValue(results[2], 1); + assert.sameValue(results[3], 1); + assert.sameValue(results[4], 1); + assert.sameValue(results[5], 1); + + }, $DONE).then($DONE, $DONE); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-generator-method-privatename-identifier-alt.js b/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-generator-method-privatename-identifier-alt.js index f8b8fbb120..b6e85b8bfc 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-generator-method-privatename-identifier-alt.js +++ b/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-generator-method-privatename-identifier-alt.js @@ -62,40 +62,40 @@ info: | class C { static async m() { return 42; } static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #o(value) { - yield value; + yield * value; } static * #℘(value) { - yield value; + yield * value; } static * #ZW_‌_NJ(value) { - yield value; + yield * value; } static * #ZW_‍_J(value) { - yield value; + yield * value; }; - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * o(value) { - yield this.#o(value); + static get o() { + return this.#o; } - static * ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static * ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static * ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } @@ -111,13 +111,23 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1).next().value, 1); -assert.sameValue(C._(1).next().value, 1); -assert.sameValue(C.o(1).next().value, 1); -assert.sameValue(C.℘(1).next().value, 1); -assert.sameValue(C.ZW_‌_NJ(1).next().value, 1); -assert.sameValue(C.ZW_‍_J(1).next().value, 1); - 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(C.$(1).next().value, 1); + assert.sameValue(C._(1).next().value, 1); + assert.sameValue(C.o(1).next().value, 1); + assert.sameValue(C.℘(1).next().value, 1); + assert.sameValue(C.ZW_‌_NJ(1).next().value, 1); + assert.sameValue(C.ZW_‍_J(1).next().value, 1); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-generator-method-privatename-identifier.js b/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-generator-method-privatename-identifier.js index eaa3d8e082..204363818c 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-generator-method-privatename-identifier.js +++ b/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-generator-method-privatename-identifier.js @@ -62,40 +62,40 @@ info: | class C { static async m() { return 42; } static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #\u{6F}(value) { - yield value; + yield * value; } static * #\u2118(value) { - yield value; + yield * value; } static * #ZW_\u200C_NJ(value) { - yield value; + yield * value; } static * #ZW_\u200D_J(value) { - yield value; + yield * value; }; - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * \u{6F}(value) { - yield this.#\u{6F}(value); + static get \u{6F}() { + return this.#\u{6F}; } - static * \u2118(value) { - yield this.#\u2118(value); + static get \u2118() { + return this.#\u2118; } - static * ZW_\u200C_NJ(value) { - yield this.#ZW_\u200C_NJ(value); + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static * ZW_\u200D_J(value) { - yield this.#ZW_\u200D_J(value); + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } @@ -111,14 +111,24 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1).next().value, 1); -assert.sameValue(C._(1).next().value, 1); -assert.sameValue(C.\u{6F}(1).next().value, 1); -assert.sameValue(C.\u2118(1).next().value, 1); -assert.sameValue(C.ZW_\u200C_NJ(1).next().value, 1); -assert.sameValue(C.ZW_\u200D_J(1).next().value, 1); - - 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(C.$(1).next().value, 1); + assert.sameValue(C._(1).next().value, 1); + assert.sameValue(C.\u{6F}(1).next().value, 1); + assert.sameValue(C.\u2118(1).next().value, 1); + assert.sameValue(C.ZW_\u200C_NJ(1).next().value, 1); + assert.sameValue(C.ZW_\u200D_J(1).next().value, 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-method-privatename-identifier-alt.js b/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-method-privatename-identifier-alt.js index a47214d972..db82dc2e67 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-method-privatename-identifier-alt.js +++ b/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-method-privatename-identifier-alt.js @@ -108,14 +108,24 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1), 1); -assert.sameValue(C._(1), 1); -assert.sameValue(C.o(1), 1); -assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD -assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD -assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD - - 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(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.o(1), 1); + assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-method-privatename-identifier.js b/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-method-privatename-identifier.js index 5519040ed4..32f0f982b8 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-method-privatename-identifier.js +++ b/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-method-privatename-identifier.js @@ -108,14 +108,24 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1), 1); -assert.sameValue(C._(1), 1); -assert.sameValue(C.\u{6F}(1), 1); -assert.sameValue(C.\u2118(1), 1); -assert.sameValue(C.ZW_\u200C_NJ(1), 1); -assert.sameValue(C.ZW_\u200D_J(1), 1); - - 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(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.\u{6F}(1), 1); + assert.sameValue(C.\u2118(1), 1); + assert.sameValue(C.ZW_\u200C_NJ(1), 1); + assert.sameValue(C.ZW_\u200D_J(1), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier-alt-by-classname.js b/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier-alt-by-classname.js index 424a78f852..9caeb56475 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier-alt-by-classname.js +++ b/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier-alt-by-classname.js @@ -96,14 +96,24 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1), 1); -assert.sameValue(C._(1), 1); -assert.sameValue(C.o(1), 1); -assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD -assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD -assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD - - 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(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.o(1), 1); + assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier-alt.js b/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier-alt.js index 8b3699533c..c7818f8c11 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier-alt.js +++ b/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier-alt.js @@ -96,14 +96,24 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1), 1); -assert.sameValue(C._(1), 1); -assert.sameValue(C.o(1), 1); -assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD -assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD -assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD - - 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(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.o(1), 1); + assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier-by-classname.js b/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier-by-classname.js index 7a9b92ba26..2ce91412d6 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier-by-classname.js +++ b/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier-by-classname.js @@ -96,14 +96,24 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1), 1); -assert.sameValue(C._(1), 1); -assert.sameValue(C.\u{6F}(1), 1); -assert.sameValue(C.\u2118(1), 1); -assert.sameValue(C.ZW_\u200C_NJ(1), 1); -assert.sameValue(C.ZW_\u200D_J(1), 1); - - 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(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.\u{6F}(1), 1); + assert.sameValue(C.\u2118(1), 1); + assert.sameValue(C.ZW_\u200C_NJ(1), 1); + assert.sameValue(C.ZW_\u200D_J(1), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier-initializer-alt-by-classname.js b/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier-initializer-alt-by-classname.js index 883090c625..5ccfeca611 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier-initializer-alt-by-classname.js +++ b/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier-initializer-alt-by-classname.js @@ -90,14 +90,24 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(), 1); -assert.sameValue(C._(), 1); -assert.sameValue(C.\u{6F}(), 1); -assert.sameValue(C.℘(), 1); -assert.sameValue(C.ZW_‌_NJ(), 1); -assert.sameValue(C.ZW_‍_J(), 1); - - 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(C.$(), 1); + assert.sameValue(C._(), 1); + assert.sameValue(C.\u{6F}(), 1); + assert.sameValue(C.℘(), 1); + assert.sameValue(C.ZW_‌_NJ(), 1); + assert.sameValue(C.ZW_‍_J(), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier-initializer-alt.js b/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier-initializer-alt.js index f290fda1c2..05261823de 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier-initializer-alt.js +++ b/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier-initializer-alt.js @@ -90,14 +90,24 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(), 1); -assert.sameValue(C._(), 1); -assert.sameValue(C.\u{6F}(), 1); -assert.sameValue(C.℘(), 1); -assert.sameValue(C.ZW_‌_NJ(), 1); -assert.sameValue(C.ZW_‍_J(), 1); - - 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(C.$(), 1); + assert.sameValue(C._(), 1); + assert.sameValue(C.\u{6F}(), 1); + assert.sameValue(C.℘(), 1); + assert.sameValue(C.ZW_‌_NJ(), 1); + assert.sameValue(C.ZW_‍_J(), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier-initializer.js b/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier-initializer.js index ea5be51cc4..fdf2aabb54 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier-initializer.js +++ b/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier-initializer.js @@ -90,14 +90,24 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(), 1); -assert.sameValue(C._(), 1); -assert.sameValue(C.\u{6F}(), 1); -assert.sameValue(C.\u2118(), 1); -assert.sameValue(C.ZW_\u200C_NJ(), 1); -assert.sameValue(C.ZW_\u200D_J(), 1); - - 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(C.$(), 1); + assert.sameValue(C._(), 1); + assert.sameValue(C.\u{6F}(), 1); + assert.sameValue(C.\u2118(), 1); + assert.sameValue(C.ZW_\u200C_NJ(), 1); + assert.sameValue(C.ZW_\u200D_J(), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier.js b/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier.js index bbf4349800..7ec3da6d46 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier.js +++ b/test/language/statements/class/fields-after-same-line-static-async-method-rs-static-privatename-identifier.js @@ -96,14 +96,24 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1), 1); -assert.sameValue(C._(1), 1); -assert.sameValue(C.\u{6F}(1), 1); -assert.sameValue(C.\u2118(1), 1); -assert.sameValue(C.ZW_\u200C_NJ(1), 1); -assert.sameValue(C.ZW_\u200D_J(1), 1); - - 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(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.\u{6F}(1), 1); + assert.sameValue(C.\u2118(1), 1); + assert.sameValue(C.ZW_\u200C_NJ(1), 1); + assert.sameValue(C.ZW_\u200D_J(1), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-method-static-private-fields.js b/test/language/statements/class/fields-after-same-line-static-async-method-static-private-fields.js index e77b50da51..16407a7f3f 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-method-static-private-fields.js +++ b/test/language/statements/class/fields-after-same-line-static-async-method-static-private-fields.js @@ -47,23 +47,33 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -// Test the private fields do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); -assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); -assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); - -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); -assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); -assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); - -// Test if private fields can be sucessfully accessed and set to value -assert.sameValue(C.x(), 42, "test 7"); -assert.sameValue(C.y(), 43, "test 8"); - -// Test the private fields do not appear as properties before after set to value -assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); -assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); - 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') + } + } + // Test the private fields do not appear as properties before set to value + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + + // Test if private fields can be sucessfully accessed and set to value + assert.sameValue(C.x(), 42, "test 7"); + assert.sameValue(C.y(), 43, "test 8"); + + // Test the private fields do not appear as properties before after set to value + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-method-static-private-methods-with-fields.js b/test/language/statements/class/fields-after-same-line-static-async-method-static-private-methods-with-fields.js new file mode 100644 index 0000000000..fe2388d05e --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-static-async-method-static-private-methods-with-fields.js @@ -0,0 +1,97 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-private-methods-with-fields.case +// - src/class-fields/productions/cls-decl-after-same-line-static-async-method.template +/*--- +description: static private methods with fields (field definitions after a static async method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public, + async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +class C { + static async m() { return 42; } static #xVal; static #yVal; + static #x(value) { + this.#xVal = value; + return this.#xVal; + } + static #y(value) { + this.#yVal = value; + return this.#yVal; + } + static x() { + return this.#x(42); + } + static y() { + return this.#y(43); + } +} + +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') + } + } + // Test the private methods do not appear as properties before set to value + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7"); + assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8"); + assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10"); + assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11"); + assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12"); + + // Test if private fields can be sucessfully accessed and set to value + assert.sameValue(C.x(), 42, "test 13"); + assert.sameValue(C.y(), 43, "test 14"); + + // Test the private fields do not appear as properties before after set to value + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16"); + + assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17"); + assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18"); + } + + return Promise.resolve(assertions()); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-after-same-line-static-async-method-static-private-methods.js b/test/language/statements/class/fields-after-same-line-static-async-method-static-private-methods.js index 755b850bd1..43c40f9713 100644 --- a/test/language/statements/class/fields-after-same-line-static-async-method-static-private-methods.js +++ b/test/language/statements/class/fields-after-same-line-static-async-method-static-private-methods.js @@ -25,17 +25,15 @@ info: | class C { - static async m() { return 42; } static #xVal; static #yVal; + static async m() { return 42; } ; static #x(value) { - this.#xVal = value; - return this.#xVal; + return value / 2; } static #y(value) { - this.#y = value; - return this.#yVal; + return value * 2; } static x() { - return this.#x(42); + return this.#x(84); } static y() { return this.#y(43); @@ -53,23 +51,33 @@ verifyProperty(C, "m", { writable: true, }, {restore: true}); -// Test the private methods do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 1"); -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 2"); -assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 3"); - -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 4"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 5"); -assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 6"); - -// Test if private fields can be sucessfully accessed and set to value -assert.sameValue(C.x(), 42, "test 7"); -assert.sameValue(C.y(), 43, "test 8"); - -// Test the private fields do not appear as properties before after set to value -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 9"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 10"); - 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') + } + } + // Test the private methods do not appear as properties before set to value + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + + // Test if private fields can be sucessfully accessed and set to value + assert.sameValue(C.x(), 42, "test 7"); + assert.sameValue(C.y(), 86, "test 8"); + + // Test the private fields do not appear as properties before after set to value + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); + } + + return Promise.resolve(assertions()); }, $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 index 4ff9e092a8..17b011aea6 100644 --- 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 @@ -38,46 +38,56 @@ verifyProperty(C, "m", { writable: true, }, {restore: 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: undefined, - 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: 39, - enumerable: true, - writable: true, - configurable: true -}); - -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "d"), false); -assert.sameValue(Object.hasOwnProperty.call(C, "d"), false); - -verifyProperty(c, "d", { - value: 42, - enumerable: true, - writable: true, - configurable: 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: undefined, + 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: 39, + enumerable: true, + writable: true, + configurable: true + }); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "d"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "d"), false); + + verifyProperty(c, "d", { + 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-rs-static-async-generator-method-privatename-identifier-alt.js b/test/language/statements/class/fields-after-same-line-static-gen-rs-static-async-generator-method-privatename-identifier-alt.js index 400d167e2b..217d5681aa 100644 --- a/test/language/statements/class/fields-after-same-line-static-gen-rs-static-async-generator-method-privatename-identifier-alt.js +++ b/test/language/statements/class/fields-after-same-line-static-gen-rs-static-async-generator-method-privatename-identifier-alt.js @@ -61,41 +61,41 @@ info: | class C { - static *m() { return 42; } static async #$(value) { + static *m() { return 42; } static async * #$(value) { yield await value; } - static async #_(value) { + static async * #_(value) { yield await value; } - static async #o(value) { + static async * #o(value) { yield await value; } - static async #℘(value) { + static async * #℘(value) { yield await value; } - static async #ZW_‌_NJ(value) { + static async * #ZW_‌_NJ(value) { yield await value; } - static async #ZW_‍_J(value) { + static async * #ZW_‍_J(value) { yield await value; }; - static async $(value) { - yield * await this.#$(value); + static get $() { + return this.#$; } - static async _(value) { - yield * await this.#_(value); + static get _() { + return this.#_; } - static async o(value) { - yield * await this.#o(value); + static get o() { + return this.#o; } - static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/statements/class/fields-after-same-line-static-gen-rs-static-async-generator-method-privatename-identifier.js b/test/language/statements/class/fields-after-same-line-static-gen-rs-static-async-generator-method-privatename-identifier.js index 6880c808e9..04ab8befe4 100644 --- a/test/language/statements/class/fields-after-same-line-static-gen-rs-static-async-generator-method-privatename-identifier.js +++ b/test/language/statements/class/fields-after-same-line-static-gen-rs-static-async-generator-method-privatename-identifier.js @@ -62,40 +62,40 @@ info: | class C { static *m() { return 42; } static async * #$(value) { - yield await value; + yield * await value; } static async * #_(value) { - yield await value; + yield * await value; } static async * #\u{6F}(value) { - yield await value; + yield * await value; } static async * #\u2118(value) { - yield await value; + yield * await value; } static async * #ZW_\u200C_NJ(value) { - yield await value; + yield * await value; } static async * #ZW_\u200D_J(value) { - yield await value; + yield * await value; }; - static async * $(value) { - yield * await this.#$(value); + static async * $() { + return this.#$; } - static async * _(value) { - yield * await this.#_(value); + static async * _() { + return this.#_; } - static async * \u{6F}(value) { - yield * await this.#\u{6F}(value); + static async * \u{6F}() { + return this.#\u{6F}; } - static async * \u2118(value) { - yield * await this.#\u2118(value); + static async * \u2118() { + return this.#\u2118; } - static async * ZW_\u200C_NJ(value) { - yield * await this.#ZW_\u200C_NJ(value); + static async * ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static async * ZW_\u200D_J(value) { - yield * await this.#ZW_\u200D_J(value); + static async * ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/statements/class/fields-after-same-line-static-gen-rs-static-generator-method-privatename-identifier-alt.js b/test/language/statements/class/fields-after-same-line-static-gen-rs-static-generator-method-privatename-identifier-alt.js index bf3f71dada..a4137a87fc 100644 --- a/test/language/statements/class/fields-after-same-line-static-gen-rs-static-generator-method-privatename-identifier-alt.js +++ b/test/language/statements/class/fields-after-same-line-static-gen-rs-static-generator-method-privatename-identifier-alt.js @@ -62,40 +62,40 @@ info: | class C { static *m() { return 42; } static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #o(value) { - yield value; + yield * value; } static * #℘(value) { - yield value; + yield * value; } static * #ZW_‌_NJ(value) { - yield value; + yield * value; } static * #ZW_‍_J(value) { - yield value; + yield * value; }; - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * o(value) { - yield this.#o(value); + static get o() { + return this.#o; } - static * ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static * ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static * ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/statements/class/fields-after-same-line-static-gen-rs-static-generator-method-privatename-identifier.js b/test/language/statements/class/fields-after-same-line-static-gen-rs-static-generator-method-privatename-identifier.js index e9ab085db6..3e0274bd1f 100644 --- a/test/language/statements/class/fields-after-same-line-static-gen-rs-static-generator-method-privatename-identifier.js +++ b/test/language/statements/class/fields-after-same-line-static-gen-rs-static-generator-method-privatename-identifier.js @@ -62,40 +62,40 @@ info: | class C { static *m() { return 42; } static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #\u{6F}(value) { - yield value; + yield * value; } static * #\u2118(value) { - yield value; + yield * value; } static * #ZW_\u200C_NJ(value) { - yield value; + yield * value; } static * #ZW_\u200D_J(value) { - yield value; + yield * value; }; - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * \u{6F}(value) { - yield this.#\u{6F}(value); + static get \u{6F}() { + return this.#\u{6F}; } - static * \u2118(value) { - yield this.#\u2118(value); + static get \u2118() { + return this.#\u2118; } - static * ZW_\u200C_NJ(value) { - yield this.#ZW_\u200C_NJ(value); + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static * ZW_\u200D_J(value) { - yield this.#ZW_\u200D_J(value); + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/statements/class/fields-after-same-line-static-gen-static-private-methods-with-fields.js b/test/language/statements/class/fields-after-same-line-static-gen-static-private-methods-with-fields.js new file mode 100644 index 0000000000..ccf91c4410 --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-static-gen-static-private-methods-with-fields.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-private-methods-with-fields.case +// - src/class-fields/productions/cls-decl-after-same-line-static-gen.template +/*--- +description: static private methods with fields (field definitions after a static generator in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-private, generators, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +class C { + static *m() { return 42; } static #xVal; static #yVal; + static #x(value) { + this.#xVal = value; + return this.#xVal; + } + static #y(value) { + this.#yVal = value; + return this.#yVal; + } + static x() { + return this.#x(42); + } + static y() { + return this.#y(43); + } +} + +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, +}); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7"); +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8"); +assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11"); +assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 13"); +assert.sameValue(C.y(), 43, "test 14"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16"); + +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18"); diff --git a/test/language/statements/class/fields-after-same-line-static-gen-static-private-methods.js b/test/language/statements/class/fields-after-same-line-static-gen-static-private-methods.js index 77a4f80c9a..cec611b5ff 100644 --- a/test/language/statements/class/fields-after-same-line-static-gen-static-private-methods.js +++ b/test/language/statements/class/fields-after-same-line-static-gen-static-private-methods.js @@ -25,17 +25,15 @@ info: | class C { - static *m() { return 42; } static #xVal; static #yVal; + static *m() { return 42; } ; static #x(value) { - this.#xVal = value; - return this.#xVal; + return value / 2; } static #y(value) { - this.#y = value; - return this.#yVal; + return value * 2; } static x() { - return this.#x(42); + return this.#x(84); } static y() { return this.#y(43); @@ -55,18 +53,18 @@ verifyProperty(C, "m", { }); // Test the private methods do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 1"); -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 2"); -assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 3"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 4"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 5"); -assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 6"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); // Test if private fields can be sucessfully accessed and set to value assert.sameValue(C.x(), 42, "test 7"); -assert.sameValue(C.y(), 43, "test 8"); +assert.sameValue(C.y(), 86, "test 8"); // Test the private fields do not appear as properties before after set to value -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 9"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); diff --git a/test/language/statements/class/fields-after-same-line-static-method-rs-static-async-generator-method-privatename-identifier-alt.js b/test/language/statements/class/fields-after-same-line-static-method-rs-static-async-generator-method-privatename-identifier-alt.js index 2766d3c61e..ad5d3fee90 100644 --- a/test/language/statements/class/fields-after-same-line-static-method-rs-static-async-generator-method-privatename-identifier-alt.js +++ b/test/language/statements/class/fields-after-same-line-static-method-rs-static-async-generator-method-privatename-identifier-alt.js @@ -61,41 +61,41 @@ info: | class C { - static m() { return 42; } static async #$(value) { + static m() { return 42; } static async * #$(value) { yield await value; } - static async #_(value) { + static async * #_(value) { yield await value; } - static async #o(value) { + static async * #o(value) { yield await value; } - static async #℘(value) { + static async * #℘(value) { yield await value; } - static async #ZW_‌_NJ(value) { + static async * #ZW_‌_NJ(value) { yield await value; } - static async #ZW_‍_J(value) { + static async * #ZW_‍_J(value) { yield await value; }; - static async $(value) { - yield * await this.#$(value); + static get $() { + return this.#$; } - static async _(value) { - yield * await this.#_(value); + static get _() { + return this.#_; } - static async o(value) { - yield * await this.#o(value); + static get o() { + return this.#o; } - static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/statements/class/fields-after-same-line-static-method-rs-static-async-generator-method-privatename-identifier.js b/test/language/statements/class/fields-after-same-line-static-method-rs-static-async-generator-method-privatename-identifier.js index aaaf0f82d5..20506e5884 100644 --- a/test/language/statements/class/fields-after-same-line-static-method-rs-static-async-generator-method-privatename-identifier.js +++ b/test/language/statements/class/fields-after-same-line-static-method-rs-static-async-generator-method-privatename-identifier.js @@ -62,40 +62,40 @@ info: | class C { static m() { return 42; } static async * #$(value) { - yield await value; + yield * await value; } static async * #_(value) { - yield await value; + yield * await value; } static async * #\u{6F}(value) { - yield await value; + yield * await value; } static async * #\u2118(value) { - yield await value; + yield * await value; } static async * #ZW_\u200C_NJ(value) { - yield await value; + yield * await value; } static async * #ZW_\u200D_J(value) { - yield await value; + yield * await value; }; - static async * $(value) { - yield * await this.#$(value); + static async * $() { + return this.#$; } - static async * _(value) { - yield * await this.#_(value); + static async * _() { + return this.#_; } - static async * \u{6F}(value) { - yield * await this.#\u{6F}(value); + static async * \u{6F}() { + return this.#\u{6F}; } - static async * \u2118(value) { - yield * await this.#\u2118(value); + static async * \u2118() { + return this.#\u2118; } - static async * ZW_\u200C_NJ(value) { - yield * await this.#ZW_\u200C_NJ(value); + static async * ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static async * ZW_\u200D_J(value) { - yield * await this.#ZW_\u200D_J(value); + static async * ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/statements/class/fields-after-same-line-static-method-rs-static-generator-method-privatename-identifier-alt.js b/test/language/statements/class/fields-after-same-line-static-method-rs-static-generator-method-privatename-identifier-alt.js index b8edca96f4..7d9a95c322 100644 --- a/test/language/statements/class/fields-after-same-line-static-method-rs-static-generator-method-privatename-identifier-alt.js +++ b/test/language/statements/class/fields-after-same-line-static-method-rs-static-generator-method-privatename-identifier-alt.js @@ -62,40 +62,40 @@ info: | class C { static m() { return 42; } static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #o(value) { - yield value; + yield * value; } static * #℘(value) { - yield value; + yield * value; } static * #ZW_‌_NJ(value) { - yield value; + yield * value; } static * #ZW_‍_J(value) { - yield value; + yield * value; }; - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * o(value) { - yield this.#o(value); + static get o() { + return this.#o; } - static * ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static * ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static * ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/statements/class/fields-after-same-line-static-method-rs-static-generator-method-privatename-identifier.js b/test/language/statements/class/fields-after-same-line-static-method-rs-static-generator-method-privatename-identifier.js index eb84e88ae7..5379980cb3 100644 --- a/test/language/statements/class/fields-after-same-line-static-method-rs-static-generator-method-privatename-identifier.js +++ b/test/language/statements/class/fields-after-same-line-static-method-rs-static-generator-method-privatename-identifier.js @@ -62,40 +62,40 @@ info: | class C { static m() { return 42; } static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #\u{6F}(value) { - yield value; + yield * value; } static * #\u2118(value) { - yield value; + yield * value; } static * #ZW_\u200C_NJ(value) { - yield value; + yield * value; } static * #ZW_\u200D_J(value) { - yield value; + yield * value; }; - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * \u{6F}(value) { - yield this.#\u{6F}(value); + static get \u{6F}() { + return this.#\u{6F}; } - static * \u2118(value) { - yield this.#\u2118(value); + static get \u2118() { + return this.#\u2118; } - static * ZW_\u200C_NJ(value) { - yield this.#ZW_\u200C_NJ(value); + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static * ZW_\u200D_J(value) { - yield this.#ZW_\u200D_J(value); + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/statements/class/fields-after-same-line-static-method-static-private-methods-with-fields.js b/test/language/statements/class/fields-after-same-line-static-method-static-private-methods-with-fields.js new file mode 100644 index 0000000000..35f6c681dc --- /dev/null +++ b/test/language/statements/class/fields-after-same-line-static-method-static-private-methods-with-fields.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-private-methods-with-fields.case +// - src/class-fields/productions/cls-decl-after-same-line-static-method.template +/*--- +description: static private methods with fields (field definitions after a static method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +class C { + static m() { return 42; } static #xVal; static #yVal; + static #x(value) { + this.#xVal = value; + return this.#xVal; + } + static #y(value) { + this.#yVal = value; + return this.#yVal; + } + static x() { + return this.#x(42); + } + static y() { + return this.#y(43); + } +} + +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, +}); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7"); +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8"); +assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11"); +assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 13"); +assert.sameValue(C.y(), 43, "test 14"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16"); + +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18"); diff --git a/test/language/statements/class/fields-after-same-line-static-method-static-private-methods.js b/test/language/statements/class/fields-after-same-line-static-method-static-private-methods.js index 8c13b7e74f..a091055b74 100644 --- a/test/language/statements/class/fields-after-same-line-static-method-static-private-methods.js +++ b/test/language/statements/class/fields-after-same-line-static-method-static-private-methods.js @@ -25,17 +25,15 @@ info: | class C { - static m() { return 42; } static #xVal; static #yVal; + static m() { return 42; } ; static #x(value) { - this.#xVal = value; - return this.#xVal; + return value / 2; } static #y(value) { - this.#y = value; - return this.#yVal; + return value * 2; } static x() { - return this.#x(42); + return this.#x(84); } static y() { return this.#y(43); @@ -55,18 +53,18 @@ verifyProperty(C, "m", { }); // Test the private methods do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 1"); -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 2"); -assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 3"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 4"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 5"); -assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 6"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); // Test if private fields can be sucessfully accessed and set to value assert.sameValue(C.x(), 42, "test 7"); -assert.sameValue(C.y(), 43, "test 8"); +assert.sameValue(C.y(), 86, "test 8"); // Test the private fields do not appear as properties before after set to value -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 9"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); diff --git a/test/language/statements/class/fields-multiple-definitions-rs-static-async-generator-method-privatename-identifier-alt.js b/test/language/statements/class/fields-multiple-definitions-rs-static-async-generator-method-privatename-identifier-alt.js index 688ee936d3..baa3fefd44 100644 --- a/test/language/statements/class/fields-multiple-definitions-rs-static-async-generator-method-privatename-identifier-alt.js +++ b/test/language/statements/class/fields-multiple-definitions-rs-static-async-generator-method-privatename-identifier-alt.js @@ -63,43 +63,43 @@ info: | class C { foo = "foobar"; m() { return 42 } - static async #$(value) { + static async * #$(value) { yield await value; } - static async #_(value) { + static async * #_(value) { yield await value; } - static async #o(value) { + static async * #o(value) { yield await value; } - static async #℘(value) { + static async * #℘(value) { yield await value; } - static async #ZW_‌_NJ(value) { + static async * #ZW_‌_NJ(value) { yield await value; } - static async #ZW_‍_J(value) { + static async * #ZW_‍_J(value) { yield await value; } m2() { return 39 } bar = "barbaz"; - static async $(value) { - yield * await this.#$(value); + static get $() { + return this.#$; } - static async _(value) { - yield * await this.#_(value); + static get _() { + return this.#_; } - static async o(value) { - yield * await this.#o(value); + static get o() { + return this.#o; } - static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/statements/class/fields-multiple-definitions-rs-static-async-generator-method-privatename-identifier.js b/test/language/statements/class/fields-multiple-definitions-rs-static-async-generator-method-privatename-identifier.js index d124b7bb70..ee2add8863 100644 --- a/test/language/statements/class/fields-multiple-definitions-rs-static-async-generator-method-privatename-identifier.js +++ b/test/language/statements/class/fields-multiple-definitions-rs-static-async-generator-method-privatename-identifier.js @@ -64,42 +64,42 @@ class C { foo = "foobar"; m() { return 42 } static async * #$(value) { - yield await value; + yield * await value; } static async * #_(value) { - yield await value; + yield * await value; } static async * #\u{6F}(value) { - yield await value; + yield * await value; } static async * #\u2118(value) { - yield await value; + yield * await value; } static async * #ZW_\u200C_NJ(value) { - yield await value; + yield * await value; } static async * #ZW_\u200D_J(value) { - yield await value; + yield * await value; } m2() { return 39 } bar = "barbaz"; - static async * $(value) { - yield * await this.#$(value); + static async * $() { + return this.#$; } - static async * _(value) { - yield * await this.#_(value); + static async * _() { + return this.#_; } - static async * \u{6F}(value) { - yield * await this.#\u{6F}(value); + static async * \u{6F}() { + return this.#\u{6F}; } - static async * \u2118(value) { - yield * await this.#\u2118(value); + static async * \u2118() { + return this.#\u2118; } - static async * ZW_\u200C_NJ(value) { - yield * await this.#ZW_\u200C_NJ(value); + static async * ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static async * ZW_\u200D_J(value) { - yield * await this.#ZW_\u200D_J(value); + static async * ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/statements/class/fields-multiple-definitions-rs-static-generator-method-privatename-identifier-alt.js b/test/language/statements/class/fields-multiple-definitions-rs-static-generator-method-privatename-identifier-alt.js index b5dad58cf6..390e76a116 100644 --- a/test/language/statements/class/fields-multiple-definitions-rs-static-generator-method-privatename-identifier-alt.js +++ b/test/language/statements/class/fields-multiple-definitions-rs-static-generator-method-privatename-identifier-alt.js @@ -64,42 +64,42 @@ class C { foo = "foobar"; m() { return 42 } static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #o(value) { - yield value; + yield * value; } static * #℘(value) { - yield value; + yield * value; } static * #ZW_‌_NJ(value) { - yield value; + yield * value; } static * #ZW_‍_J(value) { - yield value; + yield * value; } m2() { return 39 } bar = "barbaz"; - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * o(value) { - yield this.#o(value); + static get o() { + return this.#o; } - static * ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static * ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static * ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/statements/class/fields-multiple-definitions-rs-static-generator-method-privatename-identifier.js b/test/language/statements/class/fields-multiple-definitions-rs-static-generator-method-privatename-identifier.js index 65606f3995..be8eaf19d7 100644 --- a/test/language/statements/class/fields-multiple-definitions-rs-static-generator-method-privatename-identifier.js +++ b/test/language/statements/class/fields-multiple-definitions-rs-static-generator-method-privatename-identifier.js @@ -64,42 +64,42 @@ class C { foo = "foobar"; m() { return 42 } static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #\u{6F}(value) { - yield value; + yield * value; } static * #\u2118(value) { - yield value; + yield * value; } static * #ZW_\u200C_NJ(value) { - yield value; + yield * value; } static * #ZW_\u200D_J(value) { - yield value; + yield * value; } m2() { return 39 } bar = "barbaz"; - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * \u{6F}(value) { - yield this.#\u{6F}(value); + static get \u{6F}() { + return this.#\u{6F}; } - static * \u2118(value) { - yield this.#\u2118(value); + static get \u2118() { + return this.#\u2118; } - static * ZW_\u200C_NJ(value) { - yield this.#ZW_\u200C_NJ(value); + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static * ZW_\u200D_J(value) { - yield this.#ZW_\u200D_J(value); + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/statements/class/fields-multiple-definitions-static-private-methods-with-fields.js b/test/language/statements/class/fields-multiple-definitions-static-private-methods-with-fields.js new file mode 100644 index 0000000000..4676833aa8 --- /dev/null +++ b/test/language/statements/class/fields-multiple-definitions-static-private-methods-with-fields.js @@ -0,0 +1,119 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-private-methods-with-fields.case +// - src/class-fields/productions/cls-decl-multiple-definitions.template +/*--- +description: static private methods with fields (multiple fields definitions) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +class C { + foo = "foobar"; + m() { return 42 } + static #xVal; static #yVal + m2() { return 39 } + bar = "barbaz"; + static #x(value) { + this.#xVal = value; + return this.#xVal; + } + static #y(value) { + this.#yVal = value; + return this.#yVal; + } + static x() { + return this.#x(42); + } + static y() { + return this.#y(43); + } +} + +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, +}); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7"); +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8"); +assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11"); +assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 13"); +assert.sameValue(C.y(), 43, "test 14"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16"); + +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18"); diff --git a/test/language/statements/class/fields-multiple-definitions-static-private-methods.js b/test/language/statements/class/fields-multiple-definitions-static-private-methods.js index df86d9893d..5e551cb57a 100644 --- a/test/language/statements/class/fields-multiple-definitions-static-private-methods.js +++ b/test/language/statements/class/fields-multiple-definitions-static-private-methods.js @@ -27,19 +27,17 @@ info: | class C { foo = "foobar"; m() { return 42 } - static #xVal; static #yVal + m2() { return 39 } bar = "barbaz"; static #x(value) { - this.#xVal = value; - return this.#xVal; + return value / 2; } static #y(value) { - this.#y = value; - return this.#yVal; + return value * 2; } static x() { - return this.#x(42); + return this.#x(84); } static y() { return this.#y(43); @@ -91,18 +89,18 @@ verifyProperty(c, "bar", { }); // Test the private methods do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 1"); -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 2"); -assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 3"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 4"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 5"); -assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 6"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); // Test if private fields can be sucessfully accessed and set to value assert.sameValue(C.x(), 42, "test 7"); -assert.sameValue(C.y(), 43, "test 8"); +assert.sameValue(C.y(), 86, "test 8"); // Test the private fields do not appear as properties before after set to value -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 9"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); diff --git a/test/language/statements/class/fields-multiple-stacked-definitions-rs-static-async-generator-method-privatename-identifier-alt.js b/test/language/statements/class/fields-multiple-stacked-definitions-rs-static-async-generator-method-privatename-identifier-alt.js index 09ade3dbfc..b6731aa850 100644 --- a/test/language/statements/class/fields-multiple-stacked-definitions-rs-static-async-generator-method-privatename-identifier-alt.js +++ b/test/language/statements/class/fields-multiple-stacked-definitions-rs-static-async-generator-method-privatename-identifier-alt.js @@ -61,43 +61,43 @@ info: | class C { - static async #$(value) { + static async * #$(value) { yield await value; } - static async #_(value) { + static async * #_(value) { yield await value; } - static async #o(value) { + static async * #o(value) { yield await value; } - static async #℘(value) { + static async * #℘(value) { yield await value; } - static async #ZW_‌_NJ(value) { + static async * #ZW_‌_NJ(value) { yield await value; } - static async #ZW_‍_J(value) { + static async * #ZW_‍_J(value) { yield await value; } foo = "foobar" bar = "barbaz"; - static async $(value) { - yield * await this.#$(value); + static get $() { + return this.#$; } - static async _(value) { - yield * await this.#_(value); + static get _() { + return this.#_; } - static async o(value) { - yield * await this.#o(value); + static get o() { + return this.#o; } - static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/statements/class/fields-multiple-stacked-definitions-rs-static-async-generator-method-privatename-identifier.js b/test/language/statements/class/fields-multiple-stacked-definitions-rs-static-async-generator-method-privatename-identifier.js index 356fd53748..0e3a704d67 100644 --- a/test/language/statements/class/fields-multiple-stacked-definitions-rs-static-async-generator-method-privatename-identifier.js +++ b/test/language/statements/class/fields-multiple-stacked-definitions-rs-static-async-generator-method-privatename-identifier.js @@ -62,42 +62,42 @@ info: | class C { static async * #$(value) { - yield await value; + yield * await value; } static async * #_(value) { - yield await value; + yield * await value; } static async * #\u{6F}(value) { - yield await value; + yield * await value; } static async * #\u2118(value) { - yield await value; + yield * await value; } static async * #ZW_\u200C_NJ(value) { - yield await value; + yield * await value; } static async * #ZW_\u200D_J(value) { - yield await value; + yield * await value; } foo = "foobar" bar = "barbaz"; - static async * $(value) { - yield * await this.#$(value); + static async * $() { + return this.#$; } - static async * _(value) { - yield * await this.#_(value); + static async * _() { + return this.#_; } - static async * \u{6F}(value) { - yield * await this.#\u{6F}(value); + static async * \u{6F}() { + return this.#\u{6F}; } - static async * \u2118(value) { - yield * await this.#\u2118(value); + static async * \u2118() { + return this.#\u2118; } - static async * ZW_\u200C_NJ(value) { - yield * await this.#ZW_\u200C_NJ(value); + static async * ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static async * ZW_\u200D_J(value) { - yield * await this.#ZW_\u200D_J(value); + static async * ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/statements/class/fields-multiple-stacked-definitions-rs-static-generator-method-privatename-identifier-alt.js b/test/language/statements/class/fields-multiple-stacked-definitions-rs-static-generator-method-privatename-identifier-alt.js index a12442c283..3f4f52a932 100644 --- a/test/language/statements/class/fields-multiple-stacked-definitions-rs-static-generator-method-privatename-identifier-alt.js +++ b/test/language/statements/class/fields-multiple-stacked-definitions-rs-static-generator-method-privatename-identifier-alt.js @@ -62,42 +62,42 @@ info: | class C { static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #o(value) { - yield value; + yield * value; } static * #℘(value) { - yield value; + yield * value; } static * #ZW_‌_NJ(value) { - yield value; + yield * value; } static * #ZW_‍_J(value) { - yield value; + yield * value; } foo = "foobar" bar = "barbaz"; - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * o(value) { - yield this.#o(value); + static get o() { + return this.#o; } - static * ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static * ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static * ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/statements/class/fields-multiple-stacked-definitions-rs-static-generator-method-privatename-identifier.js b/test/language/statements/class/fields-multiple-stacked-definitions-rs-static-generator-method-privatename-identifier.js index 346e65cdcf..44be313327 100644 --- a/test/language/statements/class/fields-multiple-stacked-definitions-rs-static-generator-method-privatename-identifier.js +++ b/test/language/statements/class/fields-multiple-stacked-definitions-rs-static-generator-method-privatename-identifier.js @@ -62,42 +62,42 @@ info: | class C { static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #\u{6F}(value) { - yield value; + yield * value; } static * #\u2118(value) { - yield value; + yield * value; } static * #ZW_\u200C_NJ(value) { - yield value; + yield * value; } static * #ZW_\u200D_J(value) { - yield value; + yield * value; } foo = "foobar" bar = "barbaz"; - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * \u{6F}(value) { - yield this.#\u{6F}(value); + static get \u{6F}() { + return this.#\u{6F}; } - static * \u2118(value) { - yield this.#\u2118(value); + static get \u2118() { + return this.#\u2118; } - static * ZW_\u200C_NJ(value) { - yield this.#ZW_\u200C_NJ(value); + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static * ZW_\u200D_J(value) { - yield this.#ZW_\u200D_J(value); + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/statements/class/fields-multiple-stacked-definitions-static-private-methods-with-fields.js b/test/language/statements/class/fields-multiple-stacked-definitions-static-private-methods-with-fields.js new file mode 100644 index 0000000000..c6a64bcfc2 --- /dev/null +++ b/test/language/statements/class/fields-multiple-stacked-definitions-static-private-methods-with-fields.js @@ -0,0 +1,97 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-private-methods-with-fields.case +// - src/class-fields/productions/cls-decl-multiple-stacked-definitions.template +/*--- +description: static private methods with fields (multiple stacked fields definitions through ASI) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +class C { + static #xVal; static #yVal + foo = "foobar" + bar = "barbaz"; + static #x(value) { + this.#xVal = value; + return this.#xVal; + } + static #y(value) { + this.#yVal = value; + return this.#yVal; + } + static x() { + return this.#x(42); + } + static y() { + return this.#y(43); + } +} + +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, +}); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7"); +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8"); +assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11"); +assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 13"); +assert.sameValue(C.y(), 43, "test 14"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16"); + +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18"); diff --git a/test/language/statements/class/fields-multiple-stacked-definitions-static-private-methods.js b/test/language/statements/class/fields-multiple-stacked-definitions-static-private-methods.js index 9e38dfbc91..9a0d29ae31 100644 --- a/test/language/statements/class/fields-multiple-stacked-definitions-static-private-methods.js +++ b/test/language/statements/class/fields-multiple-stacked-definitions-static-private-methods.js @@ -25,19 +25,17 @@ info: | class C { - static #xVal; static #yVal + foo = "foobar" bar = "barbaz"; static #x(value) { - this.#xVal = value; - return this.#xVal; + return value / 2; } static #y(value) { - this.#y = value; - return this.#yVal; + return value * 2; } static x() { - return this.#x(42); + return this.#x(84); } static y() { return this.#y(43); @@ -69,18 +67,18 @@ verifyProperty(c, "bar", { }); // Test the private methods do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 1"); -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 2"); -assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 3"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 4"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 5"); -assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 6"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); // Test if private fields can be sucessfully accessed and set to value assert.sameValue(C.x(), 42, "test 7"); -assert.sameValue(C.y(), 43, "test 8"); +assert.sameValue(C.y(), 86, "test 8"); // Test the private fields do not appear as properties before after set to value -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 9"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); diff --git a/test/language/statements/class/fields-new-no-sc-line-method-rs-static-async-generator-method-privatename-identifier-alt.js b/test/language/statements/class/fields-new-no-sc-line-method-rs-static-async-generator-method-privatename-identifier-alt.js index 605fb4537e..8d3c741766 100644 --- a/test/language/statements/class/fields-new-no-sc-line-method-rs-static-async-generator-method-privatename-identifier-alt.js +++ b/test/language/statements/class/fields-new-no-sc-line-method-rs-static-async-generator-method-privatename-identifier-alt.js @@ -61,42 +61,42 @@ info: | class C { - static async #$(value) { + static async * #$(value) { yield await value; } - static async #_(value) { + static async * #_(value) { yield await value; } - static async #o(value) { + static async * #o(value) { yield await value; } - static async #℘(value) { + static async * #℘(value) { yield await value; } - static async #ZW_‌_NJ(value) { + static async * #ZW_‌_NJ(value) { yield await value; } - static async #ZW_‍_J(value) { + static async * #ZW_‍_J(value) { yield await value; } m() { return 42; } - static async $(value) { - yield * await this.#$(value); + static get $() { + return this.#$; } - static async _(value) { - yield * await this.#_(value); + static get _() { + return this.#_; } - static async o(value) { - yield * await this.#o(value); + static get o() { + return this.#o; } - static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/statements/class/fields-new-no-sc-line-method-rs-static-async-generator-method-privatename-identifier.js b/test/language/statements/class/fields-new-no-sc-line-method-rs-static-async-generator-method-privatename-identifier.js index 239d4919c1..a3a80442c1 100644 --- a/test/language/statements/class/fields-new-no-sc-line-method-rs-static-async-generator-method-privatename-identifier.js +++ b/test/language/statements/class/fields-new-no-sc-line-method-rs-static-async-generator-method-privatename-identifier.js @@ -62,41 +62,41 @@ info: | class C { static async * #$(value) { - yield await value; + yield * await value; } static async * #_(value) { - yield await value; + yield * await value; } static async * #\u{6F}(value) { - yield await value; + yield * await value; } static async * #\u2118(value) { - yield await value; + yield * await value; } static async * #ZW_\u200C_NJ(value) { - yield await value; + yield * await value; } static async * #ZW_\u200D_J(value) { - yield await value; + yield * await value; } m() { return 42; } - static async * $(value) { - yield * await this.#$(value); + static async * $() { + return this.#$; } - static async * _(value) { - yield * await this.#_(value); + static async * _() { + return this.#_; } - static async * \u{6F}(value) { - yield * await this.#\u{6F}(value); + static async * \u{6F}() { + return this.#\u{6F}; } - static async * \u2118(value) { - yield * await this.#\u2118(value); + static async * \u2118() { + return this.#\u2118; } - static async * ZW_\u200C_NJ(value) { - yield * await this.#ZW_\u200C_NJ(value); + static async * ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static async * ZW_\u200D_J(value) { - yield * await this.#ZW_\u200D_J(value); + static async * ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/statements/class/fields-new-no-sc-line-method-rs-static-generator-method-privatename-identifier-alt.js b/test/language/statements/class/fields-new-no-sc-line-method-rs-static-generator-method-privatename-identifier-alt.js index 7239d18edc..0105dbdcd1 100644 --- a/test/language/statements/class/fields-new-no-sc-line-method-rs-static-generator-method-privatename-identifier-alt.js +++ b/test/language/statements/class/fields-new-no-sc-line-method-rs-static-generator-method-privatename-identifier-alt.js @@ -62,41 +62,41 @@ info: | class C { static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #o(value) { - yield value; + yield * value; } static * #℘(value) { - yield value; + yield * value; } static * #ZW_‌_NJ(value) { - yield value; + yield * value; } static * #ZW_‍_J(value) { - yield value; + yield * value; } m() { return 42; } - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * o(value) { - yield this.#o(value); + static get o() { + return this.#o; } - static * ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static * ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static * ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/statements/class/fields-new-no-sc-line-method-rs-static-generator-method-privatename-identifier.js b/test/language/statements/class/fields-new-no-sc-line-method-rs-static-generator-method-privatename-identifier.js index bca48ba4d3..f8f665aaed 100644 --- a/test/language/statements/class/fields-new-no-sc-line-method-rs-static-generator-method-privatename-identifier.js +++ b/test/language/statements/class/fields-new-no-sc-line-method-rs-static-generator-method-privatename-identifier.js @@ -62,41 +62,41 @@ info: | class C { static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #\u{6F}(value) { - yield value; + yield * value; } static * #\u2118(value) { - yield value; + yield * value; } static * #ZW_\u200C_NJ(value) { - yield value; + yield * value; } static * #ZW_\u200D_J(value) { - yield value; + yield * value; } m() { return 42; } - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * \u{6F}(value) { - yield this.#\u{6F}(value); + static get \u{6F}() { + return this.#\u{6F}; } - static * \u2118(value) { - yield this.#\u2118(value); + static get \u2118() { + return this.#\u2118; } - static * ZW_\u200C_NJ(value) { - yield this.#ZW_\u200C_NJ(value); + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static * ZW_\u200D_J(value) { - yield this.#ZW_\u200D_J(value); + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/statements/class/fields-new-no-sc-line-method-static-private-methods-with-fields.js b/test/language/statements/class/fields-new-no-sc-line-method-static-private-methods-with-fields.js new file mode 100644 index 0000000000..3ccbc23ba9 --- /dev/null +++ b/test/language/statements/class/fields-new-no-sc-line-method-static-private-methods-with-fields.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-private-methods-with-fields.case +// - src/class-fields/productions/cls-decl-new-no-sc-line-method.template +/*--- +description: static private methods with fields (field definitions followed by a method in a new line without a semicolon) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +class C { + static #xVal; static #yVal + m() { return 42; } + static #x(value) { + this.#xVal = value; + return this.#xVal; + } + static #y(value) { + this.#yVal = value; + return this.#yVal; + } + static x() { + return this.#x(42); + } + static y() { + return this.#y(43); + } +} + +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, +}); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7"); +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8"); +assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11"); +assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 13"); +assert.sameValue(C.y(), 43, "test 14"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16"); + +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18"); diff --git a/test/language/statements/class/fields-new-no-sc-line-method-static-private-methods.js b/test/language/statements/class/fields-new-no-sc-line-method-static-private-methods.js index 6b444eb326..5ab1222b9a 100644 --- a/test/language/statements/class/fields-new-no-sc-line-method-static-private-methods.js +++ b/test/language/statements/class/fields-new-no-sc-line-method-static-private-methods.js @@ -25,18 +25,16 @@ info: | class C { - static #xVal; static #yVal + m() { return 42; } static #x(value) { - this.#xVal = value; - return this.#xVal; + return value / 2; } static #y(value) { - this.#y = value; - return this.#yVal; + return value * 2; } static x() { - return this.#x(42); + return this.#x(84); } static y() { return this.#y(43); @@ -56,18 +54,18 @@ verifyProperty(C.prototype, "m", { }); // Test the private methods do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 1"); -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 2"); -assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 3"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 4"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 5"); -assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 6"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); // Test if private fields can be sucessfully accessed and set to value assert.sameValue(C.x(), 42, "test 7"); -assert.sameValue(C.y(), 43, "test 8"); +assert.sameValue(C.y(), 86, "test 8"); // Test the private fields do not appear as properties before after set to value -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 9"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); diff --git a/test/language/statements/class/fields-new-sc-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js b/test/language/statements/class/fields-new-sc-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js index e078209aa4..7faf2d03b8 100644 --- a/test/language/statements/class/fields-new-sc-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js +++ b/test/language/statements/class/fields-new-sc-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js @@ -61,42 +61,42 @@ info: | class C { - static async #$(value) { + static async * #$(value) { yield await value; } - static async #_(value) { + static async * #_(value) { yield await value; } - static async #o(value) { + static async * #o(value) { yield await value; } - static async #℘(value) { + static async * #℘(value) { yield await value; } - static async #ZW_‌_NJ(value) { + static async * #ZW_‌_NJ(value) { yield await value; } - static async #ZW_‍_J(value) { + static async * #ZW_‍_J(value) { yield await value; }; *m() { return 42; } - static async $(value) { - yield * await this.#$(value); + static get $() { + return this.#$; } - static async _(value) { - yield * await this.#_(value); + static get _() { + return this.#_; } - static async o(value) { - yield * await this.#o(value); + static get o() { + return this.#o; } - static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/statements/class/fields-new-sc-line-gen-rs-static-async-generator-method-privatename-identifier.js b/test/language/statements/class/fields-new-sc-line-gen-rs-static-async-generator-method-privatename-identifier.js index 12b2d42c5e..dce0673774 100644 --- a/test/language/statements/class/fields-new-sc-line-gen-rs-static-async-generator-method-privatename-identifier.js +++ b/test/language/statements/class/fields-new-sc-line-gen-rs-static-async-generator-method-privatename-identifier.js @@ -62,41 +62,41 @@ info: | class C { static async * #$(value) { - yield await value; + yield * await value; } static async * #_(value) { - yield await value; + yield * await value; } static async * #\u{6F}(value) { - yield await value; + yield * await value; } static async * #\u2118(value) { - yield await value; + yield * await value; } static async * #ZW_\u200C_NJ(value) { - yield await value; + yield * await value; } static async * #ZW_\u200D_J(value) { - yield await value; + yield * await value; }; *m() { return 42; } - static async * $(value) { - yield * await this.#$(value); + static async * $() { + return this.#$; } - static async * _(value) { - yield * await this.#_(value); + static async * _() { + return this.#_; } - static async * \u{6F}(value) { - yield * await this.#\u{6F}(value); + static async * \u{6F}() { + return this.#\u{6F}; } - static async * \u2118(value) { - yield * await this.#\u2118(value); + static async * \u2118() { + return this.#\u2118; } - static async * ZW_\u200C_NJ(value) { - yield * await this.#ZW_\u200C_NJ(value); + static async * ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static async * ZW_\u200D_J(value) { - yield * await this.#ZW_\u200D_J(value); + static async * ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/statements/class/fields-new-sc-line-gen-rs-static-generator-method-privatename-identifier-alt.js b/test/language/statements/class/fields-new-sc-line-gen-rs-static-generator-method-privatename-identifier-alt.js index c52d4f24fa..157c9c25d2 100644 --- a/test/language/statements/class/fields-new-sc-line-gen-rs-static-generator-method-privatename-identifier-alt.js +++ b/test/language/statements/class/fields-new-sc-line-gen-rs-static-generator-method-privatename-identifier-alt.js @@ -62,41 +62,41 @@ info: | class C { static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #o(value) { - yield value; + yield * value; } static * #℘(value) { - yield value; + yield * value; } static * #ZW_‌_NJ(value) { - yield value; + yield * value; } static * #ZW_‍_J(value) { - yield value; + yield * value; }; *m() { return 42; } - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * o(value) { - yield this.#o(value); + static get o() { + return this.#o; } - static * ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static * ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static * ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/statements/class/fields-new-sc-line-gen-rs-static-generator-method-privatename-identifier.js b/test/language/statements/class/fields-new-sc-line-gen-rs-static-generator-method-privatename-identifier.js index 1f5549752a..5be0a510d7 100644 --- a/test/language/statements/class/fields-new-sc-line-gen-rs-static-generator-method-privatename-identifier.js +++ b/test/language/statements/class/fields-new-sc-line-gen-rs-static-generator-method-privatename-identifier.js @@ -62,41 +62,41 @@ info: | class C { static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #\u{6F}(value) { - yield value; + yield * value; } static * #\u2118(value) { - yield value; + yield * value; } static * #ZW_\u200C_NJ(value) { - yield value; + yield * value; } static * #ZW_\u200D_J(value) { - yield value; + yield * value; }; *m() { return 42; } - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * \u{6F}(value) { - yield this.#\u{6F}(value); + static get \u{6F}() { + return this.#\u{6F}; } - static * \u2118(value) { - yield this.#\u2118(value); + static get \u2118() { + return this.#\u2118; } - static * ZW_\u200C_NJ(value) { - yield this.#ZW_\u200C_NJ(value); + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static * ZW_\u200D_J(value) { - yield this.#ZW_\u200D_J(value); + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/statements/class/fields-new-sc-line-gen-static-private-methods-with-fields.js b/test/language/statements/class/fields-new-sc-line-gen-static-private-methods-with-fields.js new file mode 100644 index 0000000000..1239f224f5 --- /dev/null +++ b/test/language/statements/class/fields-new-sc-line-gen-static-private-methods-with-fields.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-private-methods-with-fields.case +// - src/class-fields/productions/cls-decl-new-sc-line-generator.template +/*--- +description: static private methods with fields (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public, + generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +class C { + static #xVal; static #yVal; + *m() { return 42; } + static #x(value) { + this.#xVal = value; + return this.#xVal; + } + static #y(value) { + this.#yVal = value; + return this.#yVal; + } + static x() { + return this.#x(42); + } + static y() { + return this.#y(43); + } +} + +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, +}); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7"); +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8"); +assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11"); +assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 13"); +assert.sameValue(C.y(), 43, "test 14"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16"); + +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18"); diff --git a/test/language/statements/class/fields-new-sc-line-gen-static-private-methods.js b/test/language/statements/class/fields-new-sc-line-gen-static-private-methods.js index c1bf2164e0..553f28223e 100644 --- a/test/language/statements/class/fields-new-sc-line-gen-static-private-methods.js +++ b/test/language/statements/class/fields-new-sc-line-gen-static-private-methods.js @@ -25,18 +25,16 @@ info: | class C { - static #xVal; static #yVal; + ; *m() { return 42; } static #x(value) { - this.#xVal = value; - return this.#xVal; + return value / 2; } static #y(value) { - this.#y = value; - return this.#yVal; + return value * 2; } static x() { - return this.#x(42); + return this.#x(84); } static y() { return this.#y(43); @@ -56,18 +54,18 @@ verifyProperty(C.prototype, "m", { }); // Test the private methods do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 1"); -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 2"); -assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 3"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 4"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 5"); -assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 6"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); // Test if private fields can be sucessfully accessed and set to value assert.sameValue(C.x(), 42, "test 7"); -assert.sameValue(C.y(), 43, "test 8"); +assert.sameValue(C.y(), 86, "test 8"); // Test the private fields do not appear as properties before after set to value -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 9"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); diff --git a/test/language/statements/class/fields-new-sc-line-method-rs-static-async-generator-method-privatename-identifier-alt.js b/test/language/statements/class/fields-new-sc-line-method-rs-static-async-generator-method-privatename-identifier-alt.js index 3b129d8707..758b553478 100644 --- a/test/language/statements/class/fields-new-sc-line-method-rs-static-async-generator-method-privatename-identifier-alt.js +++ b/test/language/statements/class/fields-new-sc-line-method-rs-static-async-generator-method-privatename-identifier-alt.js @@ -61,42 +61,42 @@ info: | class C { - static async #$(value) { + static async * #$(value) { yield await value; } - static async #_(value) { + static async * #_(value) { yield await value; } - static async #o(value) { + static async * #o(value) { yield await value; } - static async #℘(value) { + static async * #℘(value) { yield await value; } - static async #ZW_‌_NJ(value) { + static async * #ZW_‌_NJ(value) { yield await value; } - static async #ZW_‍_J(value) { + static async * #ZW_‍_J(value) { yield await value; }; m() { return 42; } - static async $(value) { - yield * await this.#$(value); + static get $() { + return this.#$; } - static async _(value) { - yield * await this.#_(value); + static get _() { + return this.#_; } - static async o(value) { - yield * await this.#o(value); + static get o() { + return this.#o; } - static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/statements/class/fields-new-sc-line-method-rs-static-async-generator-method-privatename-identifier.js b/test/language/statements/class/fields-new-sc-line-method-rs-static-async-generator-method-privatename-identifier.js index deac127cb8..26faa8654c 100644 --- a/test/language/statements/class/fields-new-sc-line-method-rs-static-async-generator-method-privatename-identifier.js +++ b/test/language/statements/class/fields-new-sc-line-method-rs-static-async-generator-method-privatename-identifier.js @@ -62,41 +62,41 @@ info: | class C { static async * #$(value) { - yield await value; + yield * await value; } static async * #_(value) { - yield await value; + yield * await value; } static async * #\u{6F}(value) { - yield await value; + yield * await value; } static async * #\u2118(value) { - yield await value; + yield * await value; } static async * #ZW_\u200C_NJ(value) { - yield await value; + yield * await value; } static async * #ZW_\u200D_J(value) { - yield await value; + yield * await value; }; m() { return 42; } - static async * $(value) { - yield * await this.#$(value); + static async * $() { + return this.#$; } - static async * _(value) { - yield * await this.#_(value); + static async * _() { + return this.#_; } - static async * \u{6F}(value) { - yield * await this.#\u{6F}(value); + static async * \u{6F}() { + return this.#\u{6F}; } - static async * \u2118(value) { - yield * await this.#\u2118(value); + static async * \u2118() { + return this.#\u2118; } - static async * ZW_\u200C_NJ(value) { - yield * await this.#ZW_\u200C_NJ(value); + static async * ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static async * ZW_\u200D_J(value) { - yield * await this.#ZW_\u200D_J(value); + static async * ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/statements/class/fields-new-sc-line-method-rs-static-generator-method-privatename-identifier-alt.js b/test/language/statements/class/fields-new-sc-line-method-rs-static-generator-method-privatename-identifier-alt.js index 00afe0eeb1..f3affd4f37 100644 --- a/test/language/statements/class/fields-new-sc-line-method-rs-static-generator-method-privatename-identifier-alt.js +++ b/test/language/statements/class/fields-new-sc-line-method-rs-static-generator-method-privatename-identifier-alt.js @@ -62,41 +62,41 @@ info: | class C { static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #o(value) { - yield value; + yield * value; } static * #℘(value) { - yield value; + yield * value; } static * #ZW_‌_NJ(value) { - yield value; + yield * value; } static * #ZW_‍_J(value) { - yield value; + yield * value; }; m() { return 42; } - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * o(value) { - yield this.#o(value); + static get o() { + return this.#o; } - static * ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static * ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static * ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/statements/class/fields-new-sc-line-method-rs-static-generator-method-privatename-identifier.js b/test/language/statements/class/fields-new-sc-line-method-rs-static-generator-method-privatename-identifier.js index f1563bbf98..05daed590e 100644 --- a/test/language/statements/class/fields-new-sc-line-method-rs-static-generator-method-privatename-identifier.js +++ b/test/language/statements/class/fields-new-sc-line-method-rs-static-generator-method-privatename-identifier.js @@ -62,41 +62,41 @@ info: | class C { static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #\u{6F}(value) { - yield value; + yield * value; } static * #\u2118(value) { - yield value; + yield * value; } static * #ZW_\u200C_NJ(value) { - yield value; + yield * value; } static * #ZW_\u200D_J(value) { - yield value; + yield * value; }; m() { return 42; } - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * \u{6F}(value) { - yield this.#\u{6F}(value); + static get \u{6F}() { + return this.#\u{6F}; } - static * \u2118(value) { - yield this.#\u2118(value); + static get \u2118() { + return this.#\u2118; } - static * ZW_\u200C_NJ(value) { - yield this.#ZW_\u200C_NJ(value); + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static * ZW_\u200D_J(value) { - yield this.#ZW_\u200D_J(value); + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/statements/class/fields-new-sc-line-method-static-private-methods-with-fields.js b/test/language/statements/class/fields-new-sc-line-method-static-private-methods-with-fields.js new file mode 100644 index 0000000000..8951d66b86 --- /dev/null +++ b/test/language/statements/class/fields-new-sc-line-method-static-private-methods-with-fields.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-private-methods-with-fields.case +// - src/class-fields/productions/cls-decl-new-sc-line-method.template +/*--- +description: static private methods with fields (field definitions followed by a method in a new line with a semicolon) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +class C { + static #xVal; static #yVal; + m() { return 42; } + static #x(value) { + this.#xVal = value; + return this.#xVal; + } + static #y(value) { + this.#yVal = value; + return this.#yVal; + } + static x() { + return this.#x(42); + } + static y() { + return this.#y(43); + } +} + +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, +}); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7"); +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8"); +assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11"); +assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 13"); +assert.sameValue(C.y(), 43, "test 14"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16"); + +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18"); diff --git a/test/language/statements/class/fields-new-sc-line-method-static-private-methods.js b/test/language/statements/class/fields-new-sc-line-method-static-private-methods.js index eb7d9e137e..52fce5b9d7 100644 --- a/test/language/statements/class/fields-new-sc-line-method-static-private-methods.js +++ b/test/language/statements/class/fields-new-sc-line-method-static-private-methods.js @@ -25,18 +25,16 @@ info: | class C { - static #xVal; static #yVal; + ; m() { return 42; } static #x(value) { - this.#xVal = value; - return this.#xVal; + return value / 2; } static #y(value) { - this.#y = value; - return this.#yVal; + return value * 2; } static x() { - return this.#x(42); + return this.#x(84); } static y() { return this.#y(43); @@ -56,18 +54,18 @@ verifyProperty(C.prototype, "m", { }); // Test the private methods do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 1"); -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 2"); -assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 3"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 4"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 5"); -assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 6"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); // Test if private fields can be sucessfully accessed and set to value assert.sameValue(C.x(), 42, "test 7"); -assert.sameValue(C.y(), 43, "test 8"); +assert.sameValue(C.y(), 86, "test 8"); // Test the private fields do not appear as properties before after set to value -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 9"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); diff --git a/test/language/statements/class/fields-regular-definitions-rs-static-async-generator-method-privatename-identifier-alt.js b/test/language/statements/class/fields-regular-definitions-rs-static-async-generator-method-privatename-identifier-alt.js index 4ca3001048..816836e01d 100644 --- a/test/language/statements/class/fields-regular-definitions-rs-static-async-generator-method-privatename-identifier-alt.js +++ b/test/language/statements/class/fields-regular-definitions-rs-static-async-generator-method-privatename-identifier-alt.js @@ -60,41 +60,41 @@ info: | class C { - static async #$(value) { + static async * #$(value) { yield await value; } - static async #_(value) { + static async * #_(value) { yield await value; } - static async #o(value) { + static async * #o(value) { yield await value; } - static async #℘(value) { + static async * #℘(value) { yield await value; } - static async #ZW_‌_NJ(value) { + static async * #ZW_‌_NJ(value) { yield await value; } - static async #ZW_‍_J(value) { + static async * #ZW_‍_J(value) { yield await value; } - static async $(value) { - yield * await this.#$(value); + static get $() { + return this.#$; } - static async _(value) { - yield * await this.#_(value); + static get _() { + return this.#_; } - static async o(value) { - yield * await this.#o(value); + static get o() { + return this.#o; } - static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/statements/class/fields-regular-definitions-rs-static-async-generator-method-privatename-identifier.js b/test/language/statements/class/fields-regular-definitions-rs-static-async-generator-method-privatename-identifier.js index 4d384515f0..33a5f10f93 100644 --- a/test/language/statements/class/fields-regular-definitions-rs-static-async-generator-method-privatename-identifier.js +++ b/test/language/statements/class/fields-regular-definitions-rs-static-async-generator-method-privatename-identifier.js @@ -61,40 +61,40 @@ info: | class C { static async * #$(value) { - yield await value; + yield * await value; } static async * #_(value) { - yield await value; + yield * await value; } static async * #\u{6F}(value) { - yield await value; + yield * await value; } static async * #\u2118(value) { - yield await value; + yield * await value; } static async * #ZW_\u200C_NJ(value) { - yield await value; + yield * await value; } static async * #ZW_\u200D_J(value) { - yield await value; + yield * await value; } - static async * $(value) { - yield * await this.#$(value); + static async * $() { + return this.#$; } - static async * _(value) { - yield * await this.#_(value); + static async * _() { + return this.#_; } - static async * \u{6F}(value) { - yield * await this.#\u{6F}(value); + static async * \u{6F}() { + return this.#\u{6F}; } - static async * \u2118(value) { - yield * await this.#\u2118(value); + static async * \u2118() { + return this.#\u2118; } - static async * ZW_\u200C_NJ(value) { - yield * await this.#ZW_\u200C_NJ(value); + static async * ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static async * ZW_\u200D_J(value) { - yield * await this.#ZW_\u200D_J(value); + static async * ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/statements/class/fields-regular-definitions-rs-static-generator-method-privatename-identifier-alt.js b/test/language/statements/class/fields-regular-definitions-rs-static-generator-method-privatename-identifier-alt.js index 87235f63cb..7dc79244d8 100644 --- a/test/language/statements/class/fields-regular-definitions-rs-static-generator-method-privatename-identifier-alt.js +++ b/test/language/statements/class/fields-regular-definitions-rs-static-generator-method-privatename-identifier-alt.js @@ -61,40 +61,40 @@ info: | class C { static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #o(value) { - yield value; + yield * value; } static * #℘(value) { - yield value; + yield * value; } static * #ZW_‌_NJ(value) { - yield value; + yield * value; } static * #ZW_‍_J(value) { - yield value; + yield * value; } - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * o(value) { - yield this.#o(value); + static get o() { + return this.#o; } - static * ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static * ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static * ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/statements/class/fields-regular-definitions-rs-static-generator-method-privatename-identifier.js b/test/language/statements/class/fields-regular-definitions-rs-static-generator-method-privatename-identifier.js index f2444b4a57..259d0a31f7 100644 --- a/test/language/statements/class/fields-regular-definitions-rs-static-generator-method-privatename-identifier.js +++ b/test/language/statements/class/fields-regular-definitions-rs-static-generator-method-privatename-identifier.js @@ -61,40 +61,40 @@ info: | class C { static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #\u{6F}(value) { - yield value; + yield * value; } static * #\u2118(value) { - yield value; + yield * value; } static * #ZW_\u200C_NJ(value) { - yield value; + yield * value; } static * #ZW_\u200D_J(value) { - yield value; + yield * value; } - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * \u{6F}(value) { - yield this.#\u{6F}(value); + static get \u{6F}() { + return this.#\u{6F}; } - static * \u2118(value) { - yield this.#\u2118(value); + static get \u2118() { + return this.#\u2118; } - static * ZW_\u200C_NJ(value) { - yield this.#ZW_\u200C_NJ(value); + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static * ZW_\u200D_J(value) { - yield this.#ZW_\u200D_J(value); + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/statements/class/fields-regular-definitions-static-private-methods-with-fields.js b/test/language/statements/class/fields-regular-definitions-static-private-methods-with-fields.js new file mode 100644 index 0000000000..680fb71fa3 --- /dev/null +++ b/test/language/statements/class/fields-regular-definitions-static-private-methods-with-fields.js @@ -0,0 +1,72 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-private-methods-with-fields.case +// - src/class-fields/productions/cls-decl-regular-definitions.template +/*--- +description: static private methods with fields (regular fields defintion) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +class C { + static #xVal; static #yVal + static #x(value) { + this.#xVal = value; + return this.#xVal; + } + static #y(value) { + this.#yVal = value; + return this.#yVal; + } + static x() { + return this.#x(42); + } + static y() { + return this.#y(43); + } +} + +var c = new C(); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7"); +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8"); +assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11"); +assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 13"); +assert.sameValue(C.y(), 43, "test 14"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16"); + +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18"); diff --git a/test/language/statements/class/fields-regular-definitions-static-private-methods.js b/test/language/statements/class/fields-regular-definitions-static-private-methods.js index 74b7858c7b..801cca5c01 100644 --- a/test/language/statements/class/fields-regular-definitions-static-private-methods.js +++ b/test/language/statements/class/fields-regular-definitions-static-private-methods.js @@ -24,17 +24,15 @@ info: | class C { - static #xVal; static #yVal + static #x(value) { - this.#xVal = value; - return this.#xVal; + return value / 2; } static #y(value) { - this.#y = value; - return this.#yVal; + return value * 2; } static x() { - return this.#x(42); + return this.#x(84); } static y() { return this.#y(43); @@ -44,18 +42,18 @@ class C { var c = new C(); // Test the private methods do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 1"); -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 2"); -assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 3"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 4"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 5"); -assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 6"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); // Test if private fields can be sucessfully accessed and set to value assert.sameValue(C.x(), 42, "test 7"); -assert.sameValue(C.y(), 43, "test 8"); +assert.sameValue(C.y(), 86, "test 8"); // Test the private fields do not appear as properties before after set to value -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 9"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); 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 index 9dd54fa739..31c39e343a 100644 --- 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 @@ -39,41 +39,51 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: 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: undefined, - enumerable: true, - writable: true, - configurable: 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, "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: undefined, + 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-gen-computed-symbol-names.js b/test/language/statements/class/fields-same-line-async-gen-computed-symbol-names.js index 948d23c827..6e0f597841 100644 --- 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 @@ -40,35 +40,45 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: 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.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, 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); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-gen-grammar-privatename-identifier-semantics-stringvalue.js b/test/language/statements/class/fields-same-line-async-gen-grammar-privatename-identifier-semantics-stringvalue.js index 6bd67d046c..95cfd47b36 100644 --- a/test/language/statements/class/fields-same-line-async-gen-grammar-privatename-identifier-semantics-stringvalue.js +++ b/test/language/statements/class/fields-same-line-async-gen-grammar-privatename-identifier-semantics-stringvalue.js @@ -98,12 +98,22 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(c.o(1), 1); -assert.sameValue(c.℘(1), 1); -assert.sameValue(c.ZW_‌_NJ(1), 1); -assert.sameValue(c.ZW_‍_J(1), 1); - 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(c.o(1), 1); + assert.sameValue(c.℘(1), 1); + assert.sameValue(c.ZW_‌_NJ(1), 1); + assert.sameValue(c.ZW_‍_J(1), 1); + } + + return Promise.resolve(assertions()); }, $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 index 4ca55d8d96..1c9c16471e 100644 --- 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 @@ -40,38 +40,48 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: 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.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 + }); + + 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 + }); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-gen-private-names.js b/test/language/statements/class/fields-same-line-async-gen-private-names.js index adbd03e6c6..9738418584 100644 --- a/test/language/statements/class/fields-same-line-async-gen-private-names.js +++ b/test/language/statements/class/fields-same-line-async-gen-private-names.js @@ -47,24 +47,34 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -// Test the private fields do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); -assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); -assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); - -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); -assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); -assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); - -// Test if private fields can be sucessfully accessed and set to value -assert.sameValue(c.x(), 42, "test 7"); -assert.sameValue(c.y(), 43, "test 8"); - -// Test the private fields do not appear as properties before after set to value -assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 9"); -assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 10"); - 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') + } + } + // Test the private fields do not appear as properties before set to value + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + + // Test if private fields can be sucessfully accessed and set to value + assert.sameValue(c.x(), 42, "test 7"); + assert.sameValue(c.y(), 43, "test 8"); + + // Test the private fields do not appear as properties before after set to value + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 9"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 10"); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-gen-rs-field-identifier-initializer.js b/test/language/statements/class/fields-same-line-async-gen-rs-field-identifier-initializer.js index 6906aadfa1..2b070254b3 100644 --- a/test/language/statements/class/fields-same-line-async-gen-rs-field-identifier-initializer.js +++ b/test/language/statements/class/fields-same-line-async-gen-rs-field-identifier-initializer.js @@ -74,14 +74,24 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(c.$, 1); -assert.sameValue(c._, 1); -assert.sameValue(c.\u{6F}, 1); -assert.sameValue(c.\u2118, 1); -assert.sameValue(c.ZW_\u200C_NJ, 1); -assert.sameValue(c.ZW_\u200D_J, 1); - 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(c.$, 1); + assert.sameValue(c._, 1); + assert.sameValue(c.\u{6F}, 1); + assert.sameValue(c.\u2118, 1); + assert.sameValue(c.ZW_\u200C_NJ, 1); + assert.sameValue(c.ZW_\u200D_J, 1); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-gen-rs-field-identifier.js b/test/language/statements/class/fields-same-line-async-gen-rs-field-identifier.js index 8db7ab527c..78359bed27 100644 --- a/test/language/statements/class/fields-same-line-async-gen-rs-field-identifier.js +++ b/test/language/statements/class/fields-same-line-async-gen-rs-field-identifier.js @@ -74,21 +74,31 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -c.$ = 1; -c._ = 1; -c.\u{6F} = 1; -c.\u2118 = 1; -c.ZW_\u200C_NJ = 1; -c.ZW_\u200D_J = 1; - -assert.sameValue(c.$, 1); -assert.sameValue(c._, 1); -assert.sameValue(c.\u{6F}, 1); -assert.sameValue(c.\u2118, 1); -assert.sameValue(c.ZW_\u200C_NJ, 1); -assert.sameValue(c.ZW_\u200D_J, 1); - 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') + } + } + c.$ = 1; + c._ = 1; + c.\u{6F} = 1; + c.\u2118 = 1; + c.ZW_\u200C_NJ = 1; + c.ZW_\u200D_J = 1; + + assert.sameValue(c.$, 1); + assert.sameValue(c._, 1); + assert.sameValue(c.\u{6F}, 1); + assert.sameValue(c.\u2118, 1); + assert.sameValue(c.ZW_\u200C_NJ, 1); + assert.sameValue(c.ZW_\u200D_J, 1); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-gen-rs-privatename-identifier-alt.js b/test/language/statements/class/fields-same-line-async-gen-rs-privatename-identifier-alt.js index 316381c808..8e51e99117 100644 --- a/test/language/statements/class/fields-same-line-async-gen-rs-privatename-identifier-alt.js +++ b/test/language/statements/class/fields-same-line-async-gen-rs-privatename-identifier-alt.js @@ -95,15 +95,25 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(c.$(1), 1); -assert.sameValue(c._(1), 1); -assert.sameValue(c.\u{6F}(1), 1); -assert.sameValue(c.℘(1), 1); -assert.sameValue(c.ZW_‌_NJ(1), 1); -assert.sameValue(c.ZW_‍_J(1), 1); - - 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(c.$(1), 1); + assert.sameValue(c._(1), 1); + assert.sameValue(c.\u{6F}(1), 1); + assert.sameValue(c.℘(1), 1); + assert.sameValue(c.ZW_‌_NJ(1), 1); + assert.sameValue(c.ZW_‍_J(1), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-gen-rs-privatename-identifier-initializer-alt.js b/test/language/statements/class/fields-same-line-async-gen-rs-privatename-identifier-initializer-alt.js index a2d85fa476..147e348503 100644 --- a/test/language/statements/class/fields-same-line-async-gen-rs-privatename-identifier-initializer-alt.js +++ b/test/language/statements/class/fields-same-line-async-gen-rs-privatename-identifier-initializer-alt.js @@ -89,15 +89,25 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(c.$(), 1); -assert.sameValue(c._(), 1); -assert.sameValue(c.\u{6F}(), 1); -assert.sameValue(c.℘(), 1); -assert.sameValue(c.ZW_‌_NJ(), 1); -assert.sameValue(c.ZW_‍_J(), 1); - - 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(c.$(), 1); + assert.sameValue(c._(), 1); + assert.sameValue(c.\u{6F}(), 1); + assert.sameValue(c.℘(), 1); + assert.sameValue(c.ZW_‌_NJ(), 1); + assert.sameValue(c.ZW_‍_J(), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-gen-rs-privatename-identifier-initializer.js b/test/language/statements/class/fields-same-line-async-gen-rs-privatename-identifier-initializer.js index 71ad00009a..62c45ace28 100644 --- a/test/language/statements/class/fields-same-line-async-gen-rs-privatename-identifier-initializer.js +++ b/test/language/statements/class/fields-same-line-async-gen-rs-privatename-identifier-initializer.js @@ -89,15 +89,25 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(c.$(), 1); -assert.sameValue(c._(), 1); -assert.sameValue(c.\u{6F}(), 1); -assert.sameValue(c.\u2118(), 1); -assert.sameValue(c.ZW_\u200C_NJ(), 1); -assert.sameValue(c.ZW_\u200D_J(), 1); - - 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(c.$(), 1); + assert.sameValue(c._(), 1); + assert.sameValue(c.\u{6F}(), 1); + assert.sameValue(c.\u2118(), 1); + assert.sameValue(c.ZW_\u200C_NJ(), 1); + assert.sameValue(c.ZW_\u200D_J(), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-gen-rs-privatename-identifier.js b/test/language/statements/class/fields-same-line-async-gen-rs-privatename-identifier.js index 992843e45c..d6ba67cd60 100644 --- a/test/language/statements/class/fields-same-line-async-gen-rs-privatename-identifier.js +++ b/test/language/statements/class/fields-same-line-async-gen-rs-privatename-identifier.js @@ -95,15 +95,25 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(c.$(1), 1); -assert.sameValue(c._(1), 1); -assert.sameValue(c.\u{6F}(1), 1); -assert.sameValue(c.\u2118(1), 1); -assert.sameValue(c.ZW_\u200C_NJ(1), 1); -assert.sameValue(c.ZW_\u200D_J(1), 1); - - 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(c.$(1), 1); + assert.sameValue(c._(1), 1); + assert.sameValue(c.\u{6F}(1), 1); + assert.sameValue(c.\u2118(1), 1); + assert.sameValue(c.ZW_\u200C_NJ(1), 1); + assert.sameValue(c.ZW_\u200D_J(1), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-gen-rs-static-async-generator-method-privatename-identifier-alt.js b/test/language/statements/class/fields-same-line-async-gen-rs-static-async-generator-method-privatename-identifier-alt.js index 263742e08c..eee91de28f 100644 --- a/test/language/statements/class/fields-same-line-async-gen-rs-static-async-generator-method-privatename-identifier-alt.js +++ b/test/language/statements/class/fields-same-line-async-gen-rs-static-async-generator-method-privatename-identifier-alt.js @@ -61,41 +61,41 @@ info: | class C { - async *m() { return 42; } static async #$(value) { + async *m() { return 42; } static async * #$(value) { yield await value; } - static async #_(value) { + static async * #_(value) { yield await value; } - static async #o(value) { + static async * #o(value) { yield await value; } - static async #℘(value) { + static async * #℘(value) { yield await value; } - static async #ZW_‌_NJ(value) { + static async * #ZW_‌_NJ(value) { yield await value; } - static async #ZW_‍_J(value) { + static async * #ZW_‍_J(value) { yield await value; }; - static async $(value) { - yield * await this.#$(value); + static get $() { + return this.#$; } - static async _(value) { - yield * await this.#_(value); + static get _() { + return this.#_; } - static async o(value) { - yield * await this.#o(value); + static get o() { + return this.#o; } - static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } @@ -111,25 +111,35 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -Promise.all([ - C.$(1).next(), - C._(1).next(), - C.o(1).next(), - C.℘(1).next(), // DO NOT CHANGE THE NAME OF THIS FIELD - C.ZW_‌_NJ(1).next(), // DO NOT CHANGE THE NAME OF THIS FIELD - C.ZW_‍_J(1).next(), // DO NOT CHANGE THE NAME OF THIS FIELD -]).then(results => { - - assert.sameValue(results[0].value, 1); - assert.sameValue(results[1].value, 1); - assert.sameValue(results[2].value, 1); - assert.sameValue(results[3].value, 1); - assert.sameValue(results[4].value, 1); - assert.sameValue(results[5].value, 1); - -}, $DONE).then($DONE, $DONE); - 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') + } + } + Promise.all([ + C.$(1).next(), + C._(1).next(), + C.o(1).next(), + C.℘(1).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‌_NJ(1).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‍_J(1).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + ]).then(results => { + + assert.sameValue(results[0].value, 1); + assert.sameValue(results[1].value, 1); + assert.sameValue(results[2].value, 1); + assert.sameValue(results[3].value, 1); + assert.sameValue(results[4].value, 1); + assert.sameValue(results[5].value, 1); + + }, $DONE).then($DONE, $DONE); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-gen-rs-static-async-generator-method-privatename-identifier.js b/test/language/statements/class/fields-same-line-async-gen-rs-static-async-generator-method-privatename-identifier.js index c63da90036..5c5d6ef151 100644 --- a/test/language/statements/class/fields-same-line-async-gen-rs-static-async-generator-method-privatename-identifier.js +++ b/test/language/statements/class/fields-same-line-async-gen-rs-static-async-generator-method-privatename-identifier.js @@ -62,40 +62,40 @@ info: | class C { async *m() { return 42; } static async * #$(value) { - yield await value; + yield * await value; } static async * #_(value) { - yield await value; + yield * await value; } static async * #\u{6F}(value) { - yield await value; + yield * await value; } static async * #\u2118(value) { - yield await value; + yield * await value; } static async * #ZW_\u200C_NJ(value) { - yield await value; + yield * await value; } static async * #ZW_\u200D_J(value) { - yield await value; + yield * await value; }; - static async * $(value) { - yield * await this.#$(value); + static async * $() { + return this.#$; } - static async * _(value) { - yield * await this.#_(value); + static async * _() { + return this.#_; } - static async * \u{6F}(value) { - yield * await this.#\u{6F}(value); + static async * \u{6F}() { + return this.#\u{6F}; } - static async * \u2118(value) { - yield * await this.#\u2118(value); + static async * \u2118() { + return this.#\u2118; } - static async * ZW_\u200C_NJ(value) { - yield * await this.#ZW_\u200C_NJ(value); + static async * ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static async * ZW_\u200D_J(value) { - yield * await this.#ZW_\u200D_J(value); + static async * ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } @@ -111,26 +111,36 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -Promise.all([ - C.$(1).next(), - C._(1).next(), - C.\u{6F}(1).next(), - C.\u2118(1).next(), - C.ZW_\u200C_NJ(1).next(), - C.ZW_\u200D_J(1).next(), -]).then(results => { - - assert.sameValue(results[0].value, 1); - assert.sameValue(results[1].value, 1); - assert.sameValue(results[2].value, 1); - assert.sameValue(results[3].value, 1); - assert.sameValue(results[4].value, 1); - assert.sameValue(results[5].value, 1); - -}, $DONE).then($DONE, $DONE); - - 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') + } + } + Promise.all([ + C.$(1).next(), + C._(1).next(), + C.\u{6F}(1).next(), + C.\u2118(1).next(), + C.ZW_\u200C_NJ(1).next(), + C.ZW_\u200D_J(1).next(), + ]).then(results => { + + assert.sameValue(results[0].value, 1); + assert.sameValue(results[1].value, 1); + assert.sameValue(results[2].value, 1); + assert.sameValue(results[3].value, 1); + assert.sameValue(results[4].value, 1); + assert.sameValue(results[5].value, 1); + + }, $DONE).then($DONE, $DONE); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-gen-rs-static-async-method-privatename-identifier-alt.js b/test/language/statements/class/fields-same-line-async-gen-rs-static-async-method-privatename-identifier-alt.js index d5b17a2aa2..b50c4363db 100644 --- a/test/language/statements/class/fields-same-line-async-gen-rs-static-async-method-privatename-identifier-alt.js +++ b/test/language/statements/class/fields-same-line-async-gen-rs-static-async-method-privatename-identifier-alt.js @@ -111,25 +111,35 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -Promise.all([ - C.$(1), - C._(1), - C.o(1), - C.℘(1), // DO NOT CHANGE THE NAME OF THIS FIELD - C.ZW_‌_NJ(1), // DO NOT CHANGE THE NAME OF THIS FIELD - C.ZW_‍_J(1), // DO NOT CHANGE THE NAME OF THIS FIELD -]).then(results => { - - assert.sameValue(results[0], 1); - assert.sameValue(results[1], 1); - assert.sameValue(results[2], 1); - assert.sameValue(results[3], 1); - assert.sameValue(results[4], 1); - assert.sameValue(results[5], 1); - -}, $DONE).then($DONE, $DONE); - 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') + } + } + Promise.all([ + C.$(1), + C._(1), + C.o(1), + C.℘(1), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‌_NJ(1), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‍_J(1), // DO NOT CHANGE THE NAME OF THIS FIELD + ]).then(results => { + + assert.sameValue(results[0], 1); + assert.sameValue(results[1], 1); + assert.sameValue(results[2], 1); + assert.sameValue(results[3], 1); + assert.sameValue(results[4], 1); + assert.sameValue(results[5], 1); + + }, $DONE).then($DONE, $DONE); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-gen-rs-static-async-method-privatename-identifier.js b/test/language/statements/class/fields-same-line-async-gen-rs-static-async-method-privatename-identifier.js index 448e95ffdf..88fcb8cead 100644 --- a/test/language/statements/class/fields-same-line-async-gen-rs-static-async-method-privatename-identifier.js +++ b/test/language/statements/class/fields-same-line-async-gen-rs-static-async-method-privatename-identifier.js @@ -111,26 +111,36 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -Promise.all([ - C.$(1), - C._(1), - C.\u{6F}(1), - C.\u2118(1), - C.ZW_\u200C_NJ(1), - C.ZW_\u200D_J(1), -]).then(results => { - - assert.sameValue(results[0], 1); - assert.sameValue(results[1], 1); - assert.sameValue(results[2], 1); - assert.sameValue(results[3], 1); - assert.sameValue(results[4], 1); - assert.sameValue(results[5], 1); - -}, $DONE).then($DONE, $DONE); - - 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') + } + } + Promise.all([ + C.$(1), + C._(1), + C.\u{6F}(1), + C.\u2118(1), + C.ZW_\u200C_NJ(1), + C.ZW_\u200D_J(1), + ]).then(results => { + + assert.sameValue(results[0], 1); + assert.sameValue(results[1], 1); + assert.sameValue(results[2], 1); + assert.sameValue(results[3], 1); + assert.sameValue(results[4], 1); + assert.sameValue(results[5], 1); + + }, $DONE).then($DONE, $DONE); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-gen-rs-static-generator-method-privatename-identifier-alt.js b/test/language/statements/class/fields-same-line-async-gen-rs-static-generator-method-privatename-identifier-alt.js index 8557f9e155..a9fdec76f6 100644 --- a/test/language/statements/class/fields-same-line-async-gen-rs-static-generator-method-privatename-identifier-alt.js +++ b/test/language/statements/class/fields-same-line-async-gen-rs-static-generator-method-privatename-identifier-alt.js @@ -62,40 +62,40 @@ info: | class C { async *m() { return 42; } static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #o(value) { - yield value; + yield * value; } static * #℘(value) { - yield value; + yield * value; } static * #ZW_‌_NJ(value) { - yield value; + yield * value; } static * #ZW_‍_J(value) { - yield value; + yield * value; }; - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * o(value) { - yield this.#o(value); + static get o() { + return this.#o; } - static * ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static * ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static * ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } @@ -111,14 +111,24 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1).next().value, 1); -assert.sameValue(C._(1).next().value, 1); -assert.sameValue(C.o(1).next().value, 1); -assert.sameValue(C.℘(1).next().value, 1); -assert.sameValue(C.ZW_‌_NJ(1).next().value, 1); -assert.sameValue(C.ZW_‍_J(1).next().value, 1); - 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(C.$(1).next().value, 1); + assert.sameValue(C._(1).next().value, 1); + assert.sameValue(C.o(1).next().value, 1); + assert.sameValue(C.℘(1).next().value, 1); + assert.sameValue(C.ZW_‌_NJ(1).next().value, 1); + assert.sameValue(C.ZW_‍_J(1).next().value, 1); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-gen-rs-static-generator-method-privatename-identifier.js b/test/language/statements/class/fields-same-line-async-gen-rs-static-generator-method-privatename-identifier.js index 2310df37d4..182d6b5aa1 100644 --- a/test/language/statements/class/fields-same-line-async-gen-rs-static-generator-method-privatename-identifier.js +++ b/test/language/statements/class/fields-same-line-async-gen-rs-static-generator-method-privatename-identifier.js @@ -62,40 +62,40 @@ info: | class C { async *m() { return 42; } static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #\u{6F}(value) { - yield value; + yield * value; } static * #\u2118(value) { - yield value; + yield * value; } static * #ZW_\u200C_NJ(value) { - yield value; + yield * value; } static * #ZW_\u200D_J(value) { - yield value; + yield * value; }; - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * \u{6F}(value) { - yield this.#\u{6F}(value); + static get \u{6F}() { + return this.#\u{6F}; } - static * \u2118(value) { - yield this.#\u2118(value); + static get \u2118() { + return this.#\u2118; } - static * ZW_\u200C_NJ(value) { - yield this.#ZW_\u200C_NJ(value); + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static * ZW_\u200D_J(value) { - yield this.#ZW_\u200D_J(value); + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } @@ -111,15 +111,25 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1).next().value, 1); -assert.sameValue(C._(1).next().value, 1); -assert.sameValue(C.\u{6F}(1).next().value, 1); -assert.sameValue(C.\u2118(1).next().value, 1); -assert.sameValue(C.ZW_\u200C_NJ(1).next().value, 1); -assert.sameValue(C.ZW_\u200D_J(1).next().value, 1); - - 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(C.$(1).next().value, 1); + assert.sameValue(C._(1).next().value, 1); + assert.sameValue(C.\u{6F}(1).next().value, 1); + assert.sameValue(C.\u2118(1).next().value, 1); + assert.sameValue(C.ZW_\u200C_NJ(1).next().value, 1); + assert.sameValue(C.ZW_\u200D_J(1).next().value, 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-gen-rs-static-method-privatename-identifier-alt.js b/test/language/statements/class/fields-same-line-async-gen-rs-static-method-privatename-identifier-alt.js index 3a5dbc94e5..fc25be8434 100644 --- a/test/language/statements/class/fields-same-line-async-gen-rs-static-method-privatename-identifier-alt.js +++ b/test/language/statements/class/fields-same-line-async-gen-rs-static-method-privatename-identifier-alt.js @@ -108,15 +108,25 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1), 1); -assert.sameValue(C._(1), 1); -assert.sameValue(C.o(1), 1); -assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD -assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD -assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD - - 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(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.o(1), 1); + assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-gen-rs-static-method-privatename-identifier.js b/test/language/statements/class/fields-same-line-async-gen-rs-static-method-privatename-identifier.js index 34822c8641..6ae403902f 100644 --- a/test/language/statements/class/fields-same-line-async-gen-rs-static-method-privatename-identifier.js +++ b/test/language/statements/class/fields-same-line-async-gen-rs-static-method-privatename-identifier.js @@ -108,15 +108,25 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1), 1); -assert.sameValue(C._(1), 1); -assert.sameValue(C.\u{6F}(1), 1); -assert.sameValue(C.\u2118(1), 1); -assert.sameValue(C.ZW_\u200C_NJ(1), 1); -assert.sameValue(C.ZW_\u200D_J(1), 1); - - 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(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.\u{6F}(1), 1); + assert.sameValue(C.\u2118(1), 1); + assert.sameValue(C.ZW_\u200C_NJ(1), 1); + assert.sameValue(C.ZW_\u200D_J(1), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-gen-rs-static-privatename-identifier-alt-by-classname.js b/test/language/statements/class/fields-same-line-async-gen-rs-static-privatename-identifier-alt-by-classname.js index ff06256006..efc03fdd69 100644 --- a/test/language/statements/class/fields-same-line-async-gen-rs-static-privatename-identifier-alt-by-classname.js +++ b/test/language/statements/class/fields-same-line-async-gen-rs-static-privatename-identifier-alt-by-classname.js @@ -96,15 +96,25 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1), 1); -assert.sameValue(C._(1), 1); -assert.sameValue(C.o(1), 1); -assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD -assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD -assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD - - 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(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.o(1), 1); + assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-gen-rs-static-privatename-identifier-alt.js b/test/language/statements/class/fields-same-line-async-gen-rs-static-privatename-identifier-alt.js index 5c9a05df8e..c4a7cfee57 100644 --- a/test/language/statements/class/fields-same-line-async-gen-rs-static-privatename-identifier-alt.js +++ b/test/language/statements/class/fields-same-line-async-gen-rs-static-privatename-identifier-alt.js @@ -96,15 +96,25 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1), 1); -assert.sameValue(C._(1), 1); -assert.sameValue(C.o(1), 1); -assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD -assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD -assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD - - 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(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.o(1), 1); + assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-gen-rs-static-privatename-identifier-by-classname.js b/test/language/statements/class/fields-same-line-async-gen-rs-static-privatename-identifier-by-classname.js index 64fa0b3f17..668651c021 100644 --- a/test/language/statements/class/fields-same-line-async-gen-rs-static-privatename-identifier-by-classname.js +++ b/test/language/statements/class/fields-same-line-async-gen-rs-static-privatename-identifier-by-classname.js @@ -96,15 +96,25 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1), 1); -assert.sameValue(C._(1), 1); -assert.sameValue(C.\u{6F}(1), 1); -assert.sameValue(C.\u2118(1), 1); -assert.sameValue(C.ZW_\u200C_NJ(1), 1); -assert.sameValue(C.ZW_\u200D_J(1), 1); - - 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(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.\u{6F}(1), 1); + assert.sameValue(C.\u2118(1), 1); + assert.sameValue(C.ZW_\u200C_NJ(1), 1); + assert.sameValue(C.ZW_\u200D_J(1), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js b/test/language/statements/class/fields-same-line-async-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js index 832d2cfc79..5533fb009e 100644 --- a/test/language/statements/class/fields-same-line-async-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js +++ b/test/language/statements/class/fields-same-line-async-gen-rs-static-privatename-identifier-initializer-alt-by-classname.js @@ -90,15 +90,25 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(), 1); -assert.sameValue(C._(), 1); -assert.sameValue(C.\u{6F}(), 1); -assert.sameValue(C.℘(), 1); -assert.sameValue(C.ZW_‌_NJ(), 1); -assert.sameValue(C.ZW_‍_J(), 1); - - 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(C.$(), 1); + assert.sameValue(C._(), 1); + assert.sameValue(C.\u{6F}(), 1); + assert.sameValue(C.℘(), 1); + assert.sameValue(C.ZW_‌_NJ(), 1); + assert.sameValue(C.ZW_‍_J(), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-gen-rs-static-privatename-identifier-initializer-alt.js b/test/language/statements/class/fields-same-line-async-gen-rs-static-privatename-identifier-initializer-alt.js index 15d9c9b353..39da868e54 100644 --- a/test/language/statements/class/fields-same-line-async-gen-rs-static-privatename-identifier-initializer-alt.js +++ b/test/language/statements/class/fields-same-line-async-gen-rs-static-privatename-identifier-initializer-alt.js @@ -90,15 +90,25 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(), 1); -assert.sameValue(C._(), 1); -assert.sameValue(C.\u{6F}(), 1); -assert.sameValue(C.℘(), 1); -assert.sameValue(C.ZW_‌_NJ(), 1); -assert.sameValue(C.ZW_‍_J(), 1); - - 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(C.$(), 1); + assert.sameValue(C._(), 1); + assert.sameValue(C.\u{6F}(), 1); + assert.sameValue(C.℘(), 1); + assert.sameValue(C.ZW_‌_NJ(), 1); + assert.sameValue(C.ZW_‍_J(), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-gen-rs-static-privatename-identifier-initializer.js b/test/language/statements/class/fields-same-line-async-gen-rs-static-privatename-identifier-initializer.js index c5b703caea..73110c59fe 100644 --- a/test/language/statements/class/fields-same-line-async-gen-rs-static-privatename-identifier-initializer.js +++ b/test/language/statements/class/fields-same-line-async-gen-rs-static-privatename-identifier-initializer.js @@ -90,15 +90,25 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(), 1); -assert.sameValue(C._(), 1); -assert.sameValue(C.\u{6F}(), 1); -assert.sameValue(C.\u2118(), 1); -assert.sameValue(C.ZW_\u200C_NJ(), 1); -assert.sameValue(C.ZW_\u200D_J(), 1); - - 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(C.$(), 1); + assert.sameValue(C._(), 1); + assert.sameValue(C.\u{6F}(), 1); + assert.sameValue(C.\u2118(), 1); + assert.sameValue(C.ZW_\u200C_NJ(), 1); + assert.sameValue(C.ZW_\u200D_J(), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-gen-rs-static-privatename-identifier.js b/test/language/statements/class/fields-same-line-async-gen-rs-static-privatename-identifier.js index 2c2149d586..1ef59ac397 100644 --- a/test/language/statements/class/fields-same-line-async-gen-rs-static-privatename-identifier.js +++ b/test/language/statements/class/fields-same-line-async-gen-rs-static-privatename-identifier.js @@ -96,15 +96,25 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1), 1); -assert.sameValue(C._(1), 1); -assert.sameValue(C.\u{6F}(1), 1); -assert.sameValue(C.\u2118(1), 1); -assert.sameValue(C.ZW_\u200C_NJ(1), 1); -assert.sameValue(C.ZW_\u200D_J(1), 1); - - 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(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.\u{6F}(1), 1); + assert.sameValue(C.\u2118(1), 1); + assert.sameValue(C.ZW_\u200C_NJ(1), 1); + assert.sameValue(C.ZW_\u200D_J(1), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-gen-static-private-fields.js b/test/language/statements/class/fields-same-line-async-gen-static-private-fields.js index 25507fab39..7760041b8e 100644 --- a/test/language/statements/class/fields-same-line-async-gen-static-private-fields.js +++ b/test/language/statements/class/fields-same-line-async-gen-static-private-fields.js @@ -47,24 +47,34 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -// Test the private fields do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); -assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); -assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); - -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); -assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); -assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); - -// Test if private fields can be sucessfully accessed and set to value -assert.sameValue(C.x(), 42, "test 7"); -assert.sameValue(C.y(), 43, "test 8"); - -// Test the private fields do not appear as properties before after set to value -assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); -assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); - 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') + } + } + // Test the private fields do not appear as properties before set to value + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + + // Test if private fields can be sucessfully accessed and set to value + assert.sameValue(C.x(), 42, "test 7"); + assert.sameValue(C.y(), 43, "test 8"); + + // Test the private fields do not appear as properties before after set to value + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-gen-static-private-methods-with-fields.js b/test/language/statements/class/fields-same-line-async-gen-static-private-methods-with-fields.js new file mode 100644 index 0000000000..a372971358 --- /dev/null +++ b/test/language/statements/class/fields-same-line-async-gen-static-private-methods-with-fields.js @@ -0,0 +1,98 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-private-methods-with-fields.case +// - src/class-fields/productions/cls-decl-after-same-line-async-gen.template +/*--- +description: static private methods with fields (field definitions after an async generator in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public, + async-iteration] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +class C { + async *m() { return 42; } static #xVal; static #yVal; + static #x(value) { + this.#xVal = value; + return this.#xVal; + } + static #y(value) { + this.#yVal = value; + return this.#yVal; + } + static x() { + return this.#x(42); + } + static y() { + return this.#y(43); + } +} + +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') + } + } + // Test the private methods do not appear as properties before set to value + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7"); + assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8"); + assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10"); + assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11"); + assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12"); + + // Test if private fields can be sucessfully accessed and set to value + assert.sameValue(C.x(), 42, "test 13"); + assert.sameValue(C.y(), 43, "test 14"); + + // Test the private fields do not appear as properties before after set to value + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16"); + + assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17"); + assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18"); + } + + return Promise.resolve(assertions()); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-gen-static-private-methods.js b/test/language/statements/class/fields-same-line-async-gen-static-private-methods.js index 56dec2a2ee..e8a86da184 100644 --- a/test/language/statements/class/fields-same-line-async-gen-static-private-methods.js +++ b/test/language/statements/class/fields-same-line-async-gen-static-private-methods.js @@ -25,17 +25,15 @@ info: | class C { - async *m() { return 42; } static #xVal; static #yVal; + async *m() { return 42; } ; static #x(value) { - this.#xVal = value; - return this.#xVal; + return value / 2; } static #y(value) { - this.#y = value; - return this.#yVal; + return value * 2; } static x() { - return this.#x(42); + return this.#x(84); } static y() { return this.#y(43); @@ -53,24 +51,34 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -// Test the private methods do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 1"); -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 2"); -assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 3"); - -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 4"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 5"); -assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 6"); - -// Test if private fields can be sucessfully accessed and set to value -assert.sameValue(C.x(), 42, "test 7"); -assert.sameValue(C.y(), 43, "test 8"); - -// Test the private fields do not appear as properties before after set to value -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 9"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 10"); - 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') + } + } + // Test the private methods do not appear as properties before set to value + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + + // Test if private fields can be sucessfully accessed and set to value + assert.sameValue(C.x(), 42, "test 7"); + assert.sameValue(C.y(), 86, "test 8"); + + // Test the private fields do not appear as properties before after set to value + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); + } + + return Promise.resolve(assertions()); }, $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 index 759eb62bd1..fa049206fd 100644 --- 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 @@ -38,47 +38,57 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: 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: undefined, - 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: 39, - enumerable: true, - writable: true, - configurable: true -}); - -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "d"), false); -assert.sameValue(Object.hasOwnProperty.call(C, "d"), false); - -verifyProperty(c, "d", { - value: 42, - enumerable: true, - writable: true, - configurable: 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: undefined, + 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: 39, + enumerable: true, + writable: true, + configurable: true + }); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "d"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "d"), false); + + verifyProperty(c, "d", { + 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-computed-names.js b/test/language/statements/class/fields-same-line-async-method-computed-names.js index f68257e2a0..63765da652 100644 --- 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 @@ -39,40 +39,50 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: 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: undefined, - enumerable: true, - writable: true, - configurable: 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, "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: undefined, + 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-computed-symbol-names.js b/test/language/statements/class/fields-same-line-async-method-computed-symbol-names.js index 11eda8bd65..1769248f7b 100644 --- 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 @@ -40,34 +40,44 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: 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); + + 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, 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); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-method-grammar-privatename-identifier-semantics-stringvalue.js b/test/language/statements/class/fields-same-line-async-method-grammar-privatename-identifier-semantics-stringvalue.js index b1a083f770..3a37d59e2a 100644 --- a/test/language/statements/class/fields-same-line-async-method-grammar-privatename-identifier-semantics-stringvalue.js +++ b/test/language/statements/class/fields-same-line-async-method-grammar-privatename-identifier-semantics-stringvalue.js @@ -98,11 +98,21 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(c.o(1), 1); -assert.sameValue(c.℘(1), 1); -assert.sameValue(c.ZW_‌_NJ(1), 1); -assert.sameValue(c.ZW_‍_J(1), 1); - 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(c.o(1), 1); + assert.sameValue(c.℘(1), 1); + assert.sameValue(c.ZW_‌_NJ(1), 1); + assert.sameValue(c.ZW_‍_J(1), 1); + } + + return Promise.resolve(assertions()); }, $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 index a479fdd3c3..87c14e1d95 100644 --- 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 @@ -40,37 +40,47 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: 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); + + 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 + }); + + 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 + }); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-method-private-names.js b/test/language/statements/class/fields-same-line-async-method-private-names.js index 9f58eb22d2..8d412af6c4 100644 --- a/test/language/statements/class/fields-same-line-async-method-private-names.js +++ b/test/language/statements/class/fields-same-line-async-method-private-names.js @@ -47,23 +47,33 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -// Test the private fields do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); -assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); -assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); - -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); -assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); -assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); - -// Test if private fields can be sucessfully accessed and set to value -assert.sameValue(c.x(), 42, "test 7"); -assert.sameValue(c.y(), 43, "test 8"); - -// Test the private fields do not appear as properties before after set to value -assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 9"); -assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 10"); - 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') + } + } + // Test the private fields do not appear as properties before set to value + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + + // Test if private fields can be sucessfully accessed and set to value + assert.sameValue(c.x(), 42, "test 7"); + assert.sameValue(c.y(), 43, "test 8"); + + // Test the private fields do not appear as properties before after set to value + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 9"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 10"); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-method-rs-field-identifier-initializer.js b/test/language/statements/class/fields-same-line-async-method-rs-field-identifier-initializer.js index e1b07b248c..de1f6e360a 100644 --- a/test/language/statements/class/fields-same-line-async-method-rs-field-identifier-initializer.js +++ b/test/language/statements/class/fields-same-line-async-method-rs-field-identifier-initializer.js @@ -74,13 +74,23 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(c.$, 1); -assert.sameValue(c._, 1); -assert.sameValue(c.\u{6F}, 1); -assert.sameValue(c.\u2118, 1); -assert.sameValue(c.ZW_\u200C_NJ, 1); -assert.sameValue(c.ZW_\u200D_J, 1); - 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(c.$, 1); + assert.sameValue(c._, 1); + assert.sameValue(c.\u{6F}, 1); + assert.sameValue(c.\u2118, 1); + assert.sameValue(c.ZW_\u200C_NJ, 1); + assert.sameValue(c.ZW_\u200D_J, 1); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-method-rs-field-identifier.js b/test/language/statements/class/fields-same-line-async-method-rs-field-identifier.js index 9ab607ddbf..8b95cb7b07 100644 --- a/test/language/statements/class/fields-same-line-async-method-rs-field-identifier.js +++ b/test/language/statements/class/fields-same-line-async-method-rs-field-identifier.js @@ -74,20 +74,30 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -c.$ = 1; -c._ = 1; -c.\u{6F} = 1; -c.\u2118 = 1; -c.ZW_\u200C_NJ = 1; -c.ZW_\u200D_J = 1; - -assert.sameValue(c.$, 1); -assert.sameValue(c._, 1); -assert.sameValue(c.\u{6F}, 1); -assert.sameValue(c.\u2118, 1); -assert.sameValue(c.ZW_\u200C_NJ, 1); -assert.sameValue(c.ZW_\u200D_J, 1); - 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') + } + } + c.$ = 1; + c._ = 1; + c.\u{6F} = 1; + c.\u2118 = 1; + c.ZW_\u200C_NJ = 1; + c.ZW_\u200D_J = 1; + + assert.sameValue(c.$, 1); + assert.sameValue(c._, 1); + assert.sameValue(c.\u{6F}, 1); + assert.sameValue(c.\u2118, 1); + assert.sameValue(c.ZW_\u200C_NJ, 1); + assert.sameValue(c.ZW_\u200D_J, 1); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-method-rs-privatename-identifier-alt.js b/test/language/statements/class/fields-same-line-async-method-rs-privatename-identifier-alt.js index a0819035aa..e91deb5ad0 100644 --- a/test/language/statements/class/fields-same-line-async-method-rs-privatename-identifier-alt.js +++ b/test/language/statements/class/fields-same-line-async-method-rs-privatename-identifier-alt.js @@ -95,14 +95,24 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(c.$(1), 1); -assert.sameValue(c._(1), 1); -assert.sameValue(c.\u{6F}(1), 1); -assert.sameValue(c.℘(1), 1); -assert.sameValue(c.ZW_‌_NJ(1), 1); -assert.sameValue(c.ZW_‍_J(1), 1); - - 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(c.$(1), 1); + assert.sameValue(c._(1), 1); + assert.sameValue(c.\u{6F}(1), 1); + assert.sameValue(c.℘(1), 1); + assert.sameValue(c.ZW_‌_NJ(1), 1); + assert.sameValue(c.ZW_‍_J(1), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-method-rs-privatename-identifier-initializer-alt.js b/test/language/statements/class/fields-same-line-async-method-rs-privatename-identifier-initializer-alt.js index 79ade95804..162cbf1d4d 100644 --- a/test/language/statements/class/fields-same-line-async-method-rs-privatename-identifier-initializer-alt.js +++ b/test/language/statements/class/fields-same-line-async-method-rs-privatename-identifier-initializer-alt.js @@ -89,14 +89,24 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(c.$(), 1); -assert.sameValue(c._(), 1); -assert.sameValue(c.\u{6F}(), 1); -assert.sameValue(c.℘(), 1); -assert.sameValue(c.ZW_‌_NJ(), 1); -assert.sameValue(c.ZW_‍_J(), 1); - - 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(c.$(), 1); + assert.sameValue(c._(), 1); + assert.sameValue(c.\u{6F}(), 1); + assert.sameValue(c.℘(), 1); + assert.sameValue(c.ZW_‌_NJ(), 1); + assert.sameValue(c.ZW_‍_J(), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-method-rs-privatename-identifier-initializer.js b/test/language/statements/class/fields-same-line-async-method-rs-privatename-identifier-initializer.js index 35db4d8d0a..f6807a62ec 100644 --- a/test/language/statements/class/fields-same-line-async-method-rs-privatename-identifier-initializer.js +++ b/test/language/statements/class/fields-same-line-async-method-rs-privatename-identifier-initializer.js @@ -89,14 +89,24 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(c.$(), 1); -assert.sameValue(c._(), 1); -assert.sameValue(c.\u{6F}(), 1); -assert.sameValue(c.\u2118(), 1); -assert.sameValue(c.ZW_\u200C_NJ(), 1); -assert.sameValue(c.ZW_\u200D_J(), 1); - - 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(c.$(), 1); + assert.sameValue(c._(), 1); + assert.sameValue(c.\u{6F}(), 1); + assert.sameValue(c.\u2118(), 1); + assert.sameValue(c.ZW_\u200C_NJ(), 1); + assert.sameValue(c.ZW_\u200D_J(), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-method-rs-privatename-identifier.js b/test/language/statements/class/fields-same-line-async-method-rs-privatename-identifier.js index 0ff930c120..9b6602c4ba 100644 --- a/test/language/statements/class/fields-same-line-async-method-rs-privatename-identifier.js +++ b/test/language/statements/class/fields-same-line-async-method-rs-privatename-identifier.js @@ -95,14 +95,24 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(c.$(1), 1); -assert.sameValue(c._(1), 1); -assert.sameValue(c.\u{6F}(1), 1); -assert.sameValue(c.\u2118(1), 1); -assert.sameValue(c.ZW_\u200C_NJ(1), 1); -assert.sameValue(c.ZW_\u200D_J(1), 1); - - 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(c.$(1), 1); + assert.sameValue(c._(1), 1); + assert.sameValue(c.\u{6F}(1), 1); + assert.sameValue(c.\u2118(1), 1); + assert.sameValue(c.ZW_\u200C_NJ(1), 1); + assert.sameValue(c.ZW_\u200D_J(1), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-method-rs-static-async-generator-method-privatename-identifier-alt.js b/test/language/statements/class/fields-same-line-async-method-rs-static-async-generator-method-privatename-identifier-alt.js index 1807d1e71c..9439312b16 100644 --- a/test/language/statements/class/fields-same-line-async-method-rs-static-async-generator-method-privatename-identifier-alt.js +++ b/test/language/statements/class/fields-same-line-async-method-rs-static-async-generator-method-privatename-identifier-alt.js @@ -61,41 +61,41 @@ info: | class C { - async m() { return 42; } static async #$(value) { + async m() { return 42; } static async * #$(value) { yield await value; } - static async #_(value) { + static async * #_(value) { yield await value; } - static async #o(value) { + static async * #o(value) { yield await value; } - static async #℘(value) { + static async * #℘(value) { yield await value; } - static async #ZW_‌_NJ(value) { + static async * #ZW_‌_NJ(value) { yield await value; } - static async #ZW_‍_J(value) { + static async * #ZW_‍_J(value) { yield await value; }; - static async $(value) { - yield * await this.#$(value); + static get $() { + return this.#$; } - static async _(value) { - yield * await this.#_(value); + static get _() { + return this.#_; } - static async o(value) { - yield * await this.#o(value); + static get o() { + return this.#o; } - static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } @@ -111,24 +111,34 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -Promise.all([ - C.$(1).next(), - C._(1).next(), - C.o(1).next(), - C.℘(1).next(), // DO NOT CHANGE THE NAME OF THIS FIELD - C.ZW_‌_NJ(1).next(), // DO NOT CHANGE THE NAME OF THIS FIELD - C.ZW_‍_J(1).next(), // DO NOT CHANGE THE NAME OF THIS FIELD -]).then(results => { - - assert.sameValue(results[0].value, 1); - assert.sameValue(results[1].value, 1); - assert.sameValue(results[2].value, 1); - assert.sameValue(results[3].value, 1); - assert.sameValue(results[4].value, 1); - assert.sameValue(results[5].value, 1); - -}, $DONE).then($DONE, $DONE); - 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') + } + } + Promise.all([ + C.$(1).next(), + C._(1).next(), + C.o(1).next(), + C.℘(1).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‌_NJ(1).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‍_J(1).next(), // DO NOT CHANGE THE NAME OF THIS FIELD + ]).then(results => { + + assert.sameValue(results[0].value, 1); + assert.sameValue(results[1].value, 1); + assert.sameValue(results[2].value, 1); + assert.sameValue(results[3].value, 1); + assert.sameValue(results[4].value, 1); + assert.sameValue(results[5].value, 1); + + }, $DONE).then($DONE, $DONE); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-method-rs-static-async-generator-method-privatename-identifier.js b/test/language/statements/class/fields-same-line-async-method-rs-static-async-generator-method-privatename-identifier.js index 1d10947d30..1a445b93e9 100644 --- a/test/language/statements/class/fields-same-line-async-method-rs-static-async-generator-method-privatename-identifier.js +++ b/test/language/statements/class/fields-same-line-async-method-rs-static-async-generator-method-privatename-identifier.js @@ -62,40 +62,40 @@ info: | class C { async m() { return 42; } static async * #$(value) { - yield await value; + yield * await value; } static async * #_(value) { - yield await value; + yield * await value; } static async * #\u{6F}(value) { - yield await value; + yield * await value; } static async * #\u2118(value) { - yield await value; + yield * await value; } static async * #ZW_\u200C_NJ(value) { - yield await value; + yield * await value; } static async * #ZW_\u200D_J(value) { - yield await value; + yield * await value; }; - static async * $(value) { - yield * await this.#$(value); + static async * $() { + return this.#$; } - static async * _(value) { - yield * await this.#_(value); + static async * _() { + return this.#_; } - static async * \u{6F}(value) { - yield * await this.#\u{6F}(value); + static async * \u{6F}() { + return this.#\u{6F}; } - static async * \u2118(value) { - yield * await this.#\u2118(value); + static async * \u2118() { + return this.#\u2118; } - static async * ZW_\u200C_NJ(value) { - yield * await this.#ZW_\u200C_NJ(value); + static async * ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static async * ZW_\u200D_J(value) { - yield * await this.#ZW_\u200D_J(value); + static async * ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } @@ -111,25 +111,35 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -Promise.all([ - C.$(1).next(), - C._(1).next(), - C.\u{6F}(1).next(), - C.\u2118(1).next(), - C.ZW_\u200C_NJ(1).next(), - C.ZW_\u200D_J(1).next(), -]).then(results => { - - assert.sameValue(results[0].value, 1); - assert.sameValue(results[1].value, 1); - assert.sameValue(results[2].value, 1); - assert.sameValue(results[3].value, 1); - assert.sameValue(results[4].value, 1); - assert.sameValue(results[5].value, 1); - -}, $DONE).then($DONE, $DONE); - - 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') + } + } + Promise.all([ + C.$(1).next(), + C._(1).next(), + C.\u{6F}(1).next(), + C.\u2118(1).next(), + C.ZW_\u200C_NJ(1).next(), + C.ZW_\u200D_J(1).next(), + ]).then(results => { + + assert.sameValue(results[0].value, 1); + assert.sameValue(results[1].value, 1); + assert.sameValue(results[2].value, 1); + assert.sameValue(results[3].value, 1); + assert.sameValue(results[4].value, 1); + assert.sameValue(results[5].value, 1); + + }, $DONE).then($DONE, $DONE); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-method-rs-static-async-method-privatename-identifier-alt.js b/test/language/statements/class/fields-same-line-async-method-rs-static-async-method-privatename-identifier-alt.js index bf618bbd90..cde5632550 100644 --- a/test/language/statements/class/fields-same-line-async-method-rs-static-async-method-privatename-identifier-alt.js +++ b/test/language/statements/class/fields-same-line-async-method-rs-static-async-method-privatename-identifier-alt.js @@ -111,24 +111,34 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -Promise.all([ - C.$(1), - C._(1), - C.o(1), - C.℘(1), // DO NOT CHANGE THE NAME OF THIS FIELD - C.ZW_‌_NJ(1), // DO NOT CHANGE THE NAME OF THIS FIELD - C.ZW_‍_J(1), // DO NOT CHANGE THE NAME OF THIS FIELD -]).then(results => { - - assert.sameValue(results[0], 1); - assert.sameValue(results[1], 1); - assert.sameValue(results[2], 1); - assert.sameValue(results[3], 1); - assert.sameValue(results[4], 1); - assert.sameValue(results[5], 1); - -}, $DONE).then($DONE, $DONE); - 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') + } + } + Promise.all([ + C.$(1), + C._(1), + C.o(1), + C.℘(1), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‌_NJ(1), // DO NOT CHANGE THE NAME OF THIS FIELD + C.ZW_‍_J(1), // DO NOT CHANGE THE NAME OF THIS FIELD + ]).then(results => { + + assert.sameValue(results[0], 1); + assert.sameValue(results[1], 1); + assert.sameValue(results[2], 1); + assert.sameValue(results[3], 1); + assert.sameValue(results[4], 1); + assert.sameValue(results[5], 1); + + }, $DONE).then($DONE, $DONE); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-method-rs-static-async-method-privatename-identifier.js b/test/language/statements/class/fields-same-line-async-method-rs-static-async-method-privatename-identifier.js index 021a6ac3a5..0228f8aca8 100644 --- a/test/language/statements/class/fields-same-line-async-method-rs-static-async-method-privatename-identifier.js +++ b/test/language/statements/class/fields-same-line-async-method-rs-static-async-method-privatename-identifier.js @@ -111,25 +111,35 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -Promise.all([ - C.$(1), - C._(1), - C.\u{6F}(1), - C.\u2118(1), - C.ZW_\u200C_NJ(1), - C.ZW_\u200D_J(1), -]).then(results => { - - assert.sameValue(results[0], 1); - assert.sameValue(results[1], 1); - assert.sameValue(results[2], 1); - assert.sameValue(results[3], 1); - assert.sameValue(results[4], 1); - assert.sameValue(results[5], 1); - -}, $DONE).then($DONE, $DONE); - - 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') + } + } + Promise.all([ + C.$(1), + C._(1), + C.\u{6F}(1), + C.\u2118(1), + C.ZW_\u200C_NJ(1), + C.ZW_\u200D_J(1), + ]).then(results => { + + assert.sameValue(results[0], 1); + assert.sameValue(results[1], 1); + assert.sameValue(results[2], 1); + assert.sameValue(results[3], 1); + assert.sameValue(results[4], 1); + assert.sameValue(results[5], 1); + + }, $DONE).then($DONE, $DONE); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-method-rs-static-generator-method-privatename-identifier-alt.js b/test/language/statements/class/fields-same-line-async-method-rs-static-generator-method-privatename-identifier-alt.js index f20de2c3e5..d5a59e4b6f 100644 --- a/test/language/statements/class/fields-same-line-async-method-rs-static-generator-method-privatename-identifier-alt.js +++ b/test/language/statements/class/fields-same-line-async-method-rs-static-generator-method-privatename-identifier-alt.js @@ -62,40 +62,40 @@ info: | class C { async m() { return 42; } static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #o(value) { - yield value; + yield * value; } static * #℘(value) { - yield value; + yield * value; } static * #ZW_‌_NJ(value) { - yield value; + yield * value; } static * #ZW_‍_J(value) { - yield value; + yield * value; }; - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * o(value) { - yield this.#o(value); + static get o() { + return this.#o; } - static * ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static * ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static * ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } @@ -111,13 +111,23 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1).next().value, 1); -assert.sameValue(C._(1).next().value, 1); -assert.sameValue(C.o(1).next().value, 1); -assert.sameValue(C.℘(1).next().value, 1); -assert.sameValue(C.ZW_‌_NJ(1).next().value, 1); -assert.sameValue(C.ZW_‍_J(1).next().value, 1); - 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(C.$(1).next().value, 1); + assert.sameValue(C._(1).next().value, 1); + assert.sameValue(C.o(1).next().value, 1); + assert.sameValue(C.℘(1).next().value, 1); + assert.sameValue(C.ZW_‌_NJ(1).next().value, 1); + assert.sameValue(C.ZW_‍_J(1).next().value, 1); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-method-rs-static-generator-method-privatename-identifier.js b/test/language/statements/class/fields-same-line-async-method-rs-static-generator-method-privatename-identifier.js index f6815bb66a..d6121a144f 100644 --- a/test/language/statements/class/fields-same-line-async-method-rs-static-generator-method-privatename-identifier.js +++ b/test/language/statements/class/fields-same-line-async-method-rs-static-generator-method-privatename-identifier.js @@ -62,40 +62,40 @@ info: | class C { async m() { return 42; } static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #\u{6F}(value) { - yield value; + yield * value; } static * #\u2118(value) { - yield value; + yield * value; } static * #ZW_\u200C_NJ(value) { - yield value; + yield * value; } static * #ZW_\u200D_J(value) { - yield value; + yield * value; }; - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * \u{6F}(value) { - yield this.#\u{6F}(value); + static get \u{6F}() { + return this.#\u{6F}; } - static * \u2118(value) { - yield this.#\u2118(value); + static get \u2118() { + return this.#\u2118; } - static * ZW_\u200C_NJ(value) { - yield this.#ZW_\u200C_NJ(value); + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static * ZW_\u200D_J(value) { - yield this.#ZW_\u200D_J(value); + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } @@ -111,14 +111,24 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1).next().value, 1); -assert.sameValue(C._(1).next().value, 1); -assert.sameValue(C.\u{6F}(1).next().value, 1); -assert.sameValue(C.\u2118(1).next().value, 1); -assert.sameValue(C.ZW_\u200C_NJ(1).next().value, 1); -assert.sameValue(C.ZW_\u200D_J(1).next().value, 1); - - 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(C.$(1).next().value, 1); + assert.sameValue(C._(1).next().value, 1); + assert.sameValue(C.\u{6F}(1).next().value, 1); + assert.sameValue(C.\u2118(1).next().value, 1); + assert.sameValue(C.ZW_\u200C_NJ(1).next().value, 1); + assert.sameValue(C.ZW_\u200D_J(1).next().value, 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-method-rs-static-method-privatename-identifier-alt.js b/test/language/statements/class/fields-same-line-async-method-rs-static-method-privatename-identifier-alt.js index ce2eda176b..f28968fb80 100644 --- a/test/language/statements/class/fields-same-line-async-method-rs-static-method-privatename-identifier-alt.js +++ b/test/language/statements/class/fields-same-line-async-method-rs-static-method-privatename-identifier-alt.js @@ -108,14 +108,24 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1), 1); -assert.sameValue(C._(1), 1); -assert.sameValue(C.o(1), 1); -assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD -assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD -assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD - - 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(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.o(1), 1); + assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-method-rs-static-method-privatename-identifier.js b/test/language/statements/class/fields-same-line-async-method-rs-static-method-privatename-identifier.js index 2ab524d63c..3f2b28f821 100644 --- a/test/language/statements/class/fields-same-line-async-method-rs-static-method-privatename-identifier.js +++ b/test/language/statements/class/fields-same-line-async-method-rs-static-method-privatename-identifier.js @@ -108,14 +108,24 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1), 1); -assert.sameValue(C._(1), 1); -assert.sameValue(C.\u{6F}(1), 1); -assert.sameValue(C.\u2118(1), 1); -assert.sameValue(C.ZW_\u200C_NJ(1), 1); -assert.sameValue(C.ZW_\u200D_J(1), 1); - - 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(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.\u{6F}(1), 1); + assert.sameValue(C.\u2118(1), 1); + assert.sameValue(C.ZW_\u200C_NJ(1), 1); + assert.sameValue(C.ZW_\u200D_J(1), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-method-rs-static-privatename-identifier-alt-by-classname.js b/test/language/statements/class/fields-same-line-async-method-rs-static-privatename-identifier-alt-by-classname.js index b24220655b..4e0dafefa2 100644 --- a/test/language/statements/class/fields-same-line-async-method-rs-static-privatename-identifier-alt-by-classname.js +++ b/test/language/statements/class/fields-same-line-async-method-rs-static-privatename-identifier-alt-by-classname.js @@ -96,14 +96,24 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1), 1); -assert.sameValue(C._(1), 1); -assert.sameValue(C.o(1), 1); -assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD -assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD -assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD - - 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(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.o(1), 1); + assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-method-rs-static-privatename-identifier-alt.js b/test/language/statements/class/fields-same-line-async-method-rs-static-privatename-identifier-alt.js index 582e865cd8..a1ab3858a9 100644 --- a/test/language/statements/class/fields-same-line-async-method-rs-static-privatename-identifier-alt.js +++ b/test/language/statements/class/fields-same-line-async-method-rs-static-privatename-identifier-alt.js @@ -96,14 +96,24 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1), 1); -assert.sameValue(C._(1), 1); -assert.sameValue(C.o(1), 1); -assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD -assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD -assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD - - 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(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.o(1), 1); + assert.sameValue(C.℘(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‌_NJ(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + assert.sameValue(C.ZW_‍_J(1), 1); // DO NOT CHANGE THE NAME OF THIS FIELD + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-method-rs-static-privatename-identifier-by-classname.js b/test/language/statements/class/fields-same-line-async-method-rs-static-privatename-identifier-by-classname.js index f5b8fc84c5..ad18be8aeb 100644 --- a/test/language/statements/class/fields-same-line-async-method-rs-static-privatename-identifier-by-classname.js +++ b/test/language/statements/class/fields-same-line-async-method-rs-static-privatename-identifier-by-classname.js @@ -96,14 +96,24 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1), 1); -assert.sameValue(C._(1), 1); -assert.sameValue(C.\u{6F}(1), 1); -assert.sameValue(C.\u2118(1), 1); -assert.sameValue(C.ZW_\u200C_NJ(1), 1); -assert.sameValue(C.ZW_\u200D_J(1), 1); - - 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(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.\u{6F}(1), 1); + assert.sameValue(C.\u2118(1), 1); + assert.sameValue(C.ZW_\u200C_NJ(1), 1); + assert.sameValue(C.ZW_\u200D_J(1), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-method-rs-static-privatename-identifier-initializer-alt-by-classname.js b/test/language/statements/class/fields-same-line-async-method-rs-static-privatename-identifier-initializer-alt-by-classname.js index ea9823cf4b..20e06d2448 100644 --- a/test/language/statements/class/fields-same-line-async-method-rs-static-privatename-identifier-initializer-alt-by-classname.js +++ b/test/language/statements/class/fields-same-line-async-method-rs-static-privatename-identifier-initializer-alt-by-classname.js @@ -90,14 +90,24 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(), 1); -assert.sameValue(C._(), 1); -assert.sameValue(C.\u{6F}(), 1); -assert.sameValue(C.℘(), 1); -assert.sameValue(C.ZW_‌_NJ(), 1); -assert.sameValue(C.ZW_‍_J(), 1); - - 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(C.$(), 1); + assert.sameValue(C._(), 1); + assert.sameValue(C.\u{6F}(), 1); + assert.sameValue(C.℘(), 1); + assert.sameValue(C.ZW_‌_NJ(), 1); + assert.sameValue(C.ZW_‍_J(), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-method-rs-static-privatename-identifier-initializer-alt.js b/test/language/statements/class/fields-same-line-async-method-rs-static-privatename-identifier-initializer-alt.js index ae9e7f7b81..49fa983335 100644 --- a/test/language/statements/class/fields-same-line-async-method-rs-static-privatename-identifier-initializer-alt.js +++ b/test/language/statements/class/fields-same-line-async-method-rs-static-privatename-identifier-initializer-alt.js @@ -90,14 +90,24 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(), 1); -assert.sameValue(C._(), 1); -assert.sameValue(C.\u{6F}(), 1); -assert.sameValue(C.℘(), 1); -assert.sameValue(C.ZW_‌_NJ(), 1); -assert.sameValue(C.ZW_‍_J(), 1); - - 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(C.$(), 1); + assert.sameValue(C._(), 1); + assert.sameValue(C.\u{6F}(), 1); + assert.sameValue(C.℘(), 1); + assert.sameValue(C.ZW_‌_NJ(), 1); + assert.sameValue(C.ZW_‍_J(), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-method-rs-static-privatename-identifier-initializer.js b/test/language/statements/class/fields-same-line-async-method-rs-static-privatename-identifier-initializer.js index 69aa0a43fc..c93137d864 100644 --- a/test/language/statements/class/fields-same-line-async-method-rs-static-privatename-identifier-initializer.js +++ b/test/language/statements/class/fields-same-line-async-method-rs-static-privatename-identifier-initializer.js @@ -90,14 +90,24 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(), 1); -assert.sameValue(C._(), 1); -assert.sameValue(C.\u{6F}(), 1); -assert.sameValue(C.\u2118(), 1); -assert.sameValue(C.ZW_\u200C_NJ(), 1); -assert.sameValue(C.ZW_\u200D_J(), 1); - - 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(C.$(), 1); + assert.sameValue(C._(), 1); + assert.sameValue(C.\u{6F}(), 1); + assert.sameValue(C.\u2118(), 1); + assert.sameValue(C.ZW_\u200C_NJ(), 1); + assert.sameValue(C.ZW_\u200D_J(), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-method-rs-static-privatename-identifier.js b/test/language/statements/class/fields-same-line-async-method-rs-static-privatename-identifier.js index 0508e4fc0e..bcd31bb1cf 100644 --- a/test/language/statements/class/fields-same-line-async-method-rs-static-privatename-identifier.js +++ b/test/language/statements/class/fields-same-line-async-method-rs-static-privatename-identifier.js @@ -96,14 +96,24 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -assert.sameValue(C.$(1), 1); -assert.sameValue(C._(1), 1); -assert.sameValue(C.\u{6F}(1), 1); -assert.sameValue(C.\u2118(1), 1); -assert.sameValue(C.ZW_\u200C_NJ(1), 1); -assert.sameValue(C.ZW_\u200D_J(1), 1); - - 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(C.$(1), 1); + assert.sameValue(C._(1), 1); + assert.sameValue(C.\u{6F}(1), 1); + assert.sameValue(C.\u2118(1), 1); + assert.sameValue(C.ZW_\u200C_NJ(1), 1); + assert.sameValue(C.ZW_\u200D_J(1), 1); + + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-method-static-private-fields.js b/test/language/statements/class/fields-same-line-async-method-static-private-fields.js index 3530b98d0f..a6bfb96c85 100644 --- a/test/language/statements/class/fields-same-line-async-method-static-private-fields.js +++ b/test/language/statements/class/fields-same-line-async-method-static-private-fields.js @@ -47,23 +47,33 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -// Test the private fields do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); -assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); -assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); - -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); -assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); -assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); - -// Test if private fields can be sucessfully accessed and set to value -assert.sameValue(C.x(), 42, "test 7"); -assert.sameValue(C.y(), 43, "test 8"); - -// Test the private fields do not appear as properties before after set to value -assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); -assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); - 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') + } + } + // Test the private fields do not appear as properties before set to value + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + + // Test if private fields can be sucessfully accessed and set to value + assert.sameValue(C.x(), 42, "test 7"); + assert.sameValue(C.y(), 43, "test 8"); + + // Test the private fields do not appear as properties before after set to value + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); + } + + return Promise.resolve(assertions()); }, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-method-static-private-methods-with-fields.js b/test/language/statements/class/fields-same-line-async-method-static-private-methods-with-fields.js new file mode 100644 index 0000000000..f068a5af2c --- /dev/null +++ b/test/language/statements/class/fields-same-line-async-method-static-private-methods-with-fields.js @@ -0,0 +1,97 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-private-methods-with-fields.case +// - src/class-fields/productions/cls-decl-after-same-line-async-method.template +/*--- +description: static private methods with fields (field definitions after an async method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public, + async-functions] +flags: [generated, async] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +class C { + async m() { return 42; } static #xVal; static #yVal; + static #x(value) { + this.#xVal = value; + return this.#xVal; + } + static #y(value) { + this.#yVal = value; + return this.#yVal; + } + static x() { + return this.#x(42); + } + static y() { + return this.#y(43); + } +} + +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') + } + } + // Test the private methods do not appear as properties before set to value + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7"); + assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8"); + assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10"); + assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11"); + assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12"); + + // Test if private fields can be sucessfully accessed and set to value + assert.sameValue(C.x(), 42, "test 13"); + assert.sameValue(C.y(), 43, "test 14"); + + // Test the private fields do not appear as properties before after set to value + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16"); + + assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17"); + assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18"); + } + + return Promise.resolve(assertions()); +}, $DONE).then($DONE, $DONE); diff --git a/test/language/statements/class/fields-same-line-async-method-static-private-methods.js b/test/language/statements/class/fields-same-line-async-method-static-private-methods.js index 15a37aa86d..c267dd1415 100644 --- a/test/language/statements/class/fields-same-line-async-method-static-private-methods.js +++ b/test/language/statements/class/fields-same-line-async-method-static-private-methods.js @@ -25,17 +25,15 @@ info: | class C { - async m() { return 42; } static #xVal; static #yVal; + async m() { return 42; } ; static #x(value) { - this.#xVal = value; - return this.#xVal; + return value / 2; } static #y(value) { - this.#y = value; - return this.#yVal; + return value * 2; } static x() { - return this.#x(42); + return this.#x(84); } static y() { return this.#y(43); @@ -53,23 +51,33 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: true}); -// Test the private methods do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 1"); -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 2"); -assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 3"); - -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 4"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 5"); -assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 6"); - -// Test if private fields can be sucessfully accessed and set to value -assert.sameValue(C.x(), 42, "test 7"); -assert.sameValue(C.y(), 43, "test 8"); - -// Test the private fields do not appear as properties before after set to value -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 9"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 10"); - 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') + } + } + // Test the private methods do not appear as properties before set to value + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); + assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); + assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + + // Test if private fields can be sucessfully accessed and set to value + assert.sameValue(C.x(), 42, "test 7"); + assert.sameValue(C.y(), 86, "test 8"); + + // Test the private fields do not appear as properties before after set to value + assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); + assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); + } + + return Promise.resolve(assertions()); }, $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 index 31354912cc..394ca82c16 100644 --- 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 @@ -38,46 +38,56 @@ verifyProperty(C.prototype, "m", { writable: true, }, {restore: 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: undefined, - 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: 39, - enumerable: true, - writable: true, - configurable: true -}); - -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "d"), false); -assert.sameValue(Object.hasOwnProperty.call(C, "d"), false); - -verifyProperty(c, "d", { - value: 42, - enumerable: true, - writable: true, - configurable: 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: undefined, + 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: 39, + enumerable: true, + writable: true, + configurable: true + }); + + assert.sameValue(Object.hasOwnProperty.call(C.prototype, "d"), false); + assert.sameValue(Object.hasOwnProperty.call(C, "d"), false); + + verifyProperty(c, "d", { + 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-rs-static-async-generator-method-privatename-identifier-alt.js b/test/language/statements/class/fields-same-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js index 34c52e35be..ddc2ffc41a 100644 --- a/test/language/statements/class/fields-same-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js +++ b/test/language/statements/class/fields-same-line-gen-rs-static-async-generator-method-privatename-identifier-alt.js @@ -61,41 +61,41 @@ info: | class C { - static async #$(value) { + static async * #$(value) { yield await value; } - static async #_(value) { + static async * #_(value) { yield await value; } - static async #o(value) { + static async * #o(value) { yield await value; } - static async #℘(value) { + static async * #℘(value) { yield await value; } - static async #ZW_‌_NJ(value) { + static async * #ZW_‌_NJ(value) { yield await value; } - static async #ZW_‍_J(value) { + static async * #ZW_‍_J(value) { yield await value; }; *m() { return 42; } - static async $(value) { - yield * await this.#$(value); + static get $() { + return this.#$; } - static async _(value) { - yield * await this.#_(value); + static get _() { + return this.#_; } - static async o(value) { - yield * await this.#o(value); + static get o() { + return this.#o; } - static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/statements/class/fields-same-line-gen-rs-static-async-generator-method-privatename-identifier.js b/test/language/statements/class/fields-same-line-gen-rs-static-async-generator-method-privatename-identifier.js index d1bf17f7d0..df02c740c9 100644 --- a/test/language/statements/class/fields-same-line-gen-rs-static-async-generator-method-privatename-identifier.js +++ b/test/language/statements/class/fields-same-line-gen-rs-static-async-generator-method-privatename-identifier.js @@ -62,40 +62,40 @@ info: | class C { static async * #$(value) { - yield await value; + yield * await value; } static async * #_(value) { - yield await value; + yield * await value; } static async * #\u{6F}(value) { - yield await value; + yield * await value; } static async * #\u2118(value) { - yield await value; + yield * await value; } static async * #ZW_\u200C_NJ(value) { - yield await value; + yield * await value; } static async * #ZW_\u200D_J(value) { - yield await value; + yield * await value; }; *m() { return 42; } - static async * $(value) { - yield * await this.#$(value); + static async * $() { + return this.#$; } - static async * _(value) { - yield * await this.#_(value); + static async * _() { + return this.#_; } - static async * \u{6F}(value) { - yield * await this.#\u{6F}(value); + static async * \u{6F}() { + return this.#\u{6F}; } - static async * \u2118(value) { - yield * await this.#\u2118(value); + static async * \u2118() { + return this.#\u2118; } - static async * ZW_\u200C_NJ(value) { - yield * await this.#ZW_\u200C_NJ(value); + static async * ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static async * ZW_\u200D_J(value) { - yield * await this.#ZW_\u200D_J(value); + static async * ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/statements/class/fields-same-line-gen-rs-static-generator-method-privatename-identifier-alt.js b/test/language/statements/class/fields-same-line-gen-rs-static-generator-method-privatename-identifier-alt.js index 96c7fd2324..098a3c41f3 100644 --- a/test/language/statements/class/fields-same-line-gen-rs-static-generator-method-privatename-identifier-alt.js +++ b/test/language/statements/class/fields-same-line-gen-rs-static-generator-method-privatename-identifier-alt.js @@ -62,40 +62,40 @@ info: | class C { static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #o(value) { - yield value; + yield * value; } static * #℘(value) { - yield value; + yield * value; } static * #ZW_‌_NJ(value) { - yield value; + yield * value; } static * #ZW_‍_J(value) { - yield value; + yield * value; }; *m() { return 42; } - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * o(value) { - yield this.#o(value); + static get o() { + return this.#o; } - static * ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static * ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static * ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/statements/class/fields-same-line-gen-rs-static-generator-method-privatename-identifier.js b/test/language/statements/class/fields-same-line-gen-rs-static-generator-method-privatename-identifier.js index 7487f8a298..9fe818f02b 100644 --- a/test/language/statements/class/fields-same-line-gen-rs-static-generator-method-privatename-identifier.js +++ b/test/language/statements/class/fields-same-line-gen-rs-static-generator-method-privatename-identifier.js @@ -62,40 +62,40 @@ info: | class C { static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #\u{6F}(value) { - yield value; + yield * value; } static * #\u2118(value) { - yield value; + yield * value; } static * #ZW_\u200C_NJ(value) { - yield value; + yield * value; } static * #ZW_\u200D_J(value) { - yield value; + yield * value; }; *m() { return 42; } - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * \u{6F}(value) { - yield this.#\u{6F}(value); + static get \u{6F}() { + return this.#\u{6F}; } - static * \u2118(value) { - yield this.#\u2118(value); + static get \u2118() { + return this.#\u2118; } - static * ZW_\u200C_NJ(value) { - yield this.#ZW_\u200C_NJ(value); + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static * ZW_\u200D_J(value) { - yield this.#ZW_\u200D_J(value); + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/statements/class/fields-same-line-gen-static-private-methods-with-fields.js b/test/language/statements/class/fields-same-line-gen-static-private-methods-with-fields.js new file mode 100644 index 0000000000..d3ca921528 --- /dev/null +++ b/test/language/statements/class/fields-same-line-gen-static-private-methods-with-fields.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-private-methods-with-fields.case +// - src/class-fields/productions/cls-decl-same-line-generator.template +/*--- +description: static private methods with fields (field definitions followed by a generator method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public, + generators] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +class C { + static #xVal; static #yVal; *m() { return 42; } + static #x(value) { + this.#xVal = value; + return this.#xVal; + } + static #y(value) { + this.#yVal = value; + return this.#yVal; + } + static x() { + return this.#x(42); + } + static y() { + return this.#y(43); + } +} + +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, +}); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7"); +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8"); +assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11"); +assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 13"); +assert.sameValue(C.y(), 43, "test 14"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16"); + +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18"); diff --git a/test/language/statements/class/fields-same-line-gen-static-private-methods.js b/test/language/statements/class/fields-same-line-gen-static-private-methods.js index a1c6037d4f..d07ba26d0d 100644 --- a/test/language/statements/class/fields-same-line-gen-static-private-methods.js +++ b/test/language/statements/class/fields-same-line-gen-static-private-methods.js @@ -25,17 +25,15 @@ info: | class C { - static #xVal; static #yVal; *m() { return 42; } + ; *m() { return 42; } static #x(value) { - this.#xVal = value; - return this.#xVal; + return value / 2; } static #y(value) { - this.#y = value; - return this.#yVal; + return value * 2; } static x() { - return this.#x(42); + return this.#x(84); } static y() { return this.#y(43); @@ -55,18 +53,18 @@ verifyProperty(C.prototype, "m", { }); // Test the private methods do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 1"); -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 2"); -assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 3"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 4"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 5"); -assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 6"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); // Test if private fields can be sucessfully accessed and set to value assert.sameValue(C.x(), 42, "test 7"); -assert.sameValue(C.y(), 43, "test 8"); +assert.sameValue(C.y(), 86, "test 8"); // Test the private fields do not appear as properties before after set to value -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 9"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); diff --git a/test/language/statements/class/fields-same-line-method-rs-static-async-generator-method-privatename-identifier-alt.js b/test/language/statements/class/fields-same-line-method-rs-static-async-generator-method-privatename-identifier-alt.js index 283f4bb57c..710acab0ee 100644 --- a/test/language/statements/class/fields-same-line-method-rs-static-async-generator-method-privatename-identifier-alt.js +++ b/test/language/statements/class/fields-same-line-method-rs-static-async-generator-method-privatename-identifier-alt.js @@ -61,41 +61,41 @@ info: | class C { - static async #$(value) { + static async * #$(value) { yield await value; } - static async #_(value) { + static async * #_(value) { yield await value; } - static async #o(value) { + static async * #o(value) { yield await value; } - static async #℘(value) { + static async * #℘(value) { yield await value; } - static async #ZW_‌_NJ(value) { + static async * #ZW_‌_NJ(value) { yield await value; } - static async #ZW_‍_J(value) { + static async * #ZW_‍_J(value) { yield await value; }; m() { return 42; } - static async $(value) { - yield * await this.#$(value); + static get $() { + return this.#$; } - static async _(value) { - yield * await this.#_(value); + static get _() { + return this.#_; } - static async o(value) { - yield * await this.#o(value); + static get o() { + return this.#o; } - static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/statements/class/fields-same-line-method-rs-static-async-generator-method-privatename-identifier.js b/test/language/statements/class/fields-same-line-method-rs-static-async-generator-method-privatename-identifier.js index 9852b31b81..e9227dc9a6 100644 --- a/test/language/statements/class/fields-same-line-method-rs-static-async-generator-method-privatename-identifier.js +++ b/test/language/statements/class/fields-same-line-method-rs-static-async-generator-method-privatename-identifier.js @@ -62,40 +62,40 @@ info: | class C { static async * #$(value) { - yield await value; + yield * await value; } static async * #_(value) { - yield await value; + yield * await value; } static async * #\u{6F}(value) { - yield await value; + yield * await value; } static async * #\u2118(value) { - yield await value; + yield * await value; } static async * #ZW_\u200C_NJ(value) { - yield await value; + yield * await value; } static async * #ZW_\u200D_J(value) { - yield await value; + yield * await value; }; m() { return 42; } - static async * $(value) { - yield * await this.#$(value); + static async * $() { + return this.#$; } - static async * _(value) { - yield * await this.#_(value); + static async * _() { + return this.#_; } - static async * \u{6F}(value) { - yield * await this.#\u{6F}(value); + static async * \u{6F}() { + return this.#\u{6F}; } - static async * \u2118(value) { - yield * await this.#\u2118(value); + static async * \u2118() { + return this.#\u2118; } - static async * ZW_\u200C_NJ(value) { - yield * await this.#ZW_\u200C_NJ(value); + static async * ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static async * ZW_\u200D_J(value) { - yield * await this.#ZW_\u200D_J(value); + static async * ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/statements/class/fields-same-line-method-rs-static-generator-method-privatename-identifier-alt.js b/test/language/statements/class/fields-same-line-method-rs-static-generator-method-privatename-identifier-alt.js index 4db8cae136..a653b9444c 100644 --- a/test/language/statements/class/fields-same-line-method-rs-static-generator-method-privatename-identifier-alt.js +++ b/test/language/statements/class/fields-same-line-method-rs-static-generator-method-privatename-identifier-alt.js @@ -62,40 +62,40 @@ info: | class C { static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #o(value) { - yield value; + yield * value; } static * #℘(value) { - yield value; + yield * value; } static * #ZW_‌_NJ(value) { - yield value; + yield * value; } static * #ZW_‍_J(value) { - yield value; + yield * value; }; m() { return 42; } - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * o(value) { - yield this.#o(value); + static get o() { + return this.#o; } - static * ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static * ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static * ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/statements/class/fields-same-line-method-rs-static-generator-method-privatename-identifier.js b/test/language/statements/class/fields-same-line-method-rs-static-generator-method-privatename-identifier.js index d69787b1dd..26f933b6ae 100644 --- a/test/language/statements/class/fields-same-line-method-rs-static-generator-method-privatename-identifier.js +++ b/test/language/statements/class/fields-same-line-method-rs-static-generator-method-privatename-identifier.js @@ -62,40 +62,40 @@ info: | class C { static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #\u{6F}(value) { - yield value; + yield * value; } static * #\u2118(value) { - yield value; + yield * value; } static * #ZW_\u200C_NJ(value) { - yield value; + yield * value; } static * #ZW_\u200D_J(value) { - yield value; + yield * value; }; m() { return 42; } - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * \u{6F}(value) { - yield this.#\u{6F}(value); + static get \u{6F}() { + return this.#\u{6F}; } - static * \u2118(value) { - yield this.#\u2118(value); + static get \u2118() { + return this.#\u2118; } - static * ZW_\u200C_NJ(value) { - yield this.#ZW_\u200C_NJ(value); + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static * ZW_\u200D_J(value) { - yield this.#ZW_\u200D_J(value); + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/statements/class/fields-same-line-method-static-private-methods-with-fields.js b/test/language/statements/class/fields-same-line-method-static-private-methods-with-fields.js new file mode 100644 index 0000000000..7f890e5377 --- /dev/null +++ b/test/language/statements/class/fields-same-line-method-static-private-methods-with-fields.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-private-methods-with-fields.case +// - src/class-fields/productions/cls-decl-same-line-method.template +/*--- +description: static private methods with fields (field definitions followed by a method in the same line) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public] +flags: [generated] +includes: [propertyHelper.js] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +class C { + static #xVal; static #yVal; m() { return 42; } + static #x(value) { + this.#xVal = value; + return this.#xVal; + } + static #y(value) { + this.#yVal = value; + return this.#yVal; + } + static x() { + return this.#x(42); + } + static y() { + return this.#y(43); + } +} + +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, +}); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7"); +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8"); +assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11"); +assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 13"); +assert.sameValue(C.y(), 43, "test 14"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16"); + +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18"); diff --git a/test/language/statements/class/fields-same-line-method-static-private-methods.js b/test/language/statements/class/fields-same-line-method-static-private-methods.js index fd2bf8fd76..1ac5dd9750 100644 --- a/test/language/statements/class/fields-same-line-method-static-private-methods.js +++ b/test/language/statements/class/fields-same-line-method-static-private-methods.js @@ -25,17 +25,15 @@ info: | class C { - static #xVal; static #yVal; m() { return 42; } + ; m() { return 42; } static #x(value) { - this.#xVal = value; - return this.#xVal; + return value / 2; } static #y(value) { - this.#y = value; - return this.#yVal; + return value * 2; } static x() { - return this.#x(42); + return this.#x(84); } static y() { return this.#y(43); @@ -55,18 +53,18 @@ verifyProperty(C.prototype, "m", { }); // Test the private methods do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 1"); -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 2"); -assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 3"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 4"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 5"); -assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 6"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); // Test if private fields can be sucessfully accessed and set to value assert.sameValue(C.x(), 42, "test 7"); -assert.sameValue(C.y(), 43, "test 8"); +assert.sameValue(C.y(), 86, "test 8"); // Test the private fields do not appear as properties before after set to value -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 9"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10"); diff --git a/test/language/statements/class/fields-wrapped-in-sc-rs-static-async-generator-method-privatename-identifier-alt.js b/test/language/statements/class/fields-wrapped-in-sc-rs-static-async-generator-method-privatename-identifier-alt.js index b9c70eec7f..c580dd569c 100644 --- a/test/language/statements/class/fields-wrapped-in-sc-rs-static-async-generator-method-privatename-identifier-alt.js +++ b/test/language/statements/class/fields-wrapped-in-sc-rs-static-async-generator-method-privatename-identifier-alt.js @@ -61,42 +61,42 @@ info: | class C { ;;;; - ;;;;;;static async #$(value) { + ;;;;;;static async * #$(value) { yield await value; } - static async #_(value) { + static async * #_(value) { yield await value; } - static async #o(value) { + static async * #o(value) { yield await value; } - static async #℘(value) { + static async * #℘(value) { yield await value; } - static async #ZW_‌_NJ(value) { + static async * #ZW_‌_NJ(value) { yield await value; } - static async #ZW_‍_J(value) { + static async * #ZW_‍_J(value) { yield await value; };;;;;;; ;;;; - static async $(value) { - yield * await this.#$(value); + static get $() { + return this.#$; } - static async _(value) { - yield * await this.#_(value); + static get _() { + return this.#_; } - static async o(value) { - yield * await this.#o(value); + static get o() { + return this.#o; } - static async ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static async ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static async ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield * await this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/statements/class/fields-wrapped-in-sc-rs-static-async-generator-method-privatename-identifier.js b/test/language/statements/class/fields-wrapped-in-sc-rs-static-async-generator-method-privatename-identifier.js index 4955ed2681..920a91064b 100644 --- a/test/language/statements/class/fields-wrapped-in-sc-rs-static-async-generator-method-privatename-identifier.js +++ b/test/language/statements/class/fields-wrapped-in-sc-rs-static-async-generator-method-privatename-identifier.js @@ -62,41 +62,41 @@ info: | class C { ;;;; ;;;;;;static async * #$(value) { - yield await value; + yield * await value; } static async * #_(value) { - yield await value; + yield * await value; } static async * #\u{6F}(value) { - yield await value; + yield * await value; } static async * #\u2118(value) { - yield await value; + yield * await value; } static async * #ZW_\u200C_NJ(value) { - yield await value; + yield * await value; } static async * #ZW_\u200D_J(value) { - yield await value; + yield * await value; };;;;;;; ;;;; - static async * $(value) { - yield * await this.#$(value); + static async * $() { + return this.#$; } - static async * _(value) { - yield * await this.#_(value); + static async * _() { + return this.#_; } - static async * \u{6F}(value) { - yield * await this.#\u{6F}(value); + static async * \u{6F}() { + return this.#\u{6F}; } - static async * \u2118(value) { - yield * await this.#\u2118(value); + static async * \u2118() { + return this.#\u2118; } - static async * ZW_\u200C_NJ(value) { - yield * await this.#ZW_\u200C_NJ(value); + static async * ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static async * ZW_\u200D_J(value) { - yield * await this.#ZW_\u200D_J(value); + static async * ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/statements/class/fields-wrapped-in-sc-rs-static-generator-method-privatename-identifier-alt.js b/test/language/statements/class/fields-wrapped-in-sc-rs-static-generator-method-privatename-identifier-alt.js index 6f6590341d..2f6d85be72 100644 --- a/test/language/statements/class/fields-wrapped-in-sc-rs-static-generator-method-privatename-identifier-alt.js +++ b/test/language/statements/class/fields-wrapped-in-sc-rs-static-generator-method-privatename-identifier-alt.js @@ -62,41 +62,41 @@ info: | class C { ;;;; ;;;;;;static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #o(value) { - yield value; + yield * value; } static * #℘(value) { - yield value; + yield * value; } static * #ZW_‌_NJ(value) { - yield value; + yield * value; } static * #ZW_‍_J(value) { - yield value; + yield * value; };;;;;;; ;;;; - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * o(value) { - yield this.#o(value); + static get o() { + return this.#o; } - static * ℘(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#℘(value); + static get ℘() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#℘; } - static * ZW_‌_NJ(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‌_NJ(value); + static get ZW_‌_NJ() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‌_NJ; } - static * ZW_‍_J(value) { // DO NOT CHANGE THE NAME OF THIS FIELD - yield this.#ZW_‍_J(value); + static get ZW_‍_J() { // DO NOT CHANGE THE NAME OF THIS FIELD + return this.#ZW_‍_J; } } diff --git a/test/language/statements/class/fields-wrapped-in-sc-rs-static-generator-method-privatename-identifier.js b/test/language/statements/class/fields-wrapped-in-sc-rs-static-generator-method-privatename-identifier.js index 864a3b405b..5bf360a916 100644 --- a/test/language/statements/class/fields-wrapped-in-sc-rs-static-generator-method-privatename-identifier.js +++ b/test/language/statements/class/fields-wrapped-in-sc-rs-static-generator-method-privatename-identifier.js @@ -62,41 +62,41 @@ info: | class C { ;;;; ;;;;;;static * #$(value) { - yield value; + yield * value; } static * #_(value) { - yield value; + yield * value; } static * #\u{6F}(value) { - yield value; + yield * value; } static * #\u2118(value) { - yield value; + yield * value; } static * #ZW_\u200C_NJ(value) { - yield value; + yield * value; } static * #ZW_\u200D_J(value) { - yield value; + yield * value; };;;;;;; ;;;; - static * $(value) { - yield this.#$(value); + static get $() { + return this.#$; } - static * _(value) { - yield this.#_(value); + static get _() { + return this.#_; } - static * \u{6F}(value) { - yield this.#\u{6F}(value); + static get \u{6F}() { + return this.#\u{6F}; } - static * \u2118(value) { - yield this.#\u2118(value); + static get \u2118() { + return this.#\u2118; } - static * ZW_\u200C_NJ(value) { - yield this.#ZW_\u200C_NJ(value); + static get ZW_\u200C_NJ() { + return this.#ZW_\u200C_NJ; } - static * ZW_\u200D_J(value) { - yield this.#ZW_\u200D_J(value); + static get ZW_\u200D_J() { + return this.#ZW_\u200D_J; } } diff --git a/test/language/statements/class/fields-wrapped-in-sc-static-private-methods-with-fields.js b/test/language/statements/class/fields-wrapped-in-sc-static-private-methods-with-fields.js new file mode 100644 index 0000000000..5ef217f215 --- /dev/null +++ b/test/language/statements/class/fields-wrapped-in-sc-static-private-methods-with-fields.js @@ -0,0 +1,74 @@ +// This file was procedurally generated from the following sources: +// - src/class-fields/static-private-methods-with-fields.case +// - src/class-fields/productions/cls-decl-wrapped-in-sc.template +/*--- +description: static private methods with fields (fields definition wrapped in semicolons) +esid: prod-FieldDefinition +features: [class-static-methods-private, class-static-fields-private, class, class-fields-public] +flags: [generated] +info: | + ClassElement : + ... + static FieldDefinition ; + + FieldDefinition : + ClassElementName Initializer_opt + + ClassElementName : + PrivateName + + PrivateName : + # IdentifierName + +---*/ + + +class C { + ;;;; + ;;;;;;static #xVal; static #yVal;;;;;;; + ;;;; + static #x(value) { + this.#xVal = value; + return this.#xVal; + } + static #y(value) { + this.#yVal = value; + return this.#yVal; + } + static x() { + return this.#x(42); + } + static y() { + return this.#y(43); + } +} + +var c = new C(); + +// Test the private methods do not appear as properties before set to value +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 7"); +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 8"); +assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 9"); + +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 11"); +assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 12"); + +// Test if private fields can be sucessfully accessed and set to value +assert.sameValue(C.x(), 42, "test 13"); +assert.sameValue(C.y(), 43, "test 14"); + +// Test the private fields do not appear as properties before after set to value +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 15"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 16"); + +assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 17"); +assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 18"); diff --git a/test/language/statements/class/fields-wrapped-in-sc-static-private-methods.js b/test/language/statements/class/fields-wrapped-in-sc-static-private-methods.js index 1ad7a3ab04..c547acb8dd 100644 --- a/test/language/statements/class/fields-wrapped-in-sc-static-private-methods.js +++ b/test/language/statements/class/fields-wrapped-in-sc-static-private-methods.js @@ -25,18 +25,16 @@ info: | class C { ;;;; - ;;;;;;static #xVal; static #yVal;;;;;;; + ;;;;;;;;;;;;; ;;;; static #x(value) { - this.#xVal = value; - return this.#xVal; + return value / 2; } static #y(value) { - this.#y = value; - return this.#yVal; + return value * 2; } static x() { - return this.#x(42); + return this.#x(84); } static y() { return this.#y(43); @@ -46,18 +44,18 @@ class C { var c = new C(); // Test the private methods do not appear as properties before set to value -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#xVal"), false, "test 1"); -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 2"); -assert.sameValue(Object.hasOwnProperty.call(c, "#xVal"), false, "test 3"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#x"), false, "test 1"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 2"); +assert.sameValue(Object.hasOwnProperty.call(c, "#x"), false, "test 3"); -assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#yVal"), false, "test 4"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 5"); -assert.sameValue(Object.hasOwnProperty.call(c, "#yVal"), false, "test 6"); +assert.sameValue(Object.hasOwnProperty.call(C.prototype, "#y"), false, "test 4"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 5"); +assert.sameValue(Object.hasOwnProperty.call(c, "#y"), false, "test 6"); // Test if private fields can be sucessfully accessed and set to value assert.sameValue(C.x(), 42, "test 7"); -assert.sameValue(C.y(), 43, "test 8"); +assert.sameValue(C.y(), 86, "test 8"); // Test the private fields do not appear as properties before after set to value -assert.sameValue(Object.hasOwnProperty.call(C, "#xVal"), false, "test 9"); -assert.sameValue(Object.hasOwnProperty.call(C, "#yVal"), false, "test 10"); +assert.sameValue(Object.hasOwnProperty.call(C, "#x"), false, "test 9"); +assert.sameValue(Object.hasOwnProperty.call(C, "#y"), false, "test 10");