mirror of
https://github.com/tc39/test262.git
synced 2025-07-21 21:14:45 +02:00
Generate tests
This commit is contained in:
parent
0298174c06
commit
f222b94f2a
@ -4,7 +4,7 @@
|
|||||||
/*---
|
/*---
|
||||||
description: Syntax error if you call delete on member expressions . privatename (in field, covered)
|
description: Syntax error if you call delete on member expressions . privatename (in field, covered)
|
||||||
esid: sec-class-definitions-static-semantics-early-errors
|
esid: sec-class-definitions-static-semantics-early-errors
|
||||||
features: [class-fields-private, class]
|
features: [class-fields-private, class, class-fields-public]
|
||||||
flags: [generated]
|
flags: [generated]
|
||||||
negative:
|
negative:
|
||||||
phase: parse
|
phase: parse
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// - src/class-fields/private-names.case
|
// - src/class-fields/private-names.case
|
||||||
// - src/class-fields/productions/cls-expr-after-same-line-gen.template
|
// - 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
|
esid: prod-FieldDefinition
|
||||||
features: [class-fields-private, generators, class, class-fields-public]
|
features: [class-fields-private, generators, class, class-fields-public]
|
||||||
flags: [generated]
|
flags: [generated]
|
||||||
|
@ -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");
|
@ -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");
|
@ -2,7 +2,7 @@
|
|||||||
// - src/class-fields/private-names.case
|
// - src/class-fields/private-names.case
|
||||||
// - src/class-fields/productions/cls-expr-after-same-line-method.template
|
// - 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
|
esid: prod-FieldDefinition
|
||||||
features: [class-fields-private, class, class-fields-public]
|
features: [class-fields-private, class, class-fields-public]
|
||||||
flags: [generated]
|
flags: [generated]
|
||||||
|
@ -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");
|
@ -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");
|
@ -2,7 +2,7 @@
|
|||||||
// - src/class-fields/private-names.case
|
// - src/class-fields/private-names.case
|
||||||
// - src/class-fields/productions/cls-expr-after-same-line-static-async-gen.template
|
// - 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
|
esid: prod-FieldDefinition
|
||||||
features: [class-fields-private, class, class-fields-public, async-iteration]
|
features: [class-fields-private, class, class-fields-public, async-iteration]
|
||||||
flags: [generated, async]
|
flags: [generated, async]
|
||||||
|
@ -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);
|
@ -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);
|
@ -2,7 +2,7 @@
|
|||||||
// - src/class-fields/private-names.case
|
// - src/class-fields/private-names.case
|
||||||
// - src/class-fields/productions/cls-expr-after-same-line-static-async-method.template
|
// - 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
|
esid: prod-FieldDefinition
|
||||||
features: [class-fields-private, class, class-fields-public, async-functions]
|
features: [class-fields-private, class, class-fields-public, async-functions]
|
||||||
flags: [generated, async]
|
flags: [generated, async]
|
||||||
|
@ -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);
|
@ -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);
|
@ -2,7 +2,7 @@
|
|||||||
// - src/class-fields/private-names.case
|
// - src/class-fields/private-names.case
|
||||||
// - src/class-fields/productions/cls-expr-after-same-line-static-gen.template
|
// - 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
|
esid: prod-FieldDefinition
|
||||||
features: [class-fields-private, generators, class, class-fields-public]
|
features: [class-fields-private, generators, class, class-fields-public]
|
||||||
flags: [generated]
|
flags: [generated]
|
||||||
|
@ -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");
|
@ -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");
|
@ -2,7 +2,7 @@
|
|||||||
// - src/class-fields/private-names.case
|
// - src/class-fields/private-names.case
|
||||||
// - src/class-fields/productions/cls-expr-after-same-line-static-method.template
|
// - 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
|
esid: prod-FieldDefinition
|
||||||
features: [class-fields-private, class, class-fields-public]
|
features: [class-fields-private, class, class-fields-public]
|
||||||
flags: [generated]
|
flags: [generated]
|
||||||
|
@ -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");
|
@ -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");
|
@ -4,7 +4,7 @@
|
|||||||
/*---
|
/*---
|
||||||
description: ToPrimitive evaluation in the ComputedPropertyName (field definitions in a class expression)
|
description: ToPrimitive evaluation in the ComputedPropertyName (field definitions in a class expression)
|
||||||
esid: prod-FieldDefinition
|
esid: prod-FieldDefinition
|
||||||
features: [computed-property-names, Symbol.toPrimitive, Symbol, class, class-fields-public]
|
features: [computed-property-names, Symbol.toPrimitive, Symbol, class]
|
||||||
flags: [generated]
|
flags: [generated]
|
||||||
includes: [propertyHelper.js]
|
includes: [propertyHelper.js]
|
||||||
info: |
|
info: |
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
/*---
|
/*---
|
||||||
description: ToPrimitive evaluation in the ComputedPropertyName (field definitions in a class expression)
|
description: ToPrimitive evaluation in the ComputedPropertyName (field definitions in a class expression)
|
||||||
esid: prod-FieldDefinition
|
esid: prod-FieldDefinition
|
||||||
features: [computed-property-names, Symbol.toPrimitive, class, class-fields-public]
|
features: [computed-property-names, Symbol.toPrimitive, class]
|
||||||
flags: [generated]
|
flags: [generated]
|
||||||
includes: [propertyHelper.js]
|
includes: [propertyHelper.js]
|
||||||
info: |
|
info: |
|
||||||
|
@ -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);
|
|
@ -4,7 +4,7 @@
|
|||||||
/*---
|
/*---
|
||||||
description: The constructor method is called after the fields are initalized (field definitions in a class expression)
|
description: The constructor method is called after the fields are initalized (field definitions in a class expression)
|
||||||
esid: prod-FieldDefinition
|
esid: prod-FieldDefinition
|
||||||
features: [class, class-fields-public]
|
features: [class]
|
||||||
flags: [generated]
|
flags: [generated]
|
||||||
info: |
|
info: |
|
||||||
[[Construct]] ( argumentsList, newTarget)
|
[[Construct]] ( argumentsList, newTarget)
|
||||||
|
@ -23,9 +23,8 @@ info: |
|
|||||||
---*/
|
---*/
|
||||||
|
|
||||||
|
|
||||||
var A = class {}
|
|
||||||
|
|
||||||
var executed = false;
|
var executed = false;
|
||||||
|
var A = class {}
|
||||||
var C = class extends A {
|
var C = class extends A {
|
||||||
x = eval('executed = true; super()["x"];');
|
x = eval('executed = true; super()["x"];');
|
||||||
}
|
}
|
||||||
|
@ -7,13 +7,6 @@ esid: sec-performeval-rules-in-initializer
|
|||||||
features: [class, class-fields-public]
|
features: [class, class-fields-public]
|
||||||
flags: [generated]
|
flags: [generated]
|
||||||
info: |
|
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
|
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.
|
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
|
ScriptBody:StatementList
|
||||||
@ -23,9 +16,8 @@ info: |
|
|||||||
---*/
|
---*/
|
||||||
|
|
||||||
|
|
||||||
var A = class {}
|
|
||||||
|
|
||||||
var executed = false;
|
var executed = false;
|
||||||
|
var A = class {}
|
||||||
var C = class extends A {
|
var C = class extends A {
|
||||||
x = eval('executed = true; super().x;');
|
x = eval('executed = true; super().x;');
|
||||||
}
|
}
|
||||||
|
@ -23,9 +23,8 @@ info: |
|
|||||||
---*/
|
---*/
|
||||||
|
|
||||||
|
|
||||||
var A = class {}
|
|
||||||
|
|
||||||
var executed = false;
|
var executed = false;
|
||||||
|
var A = class {}
|
||||||
var C = class extends A {
|
var C = class extends A {
|
||||||
x = eval('executed = true; super();');
|
x = eval('executed = true; super();');
|
||||||
}
|
}
|
||||||
|
@ -23,12 +23,11 @@ info: |
|
|||||||
---*/
|
---*/
|
||||||
|
|
||||||
|
|
||||||
var A = class {}
|
|
||||||
|
|
||||||
var executed = false;
|
var executed = false;
|
||||||
|
var A = class {}
|
||||||
var C = class extends A {
|
var C = class extends A {
|
||||||
x = eval('executed = true; super.x;');
|
x = eval('executed = true; super.x;');
|
||||||
}
|
};
|
||||||
|
|
||||||
new C();
|
new C();
|
||||||
|
|
||||||
|
@ -2,20 +2,17 @@
|
|||||||
// - src/class-fields/eval-err-contains-superproperty-2.case
|
// - src/class-fields/eval-err-contains-superproperty-2.case
|
||||||
// - src/class-fields/initializer-eval-super-property/cls-expr-fields-eval.template
|
// - 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
|
esid: sec-performeval-rules-in-initializer
|
||||||
features: [class, class-fields-public]
|
features: [class, class-fields-public]
|
||||||
flags: [generated]
|
flags: [generated]
|
||||||
info: |
|
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
|
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.
|
These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition.
|
||||||
|
|
||||||
ScriptBody : StatementList
|
ScriptBody : StatementList
|
||||||
|
|
||||||
It is a Syntax Error if StatementList Contains SuperProperty.
|
It is a Syntax Error if StatementList Contains SuperProperty.
|
||||||
@ -23,12 +20,11 @@ info: |
|
|||||||
---*/
|
---*/
|
||||||
|
|
||||||
|
|
||||||
var A = class {}
|
|
||||||
|
|
||||||
var executed = false;
|
var executed = false;
|
||||||
|
var A = class {}
|
||||||
var C = class extends A {
|
var C = class extends A {
|
||||||
x = eval('executed = true; super["x"];');
|
x = eval('executed = true; super["x"];');
|
||||||
}
|
};
|
||||||
|
|
||||||
new C();
|
new C();
|
||||||
|
|
||||||
|
@ -23,9 +23,8 @@ info: |
|
|||||||
---*/
|
---*/
|
||||||
|
|
||||||
|
|
||||||
var A = class {}
|
|
||||||
|
|
||||||
var executed = false;
|
var executed = false;
|
||||||
|
var A = class {}
|
||||||
var C = class extends A {
|
var C = class extends A {
|
||||||
x = (0, eval)('executed = true; super()["x"];');
|
x = (0, eval)('executed = true; super()["x"];');
|
||||||
}
|
}
|
||||||
|
@ -7,13 +7,6 @@ esid: sec-performeval-rules-in-initializer
|
|||||||
features: [class, class-fields-public]
|
features: [class, class-fields-public]
|
||||||
flags: [generated]
|
flags: [generated]
|
||||||
info: |
|
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
|
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.
|
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
|
ScriptBody:StatementList
|
||||||
@ -23,9 +16,8 @@ info: |
|
|||||||
---*/
|
---*/
|
||||||
|
|
||||||
|
|
||||||
var A = class {}
|
|
||||||
|
|
||||||
var executed = false;
|
var executed = false;
|
||||||
|
var A = class {}
|
||||||
var C = class extends A {
|
var C = class extends A {
|
||||||
x = (0, eval)('executed = true; super().x;');
|
x = (0, eval)('executed = true; super().x;');
|
||||||
}
|
}
|
||||||
|
@ -23,9 +23,8 @@ info: |
|
|||||||
---*/
|
---*/
|
||||||
|
|
||||||
|
|
||||||
var A = class {}
|
|
||||||
|
|
||||||
var executed = false;
|
var executed = false;
|
||||||
|
var A = class {}
|
||||||
var C = class extends A {
|
var C = class extends A {
|
||||||
x = (0, eval)('executed = true; super();');
|
x = (0, eval)('executed = true; super();');
|
||||||
}
|
}
|
||||||
|
@ -23,12 +23,11 @@ info: |
|
|||||||
---*/
|
---*/
|
||||||
|
|
||||||
|
|
||||||
var A = class {}
|
|
||||||
|
|
||||||
var executed = false;
|
var executed = false;
|
||||||
|
var A = class {}
|
||||||
var C = class extends A {
|
var C = class extends A {
|
||||||
x = (0, eval)('executed = true; super.x;');
|
x = (0, eval)('executed = true; super.x;');
|
||||||
}
|
};
|
||||||
|
|
||||||
assert.throws(SyntaxError, function() {
|
assert.throws(SyntaxError, function() {
|
||||||
new C();
|
new C();
|
||||||
|
@ -2,20 +2,17 @@
|
|||||||
// - src/class-fields/eval-err-contains-superproperty-2.case
|
// - src/class-fields/eval-err-contains-superproperty-2.case
|
||||||
// - src/class-fields/initializer-eval-super-property/cls-expr-fields-indirect-eval.template
|
// - 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
|
esid: sec-performeval-rules-in-initializer
|
||||||
features: [class, class-fields-public]
|
features: [class, class-fields-public]
|
||||||
flags: [generated]
|
flags: [generated]
|
||||||
info: |
|
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
|
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.
|
These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition.
|
||||||
|
|
||||||
ScriptBody : StatementList
|
ScriptBody : StatementList
|
||||||
|
|
||||||
It is a Syntax Error if StatementList Contains SuperProperty.
|
It is a Syntax Error if StatementList Contains SuperProperty.
|
||||||
@ -23,12 +20,11 @@ info: |
|
|||||||
---*/
|
---*/
|
||||||
|
|
||||||
|
|
||||||
var A = class {}
|
|
||||||
|
|
||||||
var executed = false;
|
var executed = false;
|
||||||
|
var A = class {}
|
||||||
var C = class extends A {
|
var C = class extends A {
|
||||||
x = (0, eval)('executed = true; super["x"];');
|
x = (0, eval)('executed = true; super["x"];');
|
||||||
}
|
};
|
||||||
|
|
||||||
assert.throws(SyntaxError, function() {
|
assert.throws(SyntaxError, function() {
|
||||||
new C();
|
new C();
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
/*---
|
/*---
|
||||||
description: error if `new.target` in StatementList of eval (direct eval)
|
description: error if `new.target` in StatementList of eval (direct eval)
|
||||||
esid: sec-performeval-rules-in-initializer
|
esid: sec-performeval-rules-in-initializer
|
||||||
features: [class, class-fields-public, new.target]
|
features: [class, new.target, class-fields-public]
|
||||||
flags: [generated]
|
flags: [generated]
|
||||||
info: |
|
info: |
|
||||||
Additional Early Error Rules for Eval Inside Initializer
|
Additional Early Error Rules for Eval Inside Initializer
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
/*---
|
/*---
|
||||||
description: ReferenceError evaluating a computed property name (field definitions in a class expression)
|
description: ReferenceError evaluating a computed property name (field definitions in a class expression)
|
||||||
esid: sec-runtime-semantics-classdefinitionevaluation
|
esid: sec-runtime-semantics-classdefinitionevaluation
|
||||||
features: [computed-property-names, class, class-fields-public]
|
features: [computed-property-names, class]
|
||||||
flags: [generated]
|
flags: [generated]
|
||||||
info: |
|
info: |
|
||||||
Runtime Semantics: ClassDefinitionEvaluation
|
Runtime Semantics: ClassDefinitionEvaluation
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
/*---
|
/*---
|
||||||
description: Custom error evaluating a computed property name (field definitions in a class expression)
|
description: Custom error evaluating a computed property name (field definitions in a class expression)
|
||||||
esid: sec-runtime-semantics-classdefinitionevaluation
|
esid: sec-runtime-semantics-classdefinitionevaluation
|
||||||
features: [computed-property-names, Symbol.toPrimitive, class, class-fields-public]
|
features: [computed-property-names, Symbol.toPrimitive, class]
|
||||||
flags: [generated]
|
flags: [generated]
|
||||||
info: |
|
info: |
|
||||||
Runtime Semantics: ClassDefinitionEvaluation
|
Runtime Semantics: ClassDefinitionEvaluation
|
||||||
|
@ -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);
|
@ -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);
|
@ -4,7 +4,7 @@
|
|||||||
/*---
|
/*---
|
||||||
description: Custom error evaluating a computed property name (field definitions in a class expression)
|
description: Custom error evaluating a computed property name (field definitions in a class expression)
|
||||||
esid: sec-runtime-semantics-classdefinitionevaluation
|
esid: sec-runtime-semantics-classdefinitionevaluation
|
||||||
features: [computed-property-names, class, class-fields-public]
|
features: [computed-property-names, class]
|
||||||
flags: [generated]
|
flags: [generated]
|
||||||
info: |
|
info: |
|
||||||
Runtime Semantics: ClassDefinitionEvaluation
|
Runtime Semantics: ClassDefinitionEvaluation
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
/*---
|
/*---
|
||||||
description: Custom error evaluating a computed property name (field definitions in a class expression)
|
description: Custom error evaluating a computed property name (field definitions in a class expression)
|
||||||
esid: sec-runtime-semantics-classdefinitionevaluation
|
esid: sec-runtime-semantics-classdefinitionevaluation
|
||||||
features: [computed-property-names, class, class-fields-public]
|
features: [computed-property-names, class]
|
||||||
flags: [generated]
|
flags: [generated]
|
||||||
info: |
|
info: |
|
||||||
Runtime Semantics: ClassDefinitionEvaluation
|
Runtime Semantics: ClassDefinitionEvaluation
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
/*---
|
/*---
|
||||||
description: error if `new.target` in StatementList of eval (indirect eval)
|
description: error if `new.target` in StatementList of eval (indirect eval)
|
||||||
esid: sec-performeval-rules-in-initializer
|
esid: sec-performeval-rules-in-initializer
|
||||||
features: [class, class-fields-public, new.target]
|
features: [class, new.target, class-fields-public]
|
||||||
flags: [generated]
|
flags: [generated]
|
||||||
info: |
|
info: |
|
||||||
Additional Early Error Rules for Eval Inside Initializer
|
Additional Early Error Rules for Eval Inside Initializer
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
/*---
|
/*---
|
||||||
description: Return abrupt completion evaluating the field initializer (field definitions in a class expression)
|
description: Return abrupt completion evaluating the field initializer (field definitions in a class expression)
|
||||||
esid: prod-FieldDefinition
|
esid: prod-FieldDefinition
|
||||||
features: [class, class-fields-public]
|
features: [class]
|
||||||
flags: [generated]
|
flags: [generated]
|
||||||
info: |
|
info: |
|
||||||
[[Construct]] ( argumentsList, newTarget)
|
[[Construct]] ( argumentsList, newTarget)
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
/*---
|
/*---
|
||||||
description: The initializer value is defined after the class evaluation (field definitions in a class expression)
|
description: The initializer value is defined after the class evaluation (field definitions in a class expression)
|
||||||
esid: prod-FieldDefinition
|
esid: prod-FieldDefinition
|
||||||
features: [computed-property-names, class, class-fields-public]
|
features: [computed-property-names, class]
|
||||||
flags: [generated]
|
flags: [generated]
|
||||||
includes: [propertyHelper.js]
|
includes: [propertyHelper.js]
|
||||||
info: |
|
info: |
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
/*---
|
/*---
|
||||||
description: The initializer value is defined during the class instatiation (field definitions in a class expression)
|
description: The initializer value is defined during the class instatiation (field definitions in a class expression)
|
||||||
esid: prod-FieldDefinition
|
esid: prod-FieldDefinition
|
||||||
features: [computed-property-names, class, class-fields-public]
|
features: [computed-property-names, class]
|
||||||
flags: [generated]
|
flags: [generated]
|
||||||
includes: [propertyHelper.js]
|
includes: [propertyHelper.js]
|
||||||
info: |
|
info: |
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// - src/class-fields/private-names.case
|
// - src/class-fields/private-names.case
|
||||||
// - src/class-fields/productions/cls-expr-multiple-definitions.template
|
// - 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
|
esid: prod-FieldDefinition
|
||||||
features: [class-fields-private, class, class-fields-public]
|
features: [class-fields-private, class, class-fields-public]
|
||||||
flags: [generated]
|
flags: [generated]
|
||||||
|
@ -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");
|
@ -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();
|
||||||
|
});
|
@ -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");
|
@ -2,7 +2,7 @@
|
|||||||
// - src/class-fields/private-names.case
|
// - src/class-fields/private-names.case
|
||||||
// - src/class-fields/productions/cls-expr-multiple-stacked-definitions.template
|
// - 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
|
esid: prod-FieldDefinition
|
||||||
features: [class-fields-private, class, class-fields-public]
|
features: [class-fields-private, class, class-fields-public]
|
||||||
flags: [generated]
|
flags: [generated]
|
||||||
|
@ -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");
|
@ -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");
|
@ -2,7 +2,7 @@
|
|||||||
// - src/class-fields/private-names.case
|
// - src/class-fields/private-names.case
|
||||||
// - src/class-fields/productions/cls-expr-new-no-sc-line-method.template
|
// - 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
|
esid: prod-FieldDefinition
|
||||||
features: [class-fields-private, class, class-fields-public]
|
features: [class-fields-private, class, class-fields-public]
|
||||||
flags: [generated]
|
flags: [generated]
|
||||||
|
@ -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");
|
@ -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");
|
@ -2,7 +2,7 @@
|
|||||||
// - src/class-fields/private-names.case
|
// - src/class-fields/private-names.case
|
||||||
// - src/class-fields/productions/cls-expr-new-sc-line-generator.template
|
// - 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
|
esid: prod-FieldDefinition
|
||||||
features: [class-fields-private, class, class-fields-public, generators]
|
features: [class-fields-private, class, class-fields-public, generators]
|
||||||
flags: [generated]
|
flags: [generated]
|
||||||
|
@ -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");
|
@ -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");
|
@ -2,7 +2,7 @@
|
|||||||
// - src/class-fields/private-names.case
|
// - src/class-fields/private-names.case
|
||||||
// - src/class-fields/productions/cls-expr-new-sc-line-method.template
|
// - src/class-fields/productions/cls-expr-new-sc-line-method.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
|
esid: prod-FieldDefinition
|
||||||
features: [class-fields-private, class, class-fields-public]
|
features: [class-fields-private, class, class-fields-public]
|
||||||
flags: [generated]
|
flags: [generated]
|
||||||
|
@ -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-method.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]
|
||||||
|
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");
|
@ -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-method.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]
|
||||||
|
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");
|
@ -0,0 +1,36 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/class-fields/eval-err-contains-arguments.case
|
||||||
|
// - src/class-fields/initializer-eval-arguments/cls-expr-private-fields-eval.template
|
||||||
|
/*---
|
||||||
|
description: error if `arguments` in StatementList of eval (direct eval)
|
||||||
|
esid: sec-performeval-rules-in-initializer
|
||||||
|
features: [class, class-fields-public, class-fields-private]
|
||||||
|
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
|
||||||
|
|
||||||
|
It is a Syntax Error if ContainsArguments of StatementList is true.
|
||||||
|
...
|
||||||
|
|
||||||
|
Static Semantics: ContainsArguments
|
||||||
|
IdentifierReference : Identifier
|
||||||
|
|
||||||
|
1. If the StringValue of Identifier is "arguments", return true.
|
||||||
|
...
|
||||||
|
For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false.
|
||||||
|
|
||||||
|
---*/
|
||||||
|
|
||||||
|
|
||||||
|
var executed = false;
|
||||||
|
var C = class {
|
||||||
|
#x = eval('executed = true; arguments;');
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.throws(SyntaxError, function() {
|
||||||
|
new C();
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.sameValue(executed, false);
|
@ -0,0 +1,34 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/class-fields/eval-err-contains-newtarget.case
|
||||||
|
// - src/class-fields/initializer-eval-newtarget/cls-expr-private-fields-eval.template
|
||||||
|
/*---
|
||||||
|
description: error if `new.target` in StatementList of eval (direct eval)
|
||||||
|
esid: sec-performeval-rules-in-initializer
|
||||||
|
features: [class, new.target, class-fields-private]
|
||||||
|
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 Functions
|
||||||
|
These static semantics are applied by PerformEval when a direct eval call occurs outside of any function.
|
||||||
|
ScriptBody:StatementList
|
||||||
|
|
||||||
|
It is a Syntax Error if StatementList Contains NewTarget.
|
||||||
|
|
||||||
|
---*/
|
||||||
|
|
||||||
|
|
||||||
|
var executed = false;
|
||||||
|
var C = class {
|
||||||
|
#x = eval('executed = true; new.target;');
|
||||||
|
}
|
||||||
|
|
||||||
|
var c = new C();
|
||||||
|
|
||||||
|
assert.sameValue(executed, true);
|
||||||
|
assert.sameValue(c.x, undefined);
|
@ -0,0 +1,36 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/class-fields/eval-err-contains-arguments.case
|
||||||
|
// - src/class-fields/initializer-eval-arguments/cls-expr-private-fields-indirect-eval.template
|
||||||
|
/*---
|
||||||
|
description: error if `arguments` in StatementList of eval (indirect eval)
|
||||||
|
esid: sec-performeval-rules-in-initializer
|
||||||
|
features: [class, class-fields-public, class-fields-private]
|
||||||
|
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
|
||||||
|
|
||||||
|
It is a Syntax Error if ContainsArguments of StatementList is true.
|
||||||
|
...
|
||||||
|
|
||||||
|
Static Semantics: ContainsArguments
|
||||||
|
IdentifierReference : Identifier
|
||||||
|
|
||||||
|
1. If the StringValue of Identifier is "arguments", return true.
|
||||||
|
...
|
||||||
|
For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false.
|
||||||
|
|
||||||
|
---*/
|
||||||
|
|
||||||
|
|
||||||
|
var executed = false;
|
||||||
|
var C = class {
|
||||||
|
#x = (0, eval)('executed = true; arguments;');
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.throws(ReferenceError, function() {
|
||||||
|
new C();
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.sameValue(executed, true);
|
@ -0,0 +1,35 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/class-fields/eval-err-contains-newtarget.case
|
||||||
|
// - src/class-fields/initializer-eval-newtarget/cls-expr-private-fields-indirect-eval.template
|
||||||
|
/*---
|
||||||
|
description: error if `new.target` in StatementList of eval (indirect eval)
|
||||||
|
esid: sec-performeval-rules-in-initializer
|
||||||
|
features: [class, new.target, class-fields-private]
|
||||||
|
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 Functions
|
||||||
|
These static semantics are applied by PerformEval when a direct eval call occurs outside of any function.
|
||||||
|
ScriptBody:StatementList
|
||||||
|
|
||||||
|
It is a Syntax Error if StatementList Contains NewTarget.
|
||||||
|
|
||||||
|
---*/
|
||||||
|
|
||||||
|
|
||||||
|
var executed = false;
|
||||||
|
var C = class {
|
||||||
|
#x = (0, eval)('executed = true; new.target;');
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.throws(SyntaxError, function() {
|
||||||
|
new C();
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.sameValue(executed, false);
|
@ -4,7 +4,7 @@
|
|||||||
/*---
|
/*---
|
||||||
description: Redeclaration of public fields with the same name (field definitions in a class expression)
|
description: Redeclaration of public fields with the same name (field definitions in a class expression)
|
||||||
esid: prod-FieldDefinition
|
esid: prod-FieldDefinition
|
||||||
features: [class, class-fields-public]
|
features: [class]
|
||||||
flags: [generated]
|
flags: [generated]
|
||||||
includes: [propertyHelper.js, compareArray.js]
|
includes: [propertyHelper.js, compareArray.js]
|
||||||
info: |
|
info: |
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
/*---
|
/*---
|
||||||
description: Redeclaration of public fields with the same name (field definitions in a class expression)
|
description: Redeclaration of public fields with the same name (field definitions in a class expression)
|
||||||
esid: prod-FieldDefinition
|
esid: prod-FieldDefinition
|
||||||
features: [class, class-fields-public]
|
features: [class]
|
||||||
flags: [generated]
|
flags: [generated]
|
||||||
includes: [propertyHelper.js, compareArray.js]
|
includes: [propertyHelper.js, compareArray.js]
|
||||||
info: |
|
info: |
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// - src/class-fields/private-names.case
|
// - src/class-fields/private-names.case
|
||||||
// - src/class-fields/productions/cls-expr-regular-definitions.template
|
// - src/class-fields/productions/cls-expr-regular-definitions.template
|
||||||
/*---
|
/*---
|
||||||
description: static literal private names (regular fields defintion)
|
description: private names (regular fields defintion)
|
||||||
esid: prod-FieldDefinition
|
esid: prod-FieldDefinition
|
||||||
features: [class-fields-private, class, class-fields-public]
|
features: [class-fields-private, class, class-fields-public]
|
||||||
flags: [generated]
|
flags: [generated]
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
// This file was procedurally generated from the following sources:
|
// This file was procedurally generated from the following sources:
|
||||||
// - src/class-fields/static-private-names.case
|
// - src/class-fields/static-private-fields.case
|
||||||
// - src/class-fields/default/cls-decl.template
|
// - src/class-fields/productions/cls-expr-regular-definitions.template
|
||||||
/*---
|
/*---
|
||||||
description: literal private names (field definitions in a class declaration)
|
description: static private fields (regular fields defintion)
|
||||||
esid: prod-FieldDefinition
|
esid: prod-FieldDefinition
|
||||||
features: [class, class-fields-public]
|
features: [class-static-fields-private, class, class-fields-public]
|
||||||
flags: [generated]
|
flags: [generated]
|
||||||
info: |
|
info: |
|
||||||
ClassElement :
|
ClassElement :
|
||||||
@ -23,9 +23,19 @@ info: |
|
|||||||
---*/
|
---*/
|
||||||
|
|
||||||
|
|
||||||
class C {
|
var C = class {
|
||||||
static #x; static #y
|
static #x; static #y
|
||||||
|
static x() {
|
||||||
|
this.#x = 42;
|
||||||
|
return this.#x;
|
||||||
}
|
}
|
||||||
|
static y() {
|
||||||
|
this.#y = 43;
|
||||||
|
return this.#y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var c = new C();
|
||||||
|
|
||||||
// Test the private fields do not appear as properties before set to value
|
// 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.prototype, "#x"), false, "test 1");
|
@ -0,0 +1,61 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/class-fields/static-private-methods.case
|
||||||
|
// - src/class-fields/productions/cls-expr-regular-definitions.template
|
||||||
|
/*---
|
||||||
|
description: static private methods (regular fields defintion)
|
||||||
|
esid: prod-FieldDefinition
|
||||||
|
features: [class-static-methods-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.#y = 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, "#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");
|
@ -2,7 +2,7 @@
|
|||||||
// - src/class-fields/private-names.case
|
// - src/class-fields/private-names.case
|
||||||
// - src/class-fields/productions/cls-expr-after-same-line-async-gen.template
|
// - src/class-fields/productions/cls-expr-after-same-line-async-gen.template
|
||||||
/*---
|
/*---
|
||||||
description: static literal private names (field definitions after an async generator in the same line)
|
description: private names (field definitions after an async generator in the same line)
|
||||||
esid: prod-FieldDefinition
|
esid: prod-FieldDefinition
|
||||||
features: [class-fields-private, class, class-fields-public, async-iteration]
|
features: [class-fields-private, class, class-fields-public, async-iteration]
|
||||||
flags: [generated, async]
|
flags: [generated, async]
|
||||||
|
@ -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-async-gen.template
|
||||||
|
/*---
|
||||||
|
description: static private fields (field definitions after an 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 {
|
||||||
|
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(c.m, C.prototype.m);
|
||||||
|
|
||||||
|
verifyProperty(C.prototype, "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);
|
@ -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-async-gen.template
|
||||||
|
/*---
|
||||||
|
description: static private methods (field definitions after an 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 {
|
||||||
|
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(c.m, C.prototype.m);
|
||||||
|
|
||||||
|
verifyProperty(C.prototype, "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);
|
@ -2,7 +2,7 @@
|
|||||||
// - src/class-fields/private-names.case
|
// - src/class-fields/private-names.case
|
||||||
// - src/class-fields/productions/cls-expr-after-same-line-async-method.template
|
// - src/class-fields/productions/cls-expr-after-same-line-async-method.template
|
||||||
/*---
|
/*---
|
||||||
description: static literal private names (field definitions after an async method in the same line)
|
description: private names (field definitions after an async method in the same line)
|
||||||
esid: prod-FieldDefinition
|
esid: prod-FieldDefinition
|
||||||
features: [class-fields-private, class, class-fields-public, async-functions]
|
features: [class-fields-private, class, class-fields-public, async-functions]
|
||||||
flags: [generated, async]
|
flags: [generated, async]
|
||||||
|
@ -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-async-method.template
|
||||||
|
/*---
|
||||||
|
description: static private fields (field definitions after an 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 {
|
||||||
|
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(c.m, C.prototype.m);
|
||||||
|
|
||||||
|
verifyProperty(C.prototype, "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);
|
@ -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-async-method.template
|
||||||
|
/*---
|
||||||
|
description: static private methods (field definitions after an 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 {
|
||||||
|
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(c.m, C.prototype.m);
|
||||||
|
|
||||||
|
verifyProperty(C.prototype, "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);
|
@ -2,7 +2,7 @@
|
|||||||
// - src/class-fields/private-names.case
|
// - src/class-fields/private-names.case
|
||||||
// - src/class-fields/productions/cls-expr-same-line-generator.template
|
// - src/class-fields/productions/cls-expr-same-line-generator.template
|
||||||
/*---
|
/*---
|
||||||
description: static literal private names (field definitions followed by a generator method in the same line)
|
description: private names (field definitions followed by a generator method in the same line)
|
||||||
esid: prod-FieldDefinition
|
esid: prod-FieldDefinition
|
||||||
features: [class-fields-private, class, class-fields-public, generators]
|
features: [class-fields-private, class, class-fields-public, generators]
|
||||||
flags: [generated]
|
flags: [generated]
|
||||||
|
@ -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-same-line-generator.template
|
||||||
|
/*---
|
||||||
|
description: static private fields (field definitions followed by a generator method in the same line)
|
||||||
|
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");
|
@ -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-same-line-generator.template
|
||||||
|
/*---
|
||||||
|
description: static private methods (field definitions followed by a generator method in the same line)
|
||||||
|
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");
|
@ -2,7 +2,7 @@
|
|||||||
// - src/class-fields/private-names.case
|
// - src/class-fields/private-names.case
|
||||||
// - src/class-fields/productions/cls-expr-same-line-method.template
|
// - src/class-fields/productions/cls-expr-same-line-method.template
|
||||||
/*---
|
/*---
|
||||||
description: static literal private names (field definitions followed by a method in the same line)
|
description: private names (field definitions followed by a method in the same line)
|
||||||
esid: prod-FieldDefinition
|
esid: prod-FieldDefinition
|
||||||
features: [class-fields-private, class, class-fields-public]
|
features: [class-fields-private, class, class-fields-public]
|
||||||
flags: [generated]
|
flags: [generated]
|
||||||
|
@ -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-same-line-method.template
|
||||||
|
/*---
|
||||||
|
description: static private fields (field definitions followed by 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 {
|
||||||
|
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");
|
@ -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-same-line-method.template
|
||||||
|
/*---
|
||||||
|
description: static private methods (field definitions followed by 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 {
|
||||||
|
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");
|
@ -0,0 +1,35 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/class-fields/init-err-contains-arguments.case
|
||||||
|
// - src/class-fields/initializer-error/cls-expr-fields-static-comp-name.template
|
||||||
|
/*---
|
||||||
|
description: Syntax error if `arguments` used in class field (static computed ClassElementName)
|
||||||
|
esid: sec-class-definitions-static-semantics-early-errors
|
||||||
|
features: [class, class-fields-public, class-static-fields-public]
|
||||||
|
flags: [generated]
|
||||||
|
negative:
|
||||||
|
phase: parse
|
||||||
|
type: SyntaxError
|
||||||
|
info: |
|
||||||
|
Static Semantics: Early Errors
|
||||||
|
|
||||||
|
FieldDefinition:
|
||||||
|
PropertyNameInitializeropt
|
||||||
|
|
||||||
|
- It is a Syntax Error if ContainsArguments of Initializer is true.
|
||||||
|
|
||||||
|
Static Semantics: ContainsArguments
|
||||||
|
IdentifierReference : Identifier
|
||||||
|
|
||||||
|
1. If the StringValue of Identifier is "arguments", return true.
|
||||||
|
...
|
||||||
|
For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false.
|
||||||
|
|
||||||
|
---*/
|
||||||
|
|
||||||
|
|
||||||
|
throw "Test262: This statement should not be evaluated.";
|
||||||
|
|
||||||
|
var x = "string";
|
||||||
|
var C = class {
|
||||||
|
static [x] = arguments;
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/class-fields/init-err-contains-super.case
|
||||||
|
// - src/class-fields/initializer-error/cls-expr-fields-static-comp-name.template
|
||||||
|
/*---
|
||||||
|
description: Syntax error if `super()` used in class field (static computed ClassElementName)
|
||||||
|
esid: sec-class-definitions-static-semantics-early-errors
|
||||||
|
features: [class, class-fields-public, class-static-fields-public]
|
||||||
|
flags: [generated]
|
||||||
|
negative:
|
||||||
|
phase: parse
|
||||||
|
type: SyntaxError
|
||||||
|
info: |
|
||||||
|
Static Semantics: Early Errors
|
||||||
|
|
||||||
|
FieldDefinition:
|
||||||
|
PropertyNameInitializeropt
|
||||||
|
|
||||||
|
- It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true.
|
||||||
|
|
||||||
|
---*/
|
||||||
|
|
||||||
|
|
||||||
|
throw "Test262: This statement should not be evaluated.";
|
||||||
|
|
||||||
|
var x = "string";
|
||||||
|
var C = class {
|
||||||
|
static [x] = super();
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/class-fields/init-err-contains-arguments.case
|
||||||
|
// - src/class-fields/initializer-error/cls-expr-fields-static-literal-name.template
|
||||||
|
/*---
|
||||||
|
description: Syntax error if `arguments` used in class field (static literal ClassElementName)
|
||||||
|
esid: sec-class-definitions-static-semantics-early-errors
|
||||||
|
features: [class, class-fields-public, class-static-fields-public]
|
||||||
|
flags: [generated]
|
||||||
|
negative:
|
||||||
|
phase: parse
|
||||||
|
type: SyntaxError
|
||||||
|
info: |
|
||||||
|
Static Semantics: Early Errors
|
||||||
|
|
||||||
|
FieldDefinition:
|
||||||
|
PropertyNameInitializeropt
|
||||||
|
|
||||||
|
- It is a Syntax Error if ContainsArguments of Initializer is true.
|
||||||
|
|
||||||
|
Static Semantics: ContainsArguments
|
||||||
|
IdentifierReference : Identifier
|
||||||
|
|
||||||
|
1. If the StringValue of Identifier is "arguments", return true.
|
||||||
|
...
|
||||||
|
For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false.
|
||||||
|
|
||||||
|
---*/
|
||||||
|
|
||||||
|
|
||||||
|
throw "Test262: This statement should not be evaluated.";
|
||||||
|
|
||||||
|
var C = class {
|
||||||
|
static x = arguments;
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/class-fields/init-err-contains-super.case
|
||||||
|
// - src/class-fields/initializer-error/cls-expr-fields-static-literal-name.template
|
||||||
|
/*---
|
||||||
|
description: Syntax error if `super()` used in class field (static literal ClassElementName)
|
||||||
|
esid: sec-class-definitions-static-semantics-early-errors
|
||||||
|
features: [class, class-fields-public, class-static-fields-public]
|
||||||
|
flags: [generated]
|
||||||
|
negative:
|
||||||
|
phase: parse
|
||||||
|
type: SyntaxError
|
||||||
|
info: |
|
||||||
|
Static Semantics: Early Errors
|
||||||
|
|
||||||
|
FieldDefinition:
|
||||||
|
PropertyNameInitializeropt
|
||||||
|
|
||||||
|
- It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true.
|
||||||
|
|
||||||
|
---*/
|
||||||
|
|
||||||
|
|
||||||
|
throw "Test262: This statement should not be evaluated.";
|
||||||
|
|
||||||
|
var C = class {
|
||||||
|
static x = super();
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/class-fields/init-err-contains-arguments.case
|
||||||
|
// - src/class-fields/initializer-error/cls-expr-fields-static-private-name.template
|
||||||
|
/*---
|
||||||
|
description: Syntax error if `arguments` used in class field (static PrivateName)
|
||||||
|
esid: sec-class-definitions-static-semantics-early-errors
|
||||||
|
features: [class, class-fields-public, class-static-fields-private]
|
||||||
|
flags: [generated]
|
||||||
|
negative:
|
||||||
|
phase: parse
|
||||||
|
type: SyntaxError
|
||||||
|
info: |
|
||||||
|
Static Semantics: Early Errors
|
||||||
|
|
||||||
|
FieldDefinition:
|
||||||
|
PropertyNameInitializeropt
|
||||||
|
|
||||||
|
- It is a Syntax Error if ContainsArguments of Initializer is true.
|
||||||
|
|
||||||
|
Static Semantics: ContainsArguments
|
||||||
|
IdentifierReference : Identifier
|
||||||
|
|
||||||
|
1. If the StringValue of Identifier is "arguments", return true.
|
||||||
|
...
|
||||||
|
For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false.
|
||||||
|
|
||||||
|
---*/
|
||||||
|
|
||||||
|
|
||||||
|
throw "Test262: This statement should not be evaluated.";
|
||||||
|
|
||||||
|
var C = class {
|
||||||
|
static #x = arguments;
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/class-fields/init-err-contains-super.case
|
||||||
|
// - src/class-fields/initializer-error/cls-expr-fields-static-private-name.template
|
||||||
|
/*---
|
||||||
|
description: Syntax error if `super()` used in class field (static PrivateName)
|
||||||
|
esid: sec-class-definitions-static-semantics-early-errors
|
||||||
|
features: [class, class-fields-public, class-static-fields-private]
|
||||||
|
flags: [generated]
|
||||||
|
negative:
|
||||||
|
phase: parse
|
||||||
|
type: SyntaxError
|
||||||
|
info: |
|
||||||
|
Static Semantics: Early Errors
|
||||||
|
|
||||||
|
FieldDefinition:
|
||||||
|
PropertyNameInitializeropt
|
||||||
|
|
||||||
|
- It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true.
|
||||||
|
|
||||||
|
---*/
|
||||||
|
|
||||||
|
|
||||||
|
throw "Test262: This statement should not be evaluated.";
|
||||||
|
|
||||||
|
var C = class {
|
||||||
|
static #x = super();
|
||||||
|
}
|
@ -0,0 +1,34 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/class-fields/init-err-contains-arguments.case
|
||||||
|
// - src/class-fields/initializer-error/cls-expr-fields-static-string-literal-name.template
|
||||||
|
/*---
|
||||||
|
description: Syntax error if `arguments` used in class field (static string literal ClassElementName)
|
||||||
|
esid: sec-class-definitions-static-semantics-early-errors
|
||||||
|
features: [class, class-fields-public, class-static-fields-public]
|
||||||
|
flags: [generated]
|
||||||
|
negative:
|
||||||
|
phase: parse
|
||||||
|
type: SyntaxError
|
||||||
|
info: |
|
||||||
|
Static Semantics: Early Errors
|
||||||
|
|
||||||
|
FieldDefinition:
|
||||||
|
PropertyNameInitializeropt
|
||||||
|
|
||||||
|
- It is a Syntax Error if ContainsArguments of Initializer is true.
|
||||||
|
|
||||||
|
Static Semantics: ContainsArguments
|
||||||
|
IdentifierReference : Identifier
|
||||||
|
|
||||||
|
1. If the StringValue of Identifier is "arguments", return true.
|
||||||
|
...
|
||||||
|
For all other grammatical productions, recurse on all nonterminals. If any piece returns true, then return true. Otherwise return false.
|
||||||
|
|
||||||
|
---*/
|
||||||
|
|
||||||
|
|
||||||
|
throw "Test262: This statement should not be evaluated.";
|
||||||
|
|
||||||
|
var C = class {
|
||||||
|
static 'x' = arguments;
|
||||||
|
}
|
@ -0,0 +1,27 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/class-fields/init-err-contains-super.case
|
||||||
|
// - src/class-fields/initializer-error/cls-expr-fields-static-string-literal-name.template
|
||||||
|
/*---
|
||||||
|
description: Syntax error if `super()` used in class field (static string literal ClassElementName)
|
||||||
|
esid: sec-class-definitions-static-semantics-early-errors
|
||||||
|
features: [class, class-fields-public, class-static-fields-public]
|
||||||
|
flags: [generated]
|
||||||
|
negative:
|
||||||
|
phase: parse
|
||||||
|
type: SyntaxError
|
||||||
|
info: |
|
||||||
|
Static Semantics: Early Errors
|
||||||
|
|
||||||
|
FieldDefinition:
|
||||||
|
PropertyNameInitializeropt
|
||||||
|
|
||||||
|
- It is a Syntax Error if Initializer is present and Initializer Contains SuperCall is true.
|
||||||
|
|
||||||
|
---*/
|
||||||
|
|
||||||
|
|
||||||
|
throw "Test262: This statement should not be evaluated.";
|
||||||
|
|
||||||
|
var C = class {
|
||||||
|
static 'x' = super();
|
||||||
|
}
|
@ -2,7 +2,7 @@
|
|||||||
// - src/class-fields/private-names.case
|
// - src/class-fields/private-names.case
|
||||||
// - src/class-fields/productions/cls-expr-wrapped-in-sc.template
|
// - src/class-fields/productions/cls-expr-wrapped-in-sc.template
|
||||||
/*---
|
/*---
|
||||||
description: static literal private names (fields definition wrapped in semicolons)
|
description: private names (fields definition wrapped in semicolons)
|
||||||
esid: prod-FieldDefinition
|
esid: prod-FieldDefinition
|
||||||
features: [class-fields-private, class, class-fields-public]
|
features: [class-fields-private, class, class-fields-public]
|
||||||
flags: [generated]
|
flags: [generated]
|
||||||
|
@ -0,0 +1,57 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/class-fields/static-private-fields.case
|
||||||
|
// - src/class-fields/productions/cls-expr-wrapped-in-sc.template
|
||||||
|
/*---
|
||||||
|
description: static private fields (fields definition wrapped in semicolons)
|
||||||
|
esid: prod-FieldDefinition
|
||||||
|
features: [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 #x; static #y;;;;;;;
|
||||||
|
;;;;
|
||||||
|
static x() {
|
||||||
|
this.#x = 42;
|
||||||
|
return this.#x;
|
||||||
|
}
|
||||||
|
static y() {
|
||||||
|
this.#y = 43;
|
||||||
|
return this.#y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var c = new C();
|
||||||
|
|
||||||
|
// 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");
|
@ -0,0 +1,63 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/class-fields/static-private-methods.case
|
||||||
|
// - src/class-fields/productions/cls-expr-wrapped-in-sc.template
|
||||||
|
/*---
|
||||||
|
description: static private methods (fields definition wrapped in semicolons)
|
||||||
|
esid: prod-FieldDefinition
|
||||||
|
features: [class-static-methods-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.#y = 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, "#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");
|
@ -0,0 +1,30 @@
|
|||||||
|
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-privatefieldget
|
||||||
|
description: Private fields not accessible via default Proxy handler
|
||||||
|
info: |
|
||||||
|
1. Assert: P is a Private Name value.
|
||||||
|
2. If O is not an object, throw a TypeError exception.
|
||||||
|
3. Let entry be PrivateFieldFind(P, O).
|
||||||
|
4. If entry is empty, throw a TypeError exception.
|
||||||
|
|
||||||
|
features: [class, class-fields-private]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
|
||||||
|
var C = class {
|
||||||
|
#x = 1;
|
||||||
|
x() {
|
||||||
|
return this.#x;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var c = new C();
|
||||||
|
var p = new Proxy(c, {});
|
||||||
|
|
||||||
|
assert.sameValue(c.x(), 1);
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
p.x();
|
||||||
|
});
|
@ -0,0 +1,28 @@
|
|||||||
|
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-privatefieldget
|
||||||
|
description: Static private fields not accessible via default Proxy handler
|
||||||
|
info: |
|
||||||
|
1. Assert: P is a Private Name value.
|
||||||
|
2. If O is not an object, throw a TypeError exception.
|
||||||
|
3. Let entry be PrivateFieldFind(P, O).
|
||||||
|
4. If entry is empty, throw a TypeError exception.
|
||||||
|
|
||||||
|
features: [class, class-static-fields-private]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var C = class {
|
||||||
|
static #x = 1;
|
||||||
|
static x() {
|
||||||
|
return this.#x;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var P = new Proxy(C, {});
|
||||||
|
|
||||||
|
assert.sameValue(C.x, 1);
|
||||||
|
assert.throws(TypeError, function() {
|
||||||
|
P.x;
|
||||||
|
});
|
@ -0,0 +1,31 @@
|
|||||||
|
// Copyright (C) 2018 Rick Waldron. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
esid: sec-privatefieldget
|
||||||
|
description: Static private methods not accessible via default Proxy handler
|
||||||
|
info: |
|
||||||
|
1. Assert: P is a Private Name value.
|
||||||
|
2. If O is not an object, throw a TypeError exception.
|
||||||
|
3. Let entry be PrivateFieldFind(P, O).
|
||||||
|
4. If entry is empty, throw a TypeError exception.
|
||||||
|
|
||||||
|
features: [class, class-static-methods-private]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
|
||||||
|
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();
|
||||||
|
});
|
@ -2,7 +2,7 @@
|
|||||||
// - src/class-fields/private-names.case
|
// - src/class-fields/private-names.case
|
||||||
// - src/class-fields/productions/cls-decl-after-same-line-gen.template
|
// - src/class-fields/productions/cls-decl-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
|
esid: prod-FieldDefinition
|
||||||
features: [class-fields-private, generators, class, class-fields-public]
|
features: [class-fields-private, generators, class, class-fields-public]
|
||||||
flags: [generated]
|
flags: [generated]
|
||||||
|
@ -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-decl-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
|
||||||
|
|
||||||
|
---*/
|
||||||
|
|
||||||
|
|
||||||
|
class C {
|
||||||
|
*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");
|
@ -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-decl-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
|
||||||
|
|
||||||
|
---*/
|
||||||
|
|
||||||
|
|
||||||
|
class C {
|
||||||
|
*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");
|
@ -2,7 +2,7 @@
|
|||||||
// - src/class-fields/private-names.case
|
// - src/class-fields/private-names.case
|
||||||
// - src/class-fields/productions/cls-decl-after-same-line-method.template
|
// - src/class-fields/productions/cls-decl-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
|
esid: prod-FieldDefinition
|
||||||
features: [class-fields-private, class, class-fields-public]
|
features: [class-fields-private, class, class-fields-public]
|
||||||
flags: [generated]
|
flags: [generated]
|
||||||
|
@ -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-decl-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
|
||||||
|
|
||||||
|
---*/
|
||||||
|
|
||||||
|
|
||||||
|
class C {
|
||||||
|
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");
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user