Class Fields: minor updates to existing templates to improve output source

This commit is contained in:
Rick Waldron 2018-08-01 11:22:55 -04:00 committed by Leo Balter
parent ba97c2a5ce
commit 0298174c06
42 changed files with 93 additions and 88 deletions

View File

@ -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
---*/

View File

@ -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

View File

@ -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.

View File

@ -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
---*/

View File

@ -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
---*/

View File

@ -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

View File

@ -12,7 +12,7 @@ includes: [propertyHelper.js]
class C {
async *m() { return 42; } /*{ fields }*/;
/*{ privateinspectionfunctions }*/
/*{ privateinspectionfunctions }*/
}
var c = new C();

View File

@ -12,7 +12,7 @@ includes: [propertyHelper.js]
class C {
async m() { return 42; } /*{ fields }*/;
/*{ privateinspectionfunctions }*/
/*{ privateinspectionfunctions }*/
}
var c = new C();

View File

@ -11,7 +11,7 @@ includes: [propertyHelper.js]
class C {
*m() { return 42; } /*{ fields }*/;
/*{ privateinspectionfunctions }*/
/*{ privateinspectionfunctions }*/
}
var c = new C();

View File

@ -11,7 +11,7 @@ includes: [propertyHelper.js]
class C {
m() { return 42; } /*{ fields }*/;
/*{ privateinspectionfunctions }*/
/*{ privateinspectionfunctions }*/
}
var c = new C();

View File

@ -12,7 +12,7 @@ includes: [propertyHelper.js]
class C {
static async *m() { return 42; } /*{ fields }*/;
/*{ privateinspectionfunctions }*/
/*{ privateinspectionfunctions }*/
}
var c = new C();

View File

@ -12,7 +12,7 @@ includes: [propertyHelper.js]
class C {
static async m() { return 42; } /*{ fields }*/;
/*{ privateinspectionfunctions }*/
/*{ privateinspectionfunctions }*/
}
var c = new C();

View File

@ -11,7 +11,7 @@ includes: [propertyHelper.js]
class C {
static *m() { return 42; } /*{ fields }*/;
/*{ privateinspectionfunctions }*/
/*{ privateinspectionfunctions }*/
}
var c = new C();

View File

@ -11,7 +11,7 @@ includes: [propertyHelper.js]
class C {
static m() { return 42; } /*{ fields }*/;
/*{ privateinspectionfunctions }*/
/*{ privateinspectionfunctions }*/
}
var c = new C();

View File

@ -15,7 +15,7 @@ class C {
/*{ fields }*/
m2() { return 39 }
bar = "barbaz";
/*{ privateinspectionfunctions }*/
/*{ privateinspectionfunctions }*/
}
var c = new C();

View File

@ -13,7 +13,7 @@ class C {
/*{ fields }*/
foo = "foobar"
bar = "barbaz";
/*{ privateinspectionfunctions }*/
/*{ privateinspectionfunctions }*/
}
var c = new C();

View File

@ -12,7 +12,7 @@ includes: [propertyHelper.js]
class C {
/*{ fields }*/
m() { return 42; }
/*{ privateinspectionfunctions }*/
/*{ privateinspectionfunctions }*/
}
var c = new C();

View File

@ -12,7 +12,7 @@ includes: [propertyHelper.js]
class C {
/*{ fields }*/;
*m() { return 42; }
/*{ privateinspectionfunctions }*/
/*{ privateinspectionfunctions }*/
}
var c = new C();

View File

@ -12,7 +12,7 @@ includes: [propertyHelper.js]
class C {
/*{ fields }*/;
m() { return 42; }
/*{ privateinspectionfunctions }*/
/*{ privateinspectionfunctions }*/
}
var c = new C();

View File

@ -10,7 +10,7 @@ esid: prod-FieldDefinition
class C {
/*{ fields }*/
/*{ privateinspectionfunctions }*/
/*{ privateinspectionfunctions }*/
}
var c = new C();

View File

@ -11,7 +11,7 @@ includes: [propertyHelper.js]
class C {
/*{ fields }*/; *m() { return 42; }
/*{ privateinspectionfunctions }*/
/*{ privateinspectionfunctions }*/
}
var c = new C();

View File

@ -11,7 +11,7 @@ includes: [propertyHelper.js]
class C {
/*{ fields }*/; m() { return 42; }
/*{ privateinspectionfunctions }*/
/*{ privateinspectionfunctions }*/
}
var c = new C();

View File

