Skip to content
Snippets Groups Projects
Commit 0298174c authored by Rick Waldron's avatar Rick Waldron Committed by Leo Balter
Browse files

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

parent ba97c2a5
No related branches found
No related tags found
No related merge requests found
Showing
with 37 additions and 33 deletions
...@@ -13,9 +13,10 @@ info: | ...@@ -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
---*/ ---*/
......
...@@ -13,16 +13,16 @@ info: | ...@@ -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
......
...@@ -6,7 +6,7 @@ desc: error if `super().x` in StatementList of eval ...@@ -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.
......
...@@ -13,9 +13,10 @@ info: | ...@@ -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
---*/ ---*/
......
...@@ -13,9 +13,10 @@ info: | ...@@ -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
---*/ ---*/
......
...@@ -2,20 +2,21 @@ ...@@ -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] ...@@ -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
......
...@@ -12,7 +12,7 @@ includes: [propertyHelper.js] ...@@ -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();
......
...@@ -12,7 +12,7 @@ includes: [propertyHelper.js] ...@@ -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();
......
...@@ -11,7 +11,7 @@ includes: [propertyHelper.js] ...@@ -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();
......
...@@ -11,7 +11,7 @@ includes: [propertyHelper.js] ...@@ -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();
......
...@@ -12,7 +12,7 @@ includes: [propertyHelper.js] ...@@ -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();
......
...@@ -12,7 +12,7 @@ includes: [propertyHelper.js] ...@@ -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();
......
...@@ -11,7 +11,7 @@ includes: [propertyHelper.js] ...@@ -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();
......
...@@ -11,7 +11,7 @@ includes: [propertyHelper.js] ...@@ -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();
......
...@@ -15,7 +15,7 @@ class C { ...@@ -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();
......
...@@ -13,7 +13,7 @@ class C { ...@@ -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();
......
...@@ -12,7 +12,7 @@ includes: [propertyHelper.js] ...@@ -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();
......
...@@ -12,7 +12,7 @@ includes: [propertyHelper.js] ...@@ -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();
......
...@@ -12,7 +12,7 @@ includes: [propertyHelper.js] ...@@ -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();
......
...@@ -10,7 +10,7 @@ esid: prod-FieldDefinition ...@@ -10,7 +10,7 @@ esid: prod-FieldDefinition
class C { class C {
/*{ fields }*/ /*{ fields }*/
/*{ privateinspectionfunctions }*/ /*{ privateinspectionfunctions }*/
} }
var c = new C(); var c = new C();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment