mirror of https://github.com/tc39/test262.git
Class Fields: minor updates to existing templates to improve output source
This commit is contained in:
parent
ba97c2a5ce
commit
0298174c06
|
@ -13,9 +13,10 @@ info: |
|
|||
|
||||
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
|
||||
ScriptBody : StatementList
|
||||
|
||||
It is a Syntax Error if StatementList Contains NewTarget.
|
||||
|
||||
features: [class, new.target]
|
||||
template: initializer-eval-newtarget
|
||||
---*/
|
||||
|
|
|
@ -13,16 +13,16 @@ info: |
|
|||
|
||||
Additional Early Error Rules for Eval Outside Constructor Methods
|
||||
These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression.
|
||||
ScriptBody:StatementList
|
||||
ScriptBody : StatementList
|
||||
|
||||
It is a Syntax Error if StatementList Contains SuperCall.
|
||||
|
||||
features: [class, class-fields-public]
|
||||
template: initializer-eval-super-call
|
||||
---*/
|
||||
|
||||
//- initializer
|
||||
super()['x']
|
||||
|
||||
//- earlyerror
|
||||
SyntaxError
|
||||
//- executionerror
|
||||
|
|
|
@ -6,7 +6,7 @@ desc: error if `super().x` in StatementList of eval
|
|||
info: |
|
||||
Additional Early Error Rules for Eval Outside Constructor Methods
|
||||
These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression.
|
||||
ScriptBody:StatementList
|
||||
ScriptBody : StatementList
|
||||
|
||||
It is a Syntax Error if StatementList Contains SuperCall.
|
||||
|
||||
|
|
|
@ -13,9 +13,10 @@ info: |
|
|||
|
||||
Additional Early Error Rules for Eval Outside Constructor Methods
|
||||
These static semantics are applied by PerformEval when a direct eval call occurs outside of the constructor method of a ClassDeclaration or ClassExpression.
|
||||
ScriptBody:StatementList
|
||||
ScriptBody : StatementList
|
||||
|
||||
It is a Syntax Error if StatementList Contains SuperCall.
|
||||
|
||||
features: [class, class-fields-public]
|
||||
template: initializer-eval-super-call
|
||||
---*/
|
||||
|
|
|
@ -13,9 +13,10 @@ info: |
|
|||
|
||||
Additional Early Error Rules for Eval Outside Methods
|
||||
These static semantics are applied by PerformEval when a direct eval call occurs outside of a MethodDefinition.
|
||||
ScriptBody:StatementList
|
||||
ScriptBody : StatementList
|
||||
|
||||
It is a Syntax Error if StatementList Contains SuperProperty.
|
||||
|
||||
features: [class, class-fields-public]
|
||||
template: initializer-eval-super-property
|
||||
---*/
|
||||
|
|
|
@ -2,20 +2,21 @@
|
|||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
desc: static literal private names
|
||||
desc: private names
|
||||
info: |
|
||||
ClassElement:
|
||||
ClassElement :
|
||||
...
|
||||
FieldDefinition ;
|
||||
|
||||
FieldDefinition:
|
||||
FieldDefinition :
|
||||
ClassElementName Initializer_opt
|
||||
|
||||
ClassElementName:
|
||||
ClassElementName :
|
||||
PrivateName
|
||||
|
||||
PrivateName:
|
||||
PrivateName :
|
||||
# IdentifierName
|
||||
|
||||
template: productions
|
||||
features: [class-fields-private]
|
||||
---*/
|
||||
|
@ -23,14 +24,14 @@ features: [class-fields-private]
|
|||
//- fields
|
||||
#x; #y
|
||||
//- privateinspectionfunctions
|
||||
x() {
|
||||
this.#x = 42;
|
||||
return this.#x;
|
||||
}
|
||||
y() {
|
||||
this.#y = 43;
|
||||
return this.#y;
|
||||
}
|
||||
x() {
|
||||
this.#x = 42;
|
||||
return this.#x;
|
||||
}
|
||||
y() {
|
||||
this.#y = 43;
|
||||
return this.#y;
|
||||
}
|
||||
//- assertions
|
||||
|
||||
// Test the private fields do not appear as properties before set to value
|
||||
|
|
|
@ -12,7 +12,7 @@ includes: [propertyHelper.js]
|
|||
|
||||
class C {
|
||||
async *m() { return 42; } /*{ fields }*/;
|
||||
/*{ privateinspectionfunctions }*/
|
||||
/*{ privateinspectionfunctions }*/
|
||||
}
|
||||
|
||||
var c = new C();
|
||||
|
|
|
@ -12,7 +12,7 @@ includes: [propertyHelper.js]
|
|||
|
||||
class C {
|
||||
async m() { return 42; } /*{ fields }*/;
|
||||
/*{ privateinspectionfunctions }*/
|
||||
/*{ privateinspectionfunctions }*/
|
||||
}
|
||||
|
||||
var c = new C();
|
||||
|
|
|
@ -11,7 +11,7 @@ includes: [propertyHelper.js]
|
|||
|
||||
class C {
|
||||
*m() { return 42; } /*{ fields }*/;
|
||||
/*{ privateinspectionfunctions }*/
|
||||
/*{ privateinspectionfunctions }*/
|
||||
}
|
||||
|
||||
var c = new C();
|
||||
|
|
|
@ -11,7 +11,7 @@ includes: [propertyHelper.js]
|
|||
|
||||
class C {
|
||||
m() { return 42; } /*{ fields }*/;
|
||||
/*{ privateinspectionfunctions }*/
|
||||
/*{ privateinspectionfunctions }*/
|
||||
}
|
||||
|
||||
var c = new C();
|
||||
|
|
|
@ -12,7 +12,7 @@ includes: [propertyHelper.js]
|
|||
|
||||
class C {
|
||||
static async *m() { return 42; } /*{ fields }*/;
|
||||
/*{ privateinspectionfunctions }*/
|
||||
/*{ privateinspectionfunctions }*/
|
||||
}
|
||||
|
||||
var c = new C();
|
||||
|
|
|
@ -12,7 +12,7 @@ includes: [propertyHelper.js]
|
|||
|
||||
class C {
|
||||
static async m() { return 42; } /*{ fields }*/;
|
||||
/*{ privateinspectionfunctions }*/
|
||||
/*{ privateinspectionfunctions }*/
|
||||
}
|
||||
|
||||
var c = new C();
|
||||
|
|
|
@ -11,7 +11,7 @@ includes: [propertyHelper.js]
|
|||
|
||||
class C {
|
||||
static *m() { return 42; } /*{ fields }*/;
|
||||
/*{ privateinspectionfunctions }*/
|
||||
/*{ privateinspectionfunctions }*/
|
||||
}
|
||||
|
||||
var c = new C();
|
||||
|
|
|
@ -11,7 +11,7 @@ includes: [propertyHelper.js]
|
|||
|
||||
class C {
|
||||
static m() { return 42; } /*{ fields }*/;
|
||||
/*{ privateinspectionfunctions }*/
|
||||
/*{ privateinspectionfunctions }*/
|
||||
}
|
||||
|
||||
var c = new C();
|
||||
|
|
|
@ -15,7 +15,7 @@ class C {
|
|||
/*{ fields }*/
|
||||
m2() { return 39 }
|
||||
bar = "barbaz";
|
||||
/*{ privateinspectionfunctions }*/
|
||||
/*{ privateinspectionfunctions }*/
|
||||
}
|
||||
|
||||
var c = new C();
|
||||
|
|
|
@ -13,7 +13,7 @@ class C {
|
|||
/*{ fields }*/
|
||||
foo = "foobar"
|
||||
bar = "barbaz";
|
||||
/*{ privateinspectionfunctions }*/
|
||||
/*{ privateinspectionfunctions }*/
|
||||
}
|
||||
|
||||
var c = new C();
|
||||
|
|
|
@ -12,7 +12,7 @@ includes: [propertyHelper.js]
|
|||
class C {
|
||||
/*{ fields }*/
|
||||
m() { return 42; }
|
||||
/*{ privateinspectionfunctions }*/
|
||||
/*{ privateinspectionfunctions }*/
|
||||
}
|
||||
|
||||
var c = new C();
|
||||
|
|
|
@ -12,7 +12,7 @@ includes: [propertyHelper.js]
|
|||
class C {
|
||||
/*{ fields }*/;
|
||||
*m() { return 42; }
|
||||
/*{ privateinspectionfunctions }*/
|
||||
/*{ privateinspectionfunctions }*/
|
||||
}
|
||||
|
||||
var c = new C();
|
||||
|
|
|
@ -12,7 +12,7 @@ includes: [propertyHelper.js]
|
|||
class C {
|
||||
/*{ fields }*/;
|
||||
m() { return 42; }
|
||||
/*{ privateinspectionfunctions }*/
|
||||
/*{ privateinspectionfunctions }*/
|
||||
}
|
||||
|
||||
var c = new C();
|
||||
|
|
|
@ -10,7 +10,7 @@ esid: prod-FieldDefinition
|
|||
|
||||
class C {
|
||||
/*{ fields }*/
|
||||
/*{ privateinspectionfunctions }*/
|
||||
/*{ privateinspectionfunctions }*/
|
||||
}
|
||||
|
||||
var c = new C();
|
||||
|
|
|
@ -11,7 +11,7 @@ includes: [propertyHelper.js]
|
|||
|
||||
class C {
|
||||
/*{ fields }*/; *m() { return 42; }
|
||||
/*{ privateinspectionfunctions }*/
|
||||
/*{ privateinspectionfunctions }*/
|
||||
}
|
||||
|
||||
var c = new C();
|
||||
|
|
|
@ -11,7 +11,7 @@ includes: [propertyHelper.js]
|
|||
|
||||
class C {
|
||||
/*{ fields }*/; m() { return 42; }
|
||||
/*{ privateinspectionfunctions }*/
|
||||
/*{ privateinspectionfunctions }*/
|
||||
}
|
||||
|
||||
var c = new C();
|
||||
|
|
|
@ -12,7 +12,7 @@ class C {
|
|||
;;;;
|
||||
;;;;;;/*{ fields }*/;;;;;;;
|
||||
;;;;
|
||||
/*{ privateinspectionfunctions }*/
|
||||
/*{ privateinspectionfunctions }*/
|
||||
}
|
||||
|
||||
var c = new C();
|
||||
|
|
|
@ -12,7 +12,7 @@ includes: [propertyHelper.js]
|
|||
|
||||
var C = class {
|
||||
async *m() { return 42; } /*{ fields }*/;
|
||||
/*{ privateinspectionfunctions }*/
|
||||
/*{ privateinspectionfunctions }*/
|
||||
}
|
||||
|
||||
var c = new C();
|
||||
|
|
|
@ -12,7 +12,7 @@ includes: [propertyHelper.js]
|
|||
|
||||
var C = class {
|
||||
async m() { return 42; } /*{ fields }*/;
|
||||
/*{ privateinspectionfunctions }*/
|
||||
/*{ privateinspectionfunctions }*/
|
||||
}
|
||||
|
||||
var c = new C();
|
||||
|
|
|
@ -11,7 +11,7 @@ includes: [propertyHelper.js]
|
|||
|
||||
var C = class {
|
||||
*m() { return 42; } /*{ fields }*/;
|
||||
/*{ privateinspectionfunctions }*/
|
||||
/*{ privateinspectionfunctions }*/
|
||||
}
|
||||
|
||||
var c = new C();
|
||||
|
|
|
@ -11,7 +11,7 @@ includes: [propertyHelper.js]
|
|||
|
||||
var C = class {
|
||||
m() { return 42; } /*{ fields }*/;
|
||||
/*{ privateinspectionfunctions }*/
|
||||
/*{ privateinspectionfunctions }*/
|
||||
}
|
||||
|
||||
var c = new C();
|
||||
|
|
|
@ -12,7 +12,7 @@ includes: [propertyHelper.js]
|
|||
|
||||
var C = class {
|
||||
static async *m() { return 42; } /*{ fields }*/;
|
||||
/*{ privateinspectionfunctions }*/
|
||||
/*{ privateinspectionfunctions }*/
|
||||
}
|
||||
|
||||
var c = new C();
|
||||
|
|
|
@ -12,7 +12,7 @@ includes: [propertyHelper.js]
|
|||
|
||||
var C = class {
|
||||
static async m() { return 42; } /*{ fields }*/;
|
||||
/*{ privateinspectionfunctions }*/
|
||||
/*{ privateinspectionfunctions }*/
|
||||
}
|
||||
|
||||
var c = new C();
|
||||
|
|
|
@ -11,7 +11,7 @@ includes: [propertyHelper.js]
|
|||
|
||||
var C = class {
|
||||
static *m() { return 42; } /*{ fields }*/;
|
||||
/*{ privateinspectionfunctions }*/
|
||||
/*{ privateinspectionfunctions }*/
|
||||
}
|
||||
|
||||
var c = new C();
|
||||
|
|
|
@ -11,7 +11,7 @@ includes: [propertyHelper.js]
|
|||
|
||||
var C = class {
|
||||
static m() { return 42; } /*{ fields }*/;
|
||||
/*{ privateinspectionfunctions }*/
|
||||
/*{ privateinspectionfunctions }*/
|
||||
}
|
||||
|
||||
var c = new C();
|
||||
|
|
|
@ -15,7 +15,7 @@ var C = class {
|
|||
/*{ fields }*/
|
||||
m2() { return 39 }
|
||||
bar = "barbaz";
|
||||
/*{ privateinspectionfunctions }*/
|
||||
/*{ privateinspectionfunctions }*/
|
||||
}
|
||||
|
||||
var c = new C();
|
||||
|
|
|
@ -13,7 +13,7 @@ var C = class {
|
|||
/*{ fields }*/
|
||||
foo = "foobar"
|
||||
bar = "barbaz";
|
||||
/*{ privateinspectionfunctions }*/
|
||||
/*{ privateinspectionfunctions }*/
|
||||
}
|
||||
|
||||
var c = new C();
|
||||
|
|
|
@ -12,7 +12,7 @@ includes: [propertyHelper.js]
|
|||
var C = class {
|
||||
/*{ fields }*/
|
||||
m() { return 42; }
|
||||
/*{ privateinspectionfunctions }*/
|
||||
/*{ privateinspectionfunctions }*/
|
||||
}
|
||||
|
||||
var c = new C();
|
||||
|
|
|
@ -12,7 +12,7 @@ includes: [propertyHelper.js]
|
|||
var C = class {
|
||||
/*{ fields }*/;
|
||||
*m() { return 42; }
|
||||
/*{ privateinspectionfunctions }*/
|
||||
/*{ privateinspectionfunctions }*/
|
||||
}
|
||||
|
||||
var c = new C();
|
||||
|
|
|
@ -12,7 +12,7 @@ includes: [propertyHelper.js]
|
|||
var C = class {
|
||||
/*{ fields }*/;
|
||||
m() { return 42; }
|
||||
/*{ privateinspectionfunctions }*/
|
||||
/*{ privateinspectionfunctions }*/
|
||||
}
|
||||
|
||||
var c = new C();
|
||||
|
|
|
@ -10,7 +10,7 @@ esid: prod-FieldDefinition
|
|||
|
||||
var C = class {
|
||||
/*{ fields }*/
|
||||
/*{ privateinspectionfunctions }*/
|
||||
/*{ privateinspectionfunctions }*/
|
||||
}
|
||||
|
||||
var c = new C();
|
||||
|
|
|
@ -11,7 +11,7 @@ includes: [propertyHelper.js]
|
|||
|
||||
var C = class {
|
||||
/*{ fields }*/; *m() { return 42; }
|
||||
/*{ privateinspectionfunctions }*/
|
||||
/*{ privateinspectionfunctions }*/
|
||||
}
|
||||
|
||||
var c = new C();
|
||||
|
|
|
@ -11,7 +11,7 @@ includes: [propertyHelper.js]
|
|||
|
||||
var C = class {
|
||||
/*{ fields }*/; m() { return 42; }
|
||||
/*{ privateinspectionfunctions }*/
|
||||
/*{ privateinspectionfunctions }*/
|
||||
}
|
||||
|
||||
var c = new C();
|
||||
|
|
|
@ -12,7 +12,7 @@ var C = class {
|
|||
;;;;
|
||||
;;;;;;/*{ fields }*/;;;;;;;
|
||||
;;;;
|
||||
/*{ privateinspectionfunctions }*/
|
||||
/*{ privateinspectionfunctions }*/
|
||||
}
|
||||
|
||||
var c = new C();
|
||||
|
|
|
@ -2,34 +2,36 @@
|
|||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
desc: literal private names
|
||||
desc: static private fields
|
||||
info: |
|
||||
ClassElement:
|
||||
ClassElement :
|
||||
...
|
||||
static FieldDefinition ;
|
||||
|
||||
FieldDefinition:
|
||||
FieldDefinition :
|
||||
ClassElementName Initializer_opt
|
||||
|
||||
ClassElementName:
|
||||
ClassElementName :
|
||||
PrivateName
|
||||
|
||||
PrivateName:
|
||||
PrivateName :
|
||||
# IdentifierName
|
||||
template: default
|
||||
|
||||
template: productions
|
||||
features: [class-static-fields-private]
|
||||
---*/
|
||||
|
||||
//- fields
|
||||
static #x; static #y
|
||||
//- privateinspectionfunctions
|
||||
static x() {
|
||||
this.#x = 42;
|
||||
return this.#x;
|
||||
}
|
||||
static y() {
|
||||
this.#y = 43;
|
||||
return this.#y;
|
||||
}
|
||||
static x() {
|
||||
this.#x = 42;
|
||||
return this.#x;
|
||||
}
|
||||
static y() {
|
||||
this.#y = 43;
|
||||
return this.#y;
|
||||
}
|
||||
//- assertions
|
||||
|
||||
// Test the private fields do not appear as properties before set to value
|
||||
|
|
|
@ -2,43 +2,42 @@
|
|||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
desc: literal private names
|
||||
desc: static private methods
|
||||
info: |
|
||||
ClassElement:
|
||||
ClassElement :
|
||||
...
|
||||
static FieldDefinition ;
|
||||
|
||||
FieldDefinition:
|
||||
FieldDefinition :
|
||||
ClassElementName Initializer_opt
|
||||
|
||||
ClassElementName:
|
||||
ClassElementName :
|
||||
PrivateName
|
||||
|
||||
PrivateName:
|
||||
PrivateName :
|
||||
# IdentifierName
|
||||
|
||||
template: default
|
||||
template: productions
|
||||
features: [class-static-methods-private]
|
||||
---*/
|
||||
|
||||
//- fields
|
||||
static #xVal; static #yVal
|
||||
//- privateinspectionfunctions
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
//- assertions
|
||||
|
||||
// Test the private methods do not appear as properties before set to value
|
||||
|
|
Loading…
Reference in New Issue