@ -12,7 +12,7 @@ class C {
;;;;
;;;;;;/*{ fields }*/;;;;;;;
;;;;
/*{ privateinspectionfunctions }*/
/*{ privateinspectionfunctions }*/
}
var c = new C();

View File

@ -12,7 +12,7 @@ includes: [propertyHelper.js]
var C = class {
async *m() { return 42; } /*{ fields }*/;
/*{ privateinspectionfunctions }*/
/*{ privateinspectionfunctions }*/
}
var c = new C();

View File

@ -12,7 +12,7 @@ includes: [propertyHelper.js]
var C = class {
async m() { return 42; } /*{ fields }*/;
/*{ privateinspectionfunctions }*/
/*{ privateinspectionfunctions }*/
}
var c = new C();

View File

@ -11,7 +11,7 @@ includes: [propertyHelper.js]
var C = class {
*m() { return 42; } /*{ fields }*/;
/*{ privateinspectionfunctions }*/
/*{ privateinspectionfunctions }*/
}
var c = new C();

View File

@ -11,7 +11,7 @@ includes: [propertyHelper.js]
var C = class {
m() { return 42; } /*{ fields }*/;
/*{ privateinspectionfunctions }*/
/*{ privateinspectionfunctions }*/
}
var c = new C();

View File

@ -12,7 +12,7 @@ includes: [propertyHelper.js]
var C = class {
static async *m() { return 42; } /*{ fields }*/;
/*{ privateinspectionfunctions }*/
/*{ privateinspectionfunctions }*/
}
var c = new C();

View File

@ -12,7 +12,7 @@ includes: [propertyHelper.js]
var C = class {
static async m() { return 42; } /*{ fields }*/;
/*{ privateinspectionfunctions }*/
/*{ privateinspectionfunctions }*/
}
var c = new C();

View File

@ -11,7 +11,7 @@ includes: [propertyHelper.js]
var C = class {
static *m() { return 42; } /*{ fields }*/;
/*{ privateinspectionfunctions }*/
/*{ privateinspectionfunctions }*/
}
var c = new C();

View File

@ -11,7 +11,7 @@ includes: [propertyHelper.js]
var C = class {
static m() { return 42; } /*{ fields }*/;
/*{ privateinspectionfunctions }*/
/*{ privateinspectionfunctions }*/
}
var c = new C();

View File

@ -15,7 +15,7 @@ var C = class {
/*{ fields }*/
m2() { return 39 }
bar = "barbaz";
/*{ privateinspectionfunctions }*/
/*{ privateinspectionfunctions }*/
}
var c = new C();

View File

@ -13,7 +13,7 @@ var C = class {
/*{ fields }*/
foo = "foobar"
bar = "barbaz";
/*{ privateinspectionfunctions }*/
/*{ privateinspectionfunctions }*/
}
var c = new C();

View File

@ -12,7 +12,7 @@ includes: [propertyHelper.js]
var C = class {
/*{ fields }*/
m() { return 42; }
/*{ privateinspectionfunctions }*/
/*{ privateinspectionfunctions }*/
}
var c = new C();

View File

@ -12,7 +12,7 @@ includes: [propertyHelper.js]
var C = class {
/*{ fields }*/;
*m() { return 42; }
/*{ privateinspectionfunctions }*/
/*{ privateinspectionfunctions }*/
}
var c = new C();

View File

@ -12,7 +12,7 @@ includes: [propertyHelper.js]
var C = class {
/*{ fields }*/;
m() { return 42; }
/*{ privateinspectionfunctions }*/
/*{ privateinspectionfunctions }*/
}
var c = new C();

View File

@ -10,7 +10,7 @@ esid: prod-FieldDefinition
var C = class {
/*{ fields }*/
/*{ privateinspectionfunctions }*/
/*{ privateinspectionfunctions }*/
}
var c = new C();

View File

@ -11,7 +11,7 @@ includes: [propertyHelper.js]
var C = class {
/*{ fields }*/; *m() { return 42; }
/*{ privateinspectionfunctions }*/
/*{ privateinspectionfunctions }*/
}
var c = new C();

View File

@ -11,7 +11,7 @@ includes: [propertyHelper.js]
var C = class {
/*{ fields }*/; m() { return 42; }
/*{ privateinspectionfunctions }*/
/*{ privateinspectionfunctions }*/
}
var c = new C();

View File

@ -12,7 +12,7 @@ var C = class {
;;;;
;;;;;;/*{ fields }*/;;;;;;;
;;;;
/*{ privateinspectionfunctions }*/
/*{ privateinspectionfunctions }*/
}
var c = new C();

View File

@ -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

View File

@ -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