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 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. 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. It is a Syntax Error if StatementList Contains NewTarget.
features: [class, new.target] features: [class, new.target]
template: initializer-eval-newtarget template: initializer-eval-newtarget
---*/ ---*/

View File

@ -13,16 +13,16 @@ info: |
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
It is a Syntax Error if StatementList Contains SuperCall. It is a Syntax Error if StatementList Contains SuperCall.
features: [class, class-fields-public] features: [class, class-fields-public]
template: initializer-eval-super-call template: initializer-eval-super-call
---*/ ---*/
//- initializer //- initializer
super()['x'] super()['x']
//- earlyerror //- earlyerror
SyntaxError SyntaxError
//- executionerror //- executionerror

View File

@ -6,7 +6,7 @@ desc: error if `super().x` in StatementList of eval
info: | info: |
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
It is a Syntax Error if StatementList Contains SuperCall. 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 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
It is a Syntax Error if StatementList Contains SuperCall. It is a Syntax Error if StatementList Contains SuperCall.
features: [class, class-fields-public] features: [class, class-fields-public]
template: initializer-eval-super-call template: initializer-eval-super-call
---*/ ---*/

View File

@ -13,9 +13,10 @@ info: |
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.
features: [class, class-fields-public] features: [class, class-fields-public]
template: initializer-eval-super-property template: initializer-eval-super-property
---*/ ---*/

View File

@ -2,20 +2,21 @@
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
desc: static literal private names desc: private names
info: | info: |
ClassElement: ClassElement :
... ...
FieldDefinition ; FieldDefinition ;
FieldDefinition: FieldDefinition :
ClassElementName Initializer_opt ClassElementName Initializer_opt
ClassElementName: ClassElementName :
PrivateName PrivateName
PrivateName: PrivateName :
# IdentifierName # IdentifierName
template: productions template: productions
features: [class-fields-private] features: [class-fields-private]
---*/ ---*/
@ -23,14 +24,14 @@ features: [class-fields-private]
//- fields //- fields
#x; #y #x; #y
//- privateinspectionfunctions //- privateinspectionfunctions
x() { x() {
this.#x = 42; this.#x = 42;
return this.#x; return this.#x;
} }
y() { y() {
this.#y = 43; this.#y = 43;
return this.#y; return this.#y;
} }
//- assertions //- assertions
// 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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,34 +2,36 @@
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
desc: literal private names desc: static private fields
info: | info: |
ClassElement: ClassElement :
... ...
static FieldDefinition ; static FieldDefinition ;
FieldDefinition: FieldDefinition :
ClassElementName Initializer_opt ClassElementName Initializer_opt
ClassElementName: ClassElementName :
PrivateName PrivateName
PrivateName: PrivateName :
# IdentifierName # IdentifierName
template: default
template: productions
features: [class-static-fields-private]
---*/ ---*/
//- fields //- fields
static #x; static #y static #x; static #y
//- privateinspectionfunctions //- privateinspectionfunctions
static x() { static x() {
this.#x = 42; this.#x = 42;
return this.#x; return this.#x;
} }
static y() { static y() {
this.#y = 43; this.#y = 43;
return this.#y; return this.#y;
} }
//- assertions //- assertions
// 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

View File

@ -2,43 +2,42 @@
// This code is governed by the BSD license found in the LICENSE file. // This code is governed by the BSD license found in the LICENSE file.
/*--- /*---
desc: literal private names desc: static private methods
info: | info: |
ClassElement: ClassElement :
... ...
static FieldDefinition ; static FieldDefinition ;
FieldDefinition: FieldDefinition :
ClassElementName Initializer_opt ClassElementName Initializer_opt
ClassElementName: ClassElementName :
PrivateName PrivateName
PrivateName: PrivateName :
# IdentifierName # IdentifierName
template: default template: productions
features: [class-static-methods-private] features: [class-static-methods-private]
---*/ ---*/
//- fields //- fields
static #xVal; static #yVal static #xVal; static #yVal
//- privateinspectionfunctions //- privateinspectionfunctions
static #x(value) { static #x(value) {
this.#xVal = value; this.#xVal = value;
return this.#xVal; return this.#xVal;
} }
static #y(value) { static #y(value) {
this.#y = value; this.#y = value;
return this.#yVal; return this.#yVal;
} }
static x() { static x() {
return this.#x(42); return this.#x(42);
} }
static y() { static y() {
return this.#y(43); return this.#y(43);
} }
//- assertions //- assertions
// Test the private methods do not appear as properties before set to value // Test the private methods do not appear as properties before set to value