Generate tests

This commit is contained in:
Rick Waldron 2018-08-01 14:20:57 -04:00 committed by Leo Balter
parent 0298174c06
commit f222b94f2a
325 changed files with 6187 additions and 622 deletions

View File

@ -4,7 +4,7 @@
/*---
description: Syntax error if you call delete on member expressions . privatename (in field, covered)
esid: sec-class-definitions-static-semantics-early-errors
features: [class-fields-private, class]
features: [class-fields-private, class, class-fields-public]
flags: [generated]
negative:
phase: parse

View File

@ -25,7 +25,7 @@ var x = "b";
var C = class {
*m() { return 42; } [x] = 42; [10] = "meep"; ["not initialized"];
}
var c = new C();

View File

@ -26,7 +26,7 @@ var y = Symbol();
var C = class {
*m() { return 42; } [x]; [y] = 42;
}
var c = new C();

View File

@ -26,7 +26,7 @@ const fn = function() {}
var C = class {
*m() { return 42; } a; b = 42;
c = fn;
}
var c = new C();

View File

@ -2,31 +2,31 @@
// - src/class-fields/private-names.case
// - src/class-fields/productions/cls-expr-after-same-line-gen.template
/*---
description: static literal private names (field definitions after a generator in the same line)
description: private names (field definitions after a generator in the same line)
esid: prod-FieldDefinition
features: [class-fields-private, generators, class, class-fields-public]
flags: [generated]
includes: [propertyHelper.js]
info: |
ClassElement:
ClassElement :
...
FieldDefinition ;
FieldDefinition:
FieldDefinition :
ClassElementName Initializer_opt
ClassElementName:
ClassElementName :
PrivateName
PrivateName:
#IdentifierName
PrivateName :
# IdentifierName
---*/
var C = class {
*m() { return 42; } #x; #y;
x() {
x() {
this.#x = 42;
return this.#x;
}

View File

@ -0,0 +1,66 @@
// This file was procedurally generated from the following sources:
// - src/class-fields/static-private-fields.case
// - src/class-fields/productions/cls-expr-after-same-line-gen.template
/*---
description: static private fields (field definitions after a generator in the same line)
esid: prod-FieldDefinition
features: [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 #x; static #y;
static x() {
this.#x = 42;
return this.#x;
}
static y() {
this.#y = 43;
return this.#y;
}
}
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 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");

View File

@ -0,0 +1,72 @@
// This file was procedurally generated from the following sources:
// - src/class-fields/static-private-methods.case
// - src/class-fields/productions/cls-expr-after-same-line-gen.template
/*---
description: static private methods (field definitions after a generator in the same line)
esid: prod-FieldDefinition
features: [class-static-methods-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.#y = 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, "#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");

View File

@ -24,7 +24,7 @@ info: |
var C = class {
*m() { return 42; } 'a'; "b"; 'c' = 39;
"d" = 42;
}
var c = new C();

View File

@ -25,7 +25,7 @@ var x = "b";
var C = class {
m() { return 42; } [x] = 42; [10] = "meep"; ["not initialized"];
}
var c = new C();

View File

@ -26,7 +26,7 @@ var y = Symbol();
var C = class {
m() { return 42; } [x]; [y] = 42;
}
var c = new C();

View File

@ -26,7 +26,7 @@ const fn = function() {}
var C = class {
m() { return 42; } a; b = 42;
c = fn;
}
var c = new C();

View File

@ -2,31 +2,31 @@
// - src/class-fields/private-names.case
// - src/class-fields/productions/cls-expr-after-same-line-method.template
/*---
description: static literal private names (field definitions after a method in the same line)
description: private names (field definitions after a method in the same line)
esid: prod-FieldDefinition
features: [class-fields-private, class, class-fields-public]
flags: [generated]
includes: [propertyHelper.js]
info: |
ClassElement:
ClassElement :
...
FieldDefinition ;
FieldDefinition:
FieldDefinition :
ClassElementName Initializer_opt
ClassElementName:
ClassElementName :
PrivateName
PrivateName:
#IdentifierName
PrivateName :
# IdentifierName
---*/
var C = class {
m() { return 42; } #x; #y;
x() {
x() {
this.#x = 42;
return this.#x;
}

View File

@ -0,0 +1,66 @@
// This file was procedurally generated from the following sources:
// - src/class-fields/static-private-fields.case
// - src/class-fields/productions/cls-expr-after-same-line-method.template
/*---
description: static private fields (field definitions after a method in the same line)
esid: prod-FieldDefinition
features: [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 #x; static #y;
static x() {
this.#x = 42;
return this.#x;
}
static y() {
this.#y = 43;
return this.#y;
}
}
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 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");

View File

@ -0,0 +1,72 @@
// This file was procedurally generated from the following sources:
// - src/class-fields/static-private-methods.case
// - src/class-fields/productions/cls-expr-after-same-line-method.template
/*---
description: static private methods (field definitions after a method in the same line)
esid: prod-FieldDefinition
features: [class-static-methods-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.#y = 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, "#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");

View File

@ -24,7 +24,7 @@ info: |
var C = class {
m() { return 42; } 'a'; "b"; 'c' = 39;
"d" = 42;
}
var c = new C();

View File

@ -25,7 +25,7 @@ var x = "b";
var C = class {
static async *m() { return 42; } [x] = 42; [10] = "meep"; ["not initialized"];
}
var c = new C();

View File

@ -26,7 +26,7 @@ var y = Symbol();
var C = class {
static async *m() { return 42; } [x]; [y] = 42;
}
var c = new C();

View File

@ -26,7 +26,7 @@ const fn = function() {}
var C = class {
static async *m() { return 42; } a; b = 42;
c = fn;
}
var c = new C();

View File

@ -2,31 +2,31 @@
// - src/class-fields/private-names.case
// - src/class-fields/productions/cls-expr-after-same-line-static-async-gen.template
/*---
description: static literal private names (field definitions after a static async generator in the same line)
description: private names (field definitions after a static async generator in the same line)
esid: prod-FieldDefinition
features: [class-fields-private, class, class-fields-public, async-iteration]
flags: [generated, async]
includes: [propertyHelper.js]
info: |
ClassElement:
ClassElement :
...
FieldDefinition ;
FieldDefinition:
FieldDefinition :
ClassElementName Initializer_opt
ClassElementName:
ClassElementName :
PrivateName
PrivateName:
#IdentifierName
PrivateName :
# IdentifierName
---*/
var C = class {
static async *m() { return 42; } #x; #y;
x() {
x() {
this.#x = 42;
return this.#x;
}

View File

@ -0,0 +1,70 @@
// This file was procedurally generated from the following sources:
// - src/class-fields/static-private-fields.case
// - src/class-fields/productions/cls-expr-after-same-line-static-async-gen.template
/*---
description: static private fields (field definitions after a static async generator in the same line)
esid: prod-FieldDefinition
features: [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 #x; static #y;
static x() {
this.#x = 42;
return this.#x;
}
static y() {
this.#y = 43;
return this.#y;
}
}
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});
// 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);
}, $DONE).then($DONE, $DONE);

View File

@ -0,0 +1,76 @@
// This file was procedurally generated from the following sources:
// - src/class-fields/static-private-methods.case
// - src/class-fields/productions/cls-expr-after-same-line-static-async-gen.template
/*---
description: static private methods (field definitions after a static async generator in the same line)
esid: prod-FieldDefinition
features: [class-static-methods-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.#y = 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});
// 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);
}, $DONE).then($DONE, $DONE);

View File

@ -24,7 +24,7 @@ info: |
var C = class {
static async *m() { return 42; } 'a'; "b"; 'c' = 39;
"d" = 42;
}
var c = new C();

View File

@ -25,7 +25,7 @@ var x = "b";
var C = class {
static async m() { return 42; } [x] = 42; [10] = "meep"; ["not initialized"];
}
var c = new C();

View File

@ -26,7 +26,7 @@ var y = Symbol();
var C = class {
static async m() { return 42; } [x]; [y] = 42;
}
var c = new C();

View File

@ -26,7 +26,7 @@ const fn = function() {}
var C = class {
static async m() { return 42; } a; b = 42;
c = fn;
}
var c = new C();

View File

@ -2,31 +2,31 @@
// - src/class-fields/private-names.case
// - src/class-fields/productions/cls-expr-after-same-line-static-async-method.template
/*---
description: static literal private names (field definitions after a static async method in the same line)
description: private names (field definitions after a static async method in the same line)
esid: prod-FieldDefinition
features: [class-fields-private, class, class-fields-public, async-functions]
flags: [generated, async]
includes: [propertyHelper.js]
info: |
ClassElement:
ClassElement :
...
FieldDefinition ;
FieldDefinition:
FieldDefinition :
ClassElementName Initializer_opt
ClassElementName:
ClassElementName :
PrivateName
PrivateName:
#IdentifierName
PrivateName :
# IdentifierName
---*/
var C = class {
static async m() { return 42; } #x; #y;
x() {
x() {
this.#x = 42;
return this.#x;
}

View File

@ -0,0 +1,69 @@
// This file was procedurally generated from the following sources:
// - src/class-fields/static-private-fields.case
// - src/class-fields/productions/cls-expr-after-same-line-static-async-method.template
/*---
description: static private fields (field definitions after a static async method in the same line)
esid: prod-FieldDefinition
features: [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 #x; static #y;
static x() {
this.#x = 42;
return this.#x;
}
static y() {
this.#y = 43;
return this.#y;
}
}
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});
// 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);
}, $DONE).then($DONE, $DONE);

View File

@ -0,0 +1,75 @@
// This file was procedurally generated from the following sources:
// - src/class-fields/static-private-methods.case
// - src/class-fields/productions/cls-expr-after-same-line-static-async-method.template
/*---
description: static private methods (field definitions after a static async method in the same line)
esid: prod-FieldDefinition
features: [class-static-methods-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.#y = 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});
// 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);
}, $DONE).then($DONE, $DONE);

View File

@ -24,7 +24,7 @@ info: |
var C = class {
static async m() { return 42; } 'a'; "b"; 'c' = 39;
"d" = 42;
}
var c = new C();

View File

@ -25,7 +25,7 @@ var x = "b";
var C = class {
static *m() { return 42; } [x] = 42; [10] = "meep"; ["not initialized"];
}
var c = new C();

View File

@ -26,7 +26,7 @@ var y = Symbol();
var C = class {
static *m() { return 42; } [x]; [y] = 42;
}
var c = new C();

View File

@ -26,7 +26,7 @@ const fn = function() {}
var C = class {
static *m() { return 42; } a; b = 42;
c = fn;
}
var c = new C();

View File

@ -2,31 +2,31 @@
// - src/class-fields/private-names.case
// - src/class-fields/productions/cls-expr-after-same-line-static-gen.template
/*---
description: static literal private names (field definitions after a static generator in the same line)
description: private names (field definitions after a static generator in the same line)
esid: prod-FieldDefinition
features: [class-fields-private, generators, class, class-fields-public]
flags: [generated]
includes: [propertyHelper.js]
info: |
ClassElement:
ClassElement :
...
FieldDefinition ;
FieldDefinition:
FieldDefinition :
ClassElementName Initializer_opt
ClassElementName:
ClassElementName :
PrivateName
PrivateName:
#IdentifierName
PrivateName :
# IdentifierName
---*/
var C = class {
static *m() { return 42; } #x; #y;
x() {
x() {
this.#x = 42;
return this.#x;
}

View File

@ -0,0 +1,66 @@
// This file was procedurally generated from the following sources:
// - src/class-fields/static-private-fields.case
// - src/class-fields/productions/cls-expr-after-same-line-static-gen.template
/*---
description: static private fields (field definitions after a static generator in the same line)
esid: prod-FieldDefinition
features: [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 #x; static #y;
static x() {
this.#x = 42;
return this.#x;
}
static y() {
this.#y = 43;
return this.#y;
}
}
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 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");

View File

@ -0,0 +1,72 @@
// This file was procedurally generated from the following sources:
// - src/class-fields/static-private-methods.case
// - src/class-fields/productions/cls-expr-after-same-line-static-gen.template
/*---
description: static private methods (field definitions after a static generator in the same line)
esid: prod-FieldDefinition
features: [class-static-methods-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.#y = 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, "#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");

View File

@ -24,7 +24,7 @@ info: |
var C = class {
static *m() { return 42; } 'a'; "b"; 'c' = 39;
"d" = 42;
}
var c = new C();

View File

@ -25,7 +25,7 @@ var x = "b";
var C = class {
static m() { return 42; } [x] = 42; [10] = "meep"; ["not initialized"];
}
var c = new C();

View File

@ -26,7 +26,7 @@ var y = Symbol();
var C = class {
static m() { return 42; } [x]; [y] = 42;
}
var c = new C();

View File

@ -26,7 +26,7 @@ const fn = function() {}
var C = class {
static m() { return 42; } a; b = 42;
c = fn;
}
var c = new C();

View File

@ -2,31 +2,31 @@
// - src/class-fields/private-names.case
// - src/class-fields/productions/cls-expr-after-same-line-static-method.template
/*---
description: static literal private names (field definitions after a static method in the same line)
description: private names (field definitions after a static method in the same line)
esid: prod-FieldDefinition
features: [class-fields-private, class, class-fields-public]
flags: [generated]
includes: [propertyHelper.js]
info: |
ClassElement:
ClassElement :
...
FieldDefinition ;
FieldDefinition:
FieldDefinition :
ClassElementName Initializer_opt
ClassElementName:
ClassElementName :
PrivateName
PrivateName:
#IdentifierName
PrivateName :
# IdentifierName
---*/
var C = class {
static m() { return 42; } #x; #y;
x() {
x() {
this.#x = 42;
return this.#x;
}

View File

@ -0,0 +1,66 @@
// This file was procedurally generated from the following sources:
// - src/class-fields/static-private-fields.case
// - src/class-fields/productions/cls-expr-after-same-line-static-method.template
/*---
description: static private fields (field definitions after a static method in the same line)
esid: prod-FieldDefinition
features: [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 #x; static #y;
static x() {
this.#x = 42;
return this.#x;
}
static y() {
this.#y = 43;
return this.#y;
}
}
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 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");

View File

@ -0,0 +1,72 @@
// This file was procedurally generated from the following sources:
// - src/class-fields/static-private-methods.case
// - src/class-fields/productions/cls-expr-after-same-line-static-method.template
/*---
description: static private methods (field definitions after a static method in the same line)
esid: prod-FieldDefinition
features: [class-static-methods-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.#y = 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, "#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");

View File

@ -24,7 +24,7 @@ info: |
var C = class {
static m() { return 42; } 'a'; "b"; 'c' = 39;
"d" = 42;
}
var c = new C();

View File

@ -4,7 +4,7 @@
/*---
description: ToPrimitive evaluation in the ComputedPropertyName (field definitions in a class expression)
esid: prod-FieldDefinition
features: [computed-property-names, Symbol.toPrimitive, Symbol, class, class-fields-public]
features: [computed-property-names, Symbol.toPrimitive, Symbol, class]
flags: [generated]
includes: [propertyHelper.js]
info: |

View File

@ -4,7 +4,7 @@
/*---
description: ToPrimitive evaluation in the ComputedPropertyName (field definitions in a class expression)
esid: prod-FieldDefinition
features: [computed-property-names, Symbol.toPrimitive, class, class-fields-public]
features: [computed-property-names, Symbol.toPrimitive, class]
flags: [generated]
includes: [propertyHelper.js]
info: |

View File

@ -1,33 +0,0 @@
// This file was procedurally generated from the following sources:
// - src/class-fields/propname-constructor.case
// - src/class-fields/propname-error/cls-expr-variable-name.template
/*---
description: class fields forbid PropName 'constructor' (no early error -- PropName of ComputedPropertyName not forbidden value)
esid: sec-class-definitions-static-semantics-early-errors
features: [class, class-fields-public]
flags: [generated]
info: |
Static Semantics: PropName
...
ComputedPropertyName : [ AssignmentExpression ]
Return empty.
// This test file tests the following early error:
Static Semantics: Early Errors
ClassElement : FieldDefinition;
It is a Syntax Error if PropName of FieldDefinition is "constructor".
---*/
var constructor = 'foo';
var C = class {
[constructor];
};
var c = new C();
assert.sameValue(c.hasOwnProperty("foo"), true);
assert.sameValue(C.hasOwnProperty("foo"), false);

View File

@ -4,7 +4,7 @@
/*---
description: The constructor method is called after the fields are initalized (field definitions in a class expression)
esid: prod-FieldDefinition
features: [class, class-fields-public]
features: [class]
flags: [generated]
info: |
[[Construct]] ( argumentsList, newTarget)

View File

@ -23,9 +23,8 @@ info: |
---*/
var A = class {}
var executed = false;
var A = class {}
var C = class extends A {
x = eval('executed = true; super()["x"];');
}

View File

@ -7,13 +7,6 @@ esid: sec-performeval-rules-in-initializer
features: [class, class-fields-public]
flags: [generated]
info: |
Additional Early Error Rules for Eval Inside Initializer
These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
ScriptBody : StatementList
...
The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
Additional Early Error Rules for Eval Outside Constructor Methods
These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression.
ScriptBody:StatementList
@ -23,9 +16,8 @@ info: |
---*/
var A = class {}
var executed = false;
var A = class {}
var C = class extends A {
x = eval('executed = true; super().x;');
}

View File

@ -23,9 +23,8 @@ info: |
---*/
var A = class {}
var executed = false;
var A = class {}
var C = class extends A {
x = eval('executed = true; super();');
}

View File

@ -23,12 +23,11 @@ info: |
---*/
var A = class {}
var executed = false;
var A = class {}
var C = class extends A {
x = eval('executed = true; super.x;');
}
};
new C();

View File

@ -2,33 +2,29 @@
// - src/class-fields/eval-err-contains-superproperty-2.case
// - src/class-fields/initializer-eval-super-property/cls-expr-fields-eval.template
/*---
description: error if `super['x']` in StatementList of eval (direct eval)
description: error if super['x'] in StatementList of eval (direct eval)
esid: sec-performeval-rules-in-initializer
features: [class, class-fields-public]
flags: [generated]
info: |
Additional Early Error Rules for Eval Inside Initializer
These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
ScriptBody : StatementList
...
The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
Additional Early Error Rules for Eval Outside Methods
These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition.
ScriptBody:StatementList
These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition.
ScriptBody : StatementList
It is a Syntax Error if StatementList Contains SuperProperty.
---*/
var A = class {}
var executed = false;
var A = class {}
var C = class extends A {
x = eval('executed = true; super["x"];');
}
};
new C();

View File

@ -23,9 +23,8 @@ info: |
---*/
var A = class {}
var executed = false;
var A = class {}
var C = class extends A {
x = (0, eval)('executed = true; super()["x"];');
}

View File

@ -7,13 +7,6 @@ esid: sec-performeval-rules-in-initializer
features: [class, class-fields-public]
flags: [generated]
info: |
Additional Early Error Rules for Eval Inside Initializer
These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
ScriptBody : StatementList
...
The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
Additional Early Error Rules for Eval Outside Constructor Methods
These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression.
ScriptBody:StatementList
@ -23,9 +16,8 @@ info: |
---*/
var A = class {}
var executed = false;
var A = class {}
var C = class extends A {
x = (0, eval)('executed = true; super().x;');
}

View File

@ -23,9 +23,8 @@ info: |
---*/
var A = class {}
var executed = false;
var A = class {}
var C = class extends A {
x = (0, eval)('executed = true; super();');
}

View File

@ -23,12 +23,11 @@ info: |
---*/
var A = class {}
var executed = false;
var A = class {}
var C = class extends A {
x = (0, eval)('executed = true; super.x;');
}
};
assert.throws(SyntaxError, function() {
new C();

View File

@ -2,33 +2,29 @@
// - src/class-fields/eval-err-contains-superproperty-2.case
// - src/class-fields/initializer-eval-super-property/cls-expr-fields-indirect-eval.template
/*---
description: error if `super['x']` in StatementList of eval (indirect eval)
description: error if super['x'] in StatementList of eval (indirect eval)
esid: sec-performeval-rules-in-initializer
features: [class, class-fields-public]
flags: [generated]
info: |
Additional Early Error Rules for Eval Inside Initializer
These static semantics are applied by PerformEval when a direct eval call occurs inside a class field initializer.
ScriptBody : StatementList
...
The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
The remaining eval rules apply as outside a constructor, inside a method, and inside a function.
Additional Early Error Rules for Eval Outside Methods
These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition.
ScriptBody:StatementList
These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition.
ScriptBody : StatementList
It is a Syntax Error if StatementList Contains SuperProperty.
---*/
var A = class {}
var executed = false;
var A = class {}
var C = class extends A {
x = (0, eval)('executed = true; super["x"];');
}
};
assert.throws(SyntaxError, function() {
new C();

View File

@ -4,7 +4,7 @@
/*---
description: error if `new.target` in StatementList of eval (direct eval)
esid: sec-performeval-rules-in-initializer
features: [class, class-fields-public, new.target]
features: [class, new.target, class-fields-public]
flags: [generated]
info: |
Additional Early Error Rules for Eval Inside Initializer

View File

@ -4,7 +4,7 @@
/*---
description: ReferenceError evaluating a computed property name (field definitions in a class expression)
esid: sec-runtime-semantics-classdefinitionevaluation
features: [computed-property-names, class, class-fields-public]
features: [computed-property-names, class]
flags: [generated]
info: |
Runtime Semantics: ClassDefinitionEvaluation

View File

@ -4,7 +4,7 @@
/*---
description: Custom error evaluating a computed property name (field definitions in a class expression)
esid: sec-runtime-semantics-classdefinitionevaluation
features: [computed-property-names, Symbol.toPrimitive, class, class-fields-public]
features: [computed-property-names, Symbol.toPrimitive, class]
flags: [generated]
info: |
Runtime Semantics: ClassDefinitionEvaluation

View File

@ -0,0 +1,57 @@
// This file was procedurally generated from the following sources:
// - src/class-fields/computed-name-toprimitive-returns-noncallable.case
// - src/class-fields/class-evaluation-error/cls-expr.template
/*---
description: Custom error evaluating a computed property name (field definitions in a class expression)
esid: sec-runtime-semantics-classdefinitionevaluation
features: [computed-property-names, Symbol.toPrimitive, class]
flags: [generated]
info: |
Runtime Semantics: ClassDefinitionEvaluation
...
27. For each ClassElement e in order from elements
a. If IsStatic of me is false, then
i. Let fields be the result of performing ClassElementEvaluation for e with arguments proto and false.
b. Else,
i. Let fields be the result of performing ClassElementEvaluation for e with arguments F and false.
c. If fields is an abrupt completion, then
i. Set the running execution context's LexicalEnvironment to lex.
ii. Set the running execution context's PrivateNameEnvironment to outerPrivateEnvironment.
iii. Return Completion(status).
...
Runtime Semantics: ClassElementEvaluation
ClassElement: FieldDefinition;
Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter false and object.
Runtime Semantics: ClassFieldDefinitionEvaluation
With parameters isStatic and homeObject.
1. Let fieldName be the result of evaluating ClassElementName.
2. ReturnIfAbrupt(fieldName).
...
Runtime Semantics: Evaluation
ComputedPropertyName: [ AssignmentExpression ]
1. Let exprValue be the result of evaluating AssignmentExpression.
2. Let propName be ? GetValue(exprValue).
3. Return ? ToPropertyKey(propName).
---*/
var obj = {
[Symbol.toPrimitive]: {}
};
function evaluate() {
var C = class {
[obj] = refErrorIfEvaluated;
};
}
assert.throws(TypeError
, evaluate);

View File

@ -0,0 +1,56 @@
// This file was procedurally generated from the following sources:
// - src/class-fields/computed-name-toprimitive-returns-nonobject.case
// - src/class-fields/class-evaluation-error/cls-expr.template
/*---
description: Custom error evaluating a computed property name (field definitions in a class expression)
esid: sec-runtime-semantics-classdefinitionevaluation
features: [computed-property-names, Symbol.toPrimitive, class]
flags: [generated]
info: |
Runtime Semantics: ClassDefinitionEvaluation
...
27. For each ClassElement e in order from elements
a. If IsStatic of me is false, then
i. Let fields be the result of performing ClassElementEvaluation for e with arguments proto and false.
b. Else,
i. Let fields be the result of performing ClassElementEvaluation for e with arguments F and false.
c. If fields is an abrupt completion, then
i. Set the running execution context's LexicalEnvironment to lex.
ii. Set the running execution context's PrivateNameEnvironment to outerPrivateEnvironment.
iii. Return Completion(status).
...
Runtime Semantics: ClassElementEvaluation
ClassElement: FieldDefinition;
Return ClassFieldDefinitionEvaluation of FieldDefinition with parameter false and object.
Runtime Semantics: ClassFieldDefinitionEvaluation
With parameters isStatic and homeObject.
1. Let fieldName be the result of evaluating ClassElementName.
2. ReturnIfAbrupt(fieldName).
...
Runtime Semantics: Evaluation
ComputedPropertyName: [ AssignmentExpression ]
1. Let exprValue be the result of evaluating AssignmentExpression.
2. Let propName be ? GetValue(exprValue).
3. Return ? ToPropertyKey(propName).
---*/
var obj = {
[Symbol.toPrimitive]: 42
};
function evaluate() {
var C = class {
[obj] = refErrorIfEvaluated;
};
}
assert.throws(TypeError, evaluate);

View File

@ -4,7 +4,7 @@
/*---
description: Custom error evaluating a computed property name (field definitions in a class expression)
esid: sec-runtime-semantics-classdefinitionevaluation
features: [computed-property-names, class, class-fields-public]
features: [computed-property-names, class]
flags: [generated]
info: |
Runtime Semantics: ClassDefinitionEvaluation

View File

@ -4,7 +4,7 @@
/*---
description: Custom error evaluating a computed property name (field definitions in a class expression)
esid: sec-runtime-semantics-classdefinitionevaluation
features: [computed-property-names, class, class-fields-public]
features: [computed-property-names, class]
flags: [generated]
info: |
Runtime Semantics: ClassDefinitionEvaluation

View File

@ -4,7 +4,7 @@
/*---
description: error if `new.target` in StatementList of eval (indirect eval)
esid: sec-performeval-rules-in-initializer
features: [class, class-fields-public, new.target]
features: [class, new.target, class-fields-public]
flags: [generated]
info: |
Additional Early Error Rules for Eval Inside Initializer

View File

@ -4,7 +4,7 @@
/*---
description: Return abrupt completion evaluating the field initializer (field definitions in a class expression)
esid: prod-FieldDefinition
features: [class, class-fields-public]
features: [class]
flags: [generated]
info: |
[[Construct]] ( argumentsList, newTarget)

View File

@ -4,7 +4,7 @@
/*---
description: The initializer value is defined after the class evaluation (field definitions in a class expression)
esid: prod-FieldDefinition
features: [computed-property-names, class, class-fields-public]
features: [computed-property-names, class]
flags: [generated]
includes: [propertyHelper.js]
info: |

View File

@ -4,7 +4,7 @@
/*---
description: The initializer value is defined during the class instatiation (field definitions in a class expression)
esid: prod-FieldDefinition
features: [computed-property-names, class, class-fields-public]
features: [computed-property-names, class]
flags: [generated]
includes: [propertyHelper.js]
info: |

View File

@ -29,7 +29,7 @@ var C = class {
[x] = 42; [10] = "meep"; ["not initialized"]
m2() { return 39 }
bar = "barbaz";
}
var c = new C();

View File

@ -30,7 +30,7 @@ var C = class {
[x]; [y] = 42
m2() { return 39 }
bar = "barbaz";
}
var c = new C();

View File

@ -30,7 +30,7 @@ var C = class {
c = fn
m2() { return 39 }
bar = "barbaz";
}
var c = new C();

View File

@ -2,24 +2,24 @@
// - src/class-fields/private-names.case
// - src/class-fields/productions/cls-expr-multiple-definitions.template
/*---
description: static literal private names (multiple fields definitions)
description: private names (multiple fields definitions)
esid: prod-FieldDefinition
features: [class-fields-private, class, class-fields-public]
flags: [generated]
includes: [propertyHelper.js]
info: |
ClassElement:
ClassElement :
...
FieldDefinition ;
FieldDefinition:
FieldDefinition :
ClassElementName Initializer_opt
ClassElementName:
ClassElementName :
PrivateName
PrivateName:
#IdentifierName
PrivateName :
# IdentifierName
---*/
@ -30,7 +30,7 @@ var C = class {
#x; #y
m2() { return 39 }
bar = "barbaz";
x() {
x() {
this.#x = 42;
return this.#x;
}

View File

@ -0,0 +1,102 @@
// This file was procedurally generated from the following sources:
// - src/class-fields/static-private-fields.case
// - src/class-fields/productions/cls-expr-multiple-definitions.template
/*---
description: static private fields (multiple fields definitions)
esid: prod-FieldDefinition
features: [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 #x; static #y
m2() { return 39 }
bar = "barbaz";
static x() {
this.#x = 42;
return this.#x;
}
static y() {
this.#y = 43;
return this.#y;
}
}
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 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");

View File

@ -0,0 +1,40 @@
// Copyright (C) 2018 Rick Waldron. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
description: Static private methods not accessible via default Proxy handler
esid: prod-FieldDefinition
features: [class, class-static-methods-private]
includes: [propertyHelper.js]
info: |
ClassElement :
...
static FieldDefinition ;
FieldDefinition :
ClassElementName Initializer_opt
ClassElementName :
PrivateName
PrivateName :
# IdentifierName
---*/
var C = class {
static #x(value) {
return 1;
}
static x() {
return this.#x();
}
}
var P = new Proxy(C, {});
assert.sameValue(C.x(), 1);
assert.throws(TypeError, function() {
P.x();
});

View File

@ -0,0 +1,108 @@
// This file was procedurally generated from the following sources:
// - src/class-fields/static-private-methods.case
// - src/class-fields/productions/cls-expr-multiple-definitions.template
/*---
description: static private methods (multiple fields definitions)
esid: prod-FieldDefinition
features: [class-static-methods-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.#y = 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, "#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");

View File

@ -28,7 +28,7 @@ var C = class {
"d" = 42
m2() { return 39 }
bar = "barbaz";
}
var c = new C();

View File

@ -27,7 +27,7 @@ var C = class {
[x] = 42; [10] = "meep"; ["not initialized"]
foo = "foobar"
bar = "barbaz";
}
var c = new C();

View File

@ -28,7 +28,7 @@ var C = class {
[x]; [y] = 42
foo = "foobar"
bar = "barbaz";
}
var c = new C();

View File

@ -28,7 +28,7 @@ var C = class {
c = fn
foo = "foobar"
bar = "barbaz";
}
var c = new C();

View File

@ -2,24 +2,24 @@
// - src/class-fields/private-names.case
// - src/class-fields/productions/cls-expr-multiple-stacked-definitions.template
/*---
description: static literal private names (multiple stacked fields definitions through ASI)
description: private names (multiple stacked fields definitions through ASI)
esid: prod-FieldDefinition
features: [class-fields-private, class, class-fields-public]
flags: [generated]
includes: [propertyHelper.js]
info: |
ClassElement:
ClassElement :
...
FieldDefinition ;
FieldDefinition:
FieldDefinition :
ClassElementName Initializer_opt
ClassElementName:
ClassElementName :
PrivateName
PrivateName:
#IdentifierName
PrivateName :
# IdentifierName
---*/
@ -28,7 +28,7 @@ var C = class {
#x; #y
foo = "foobar"
bar = "barbaz";
x() {
x() {
this.#x = 42;
return this.#x;
}

View File

@ -0,0 +1,80 @@
// This file was procedurally generated from the following sources:
// - src/class-fields/static-private-fields.case
// - src/class-fields/productions/cls-expr-multiple-stacked-definitions.template
/*---
description: static private fields (multiple stacked fields definitions through ASI)
esid: prod-FieldDefinition
features: [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 #x; static #y
foo = "foobar"
bar = "barbaz";
static x() {
this.#x = 42;
return this.#x;
}
static y() {
this.#y = 43;
return this.#y;
}
}
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 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");

View File

@ -0,0 +1,86 @@
// This file was procedurally generated from the following sources:
// - src/class-fields/static-private-methods.case
// - src/class-fields/productions/cls-expr-multiple-stacked-definitions.template
/*---
description: static private methods (multiple stacked fields definitions through ASI)
esid: prod-FieldDefinition
features: [class-static-methods-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.#y = 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, "#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");

View File

@ -26,7 +26,7 @@ var C = class {
"d" = 42
foo = "foobar"
bar = "barbaz";
}
var c = new C();

View File

@ -26,7 +26,7 @@ var x = "b";
var C = class {
[x] = 42; [10] = "meep"; ["not initialized"]
m() { return 42; }
}
var c = new C();

View File

@ -27,7 +27,7 @@ var y = Symbol();
var C = class {
[x]; [y] = 42
m() { return 42; }
}
var c = new C();

View File

@ -27,7 +27,7 @@ var C = class {
a; b = 42;
c = fn
m() { return 42; }
}
var c = new C();

View File

@ -2,24 +2,24 @@
// - src/class-fields/private-names.case
// - src/class-fields/productions/cls-expr-new-no-sc-line-method.template
/*---
description: static literal private names (field definitions followed by a method in a new line without a semicolon)
description: private names (field definitions followed by a method in a new line without a semicolon)
esid: prod-FieldDefinition
features: [class-fields-private, class, class-fields-public]
flags: [generated]
includes: [propertyHelper.js]
info: |
ClassElement:
ClassElement :
...
FieldDefinition ;
FieldDefinition:
FieldDefinition :
ClassElementName Initializer_opt
ClassElementName:
ClassElementName :
PrivateName
PrivateName:
#IdentifierName
PrivateName :
# IdentifierName
---*/
@ -27,7 +27,7 @@ info: |
var C = class {
#x; #y
m() { return 42; }
x() {
x() {
this.#x = 42;
return this.#x;
}

View File

@ -0,0 +1,67 @@
// This file was procedurally generated from the following sources:
// - src/class-fields/static-private-fields.case
// - src/class-fields/productions/cls-expr-new-no-sc-line-method.template
/*---
description: static private fields (field definitions followed by a method in a new line without a semicolon)
esid: prod-FieldDefinition
features: [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 #x; static #y
m() { return 42; }
static x() {
this.#x = 42;
return this.#x;
}
static y() {
this.#y = 43;
return this.#y;
}
}
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 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");

View File

@ -0,0 +1,73 @@
// This file was procedurally generated from the following sources:
// - src/class-fields/static-private-methods.case
// - src/class-fields/productions/cls-expr-new-no-sc-line-method.template
/*---
description: static private methods (field definitions followed by a method in a new line without a semicolon)
esid: prod-FieldDefinition
features: [class-static-methods-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.#y = 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, "#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");

View File

@ -25,7 +25,7 @@ var C = class {
'a'; "b"; 'c' = 39;
"d" = 42
m() { return 42; }
}
var c = new C();

View File

@ -26,7 +26,7 @@ var x = "b";
var C = class {
[x] = 42; [10] = "meep"; ["not initialized"];
*m() { return 42; }
}
var c = new C();

View File

@ -27,7 +27,7 @@ var y = Symbol();
var C = class {
[x]; [y] = 42;
*m() { return 42; }
}
var c = new C();

View File

@ -27,7 +27,7 @@ var C = class {
a; b = 42;
c = fn;
*m() { return 42; }
}
var c = new C();

View File

@ -2,24 +2,24 @@
// - src/class-fields/private-names.case
// - src/class-fields/productions/cls-expr-new-sc-line-generator.template
/*---
description: static literal private names (field definitions followed by a method in a new line with a semicolon)
description: private names (field definitions followed by a method in a new line with a semicolon)
esid: prod-FieldDefinition
features: [class-fields-private, class, class-fields-public, generators]
flags: [generated]
includes: [propertyHelper.js]
info: |
ClassElement:
ClassElement :
...
FieldDefinition ;
FieldDefinition:
FieldDefinition :
ClassElementName Initializer_opt
ClassElementName:
ClassElementName :
PrivateName
PrivateName:
#IdentifierName
PrivateName :
# IdentifierName
---*/
@ -27,7 +27,7 @@ info: |
var C = class {
#x; #y;
*m() { return 42; }
x() {
x() {
this.#x = 42;
return this.#x;
}

View File

@ -0,0 +1,67 @@
// This file was procedurally generated from the following sources:
// - src/class-fields/static-private-fields.case
// - src/class-fields/productions/cls-expr-new-sc-line-generator.template
/*---
description: static private fields (field definitions followed by a method in a new line with a semicolon)
esid: prod-FieldDefinition
features: [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 #x; static #y;
*m() { return 42; }
static x() {
this.#x = 42;
return this.#x;
}
static y() {
this.#y = 43;
return this.#y;
}
}
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 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");

View File

@ -0,0 +1,73 @@
// This file was procedurally generated from the following sources:
// - src/class-fields/static-private-methods.case
// - src/class-fields/productions/cls-expr-new-sc-line-generator.template
/*---
description: static private methods (field definitions followed by a method in a new line with a semicolon)
esid: prod-FieldDefinition
features: [class-static-methods-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.#y = 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, "#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");

View File

@ -25,7 +25,7 @@ var C = class {
'a'; "b"; 'c' = 39;
"d" = 42;
*m() { return 42; }
}
var c = new C();

View File

@ -26,7 +26,7 @@ var x = "b";
var C = class {
[x] = 42; [10] = "meep"; ["not initialized"];
m() { return 42; }
}
var c = new C();

View File

@ -27,7 +27,7 @@ var y = Symbol();
var C = class {
[x]; [y] = 42;
m() { return 42; }
}
var c = new C();

View File

@ -27,7 +27,7 @@ var C = class {
a; b = 42;
c = fn;
m() { return 42; }
}
var c = new C();

Some files were not shown because too many files have changed in this diff Show More