@@ -23,6 +23,7 @@ <h1>Syntax</h1>
23
23
` static` MethodDefinition [? Yield , ? Await ]
24
24
FieldDefinition [? Yield , ? Await ] ` ;`
25
25
<ins> ` static` FieldDefinition [? Yield , ? Await ] ` ;` </ins>
26
+ <ins> ` <placeholder>` Declaration [? Yield , ? Await ]</ins>
26
27
` ;`
27
28
</emu-grammar >
28
29
@@ -41,19 +42,30 @@ <h1>Static Semantics: Early Errors</h1>
41
42
<emu-clause id =sec-algorithms >
42
43
<h1 >Algorithms</h1 >
43
44
45
+ <emu-clause id =" runtime-semantics-class-element-evaluation" >
44
46
<h1 >Runtime Semantics: ClassElementEvaluation</h1 >
45
47
<p >With parameters _object_ and _enumerable_ .</p >
46
48
47
49
<emu-grammar ><ins>ClassElement : `static` FieldDefinition `;`</ins></emu-grammar >
48
50
<emu-alg >
49
- < ins > 1. Return ClassFieldDefinitionEvaluation of | FieldDefinition | with parameter *true* and _object_ .</ins >
51
+ 1. < ins > Return ClassFieldDefinitionEvaluation of | FieldDefinition | with parameter *true* and _object_ .</ins >
50
52
</emu-alg >
51
53
52
54
<emu-grammar >ClassElement : FieldDefinition ` ;` </emu-grammar >
53
55
<emu-alg >
54
56
1. Return ClassFieldDefinitionEvaluation of | FieldDefinition | with parameter <ins >*false* and</ins > _object_ .
55
57
</emu-alg >
56
58
59
+ <emu-grammar ><ins>ClassElement : `<placeholder>` Declaration</ins></emu-grammar >
60
+ <ins class =" block" ><emu-alg >
61
+ 1. Return a List containing Record {
62
+ [[Declaration]]: | Declaration |
63
+ [[Static]]: *true* ,
64
+ [[IsAnonymousFunctionDefinition]]: *false*
65
+ }.
66
+ </emu-alg ></ins >
67
+ </emu-clause >
68
+
57
69
<emu-clause id =" runtime-semantics-class-field-definition-evaluation" >
58
70
<h1 >Runtime Semantics: ClassFieldDefinitionEvaluation</h1 >
59
71
@@ -92,7 +104,11 @@ <h1>InitializeStaticFields(_F_)</h1>
92
104
1. Let _fieldRecords_ be the value of _F_ 's [[Fields]] internal slot.
93
105
1. For each item _fieldRecord_ in order from _fieldRecords_ ,
94
106
1. If _fieldRecord_ .[[Static]] is *true* , then
95
- 1. Perform ? DefineField(_F_ , _fieldRecord_ ).
107
+ 1. <ins >If _fieldRecord_ has a [[Declaration]] field,</ins >
108
+ 1. <ins >Let _ret_ be the result of evaluating _fieldRecord_ .[[Declaration]].</ins >
109
+ 1. <ins >ReturnIfAbrupt(_ret_ ).</ins >
110
+ 1. <ins >Else,</ins >
111
+ 1. Perform ? DefineField(_F_ , _fieldRecord_ ).
96
112
1. Return.
97
113
</emu-alg >
98
114
</emu-clause >
@@ -119,6 +135,37 @@ <h1>Static Semantics: IsStatic</h1>
119
135
</emu-alg >
120
136
</emu-clause >
121
137
138
+ <emu-clause id =" sec-block-static-semantics-lexicallyscopeddeclarations" >
139
+ <h1 >Static Semantics: LexicallyScopedDeclarations</h1 >
140
+ <emu-see-also-para op =" LexicallyScopedDeclarations" ></emu-see-also-para >
141
+ <emu-grammar >ClassBody : ClassElementList </emu-grammar >
142
+ <emu-alg >
143
+ 1. Return the LexicallyScopedDeclarations of | ClassElementList | .
144
+ </emu-alg >
145
+ <emu-grammar >ClassElementList : ClassElementList ClassElement </emu-grammar >
146
+ <emu-alg >
147
+ 1. Let _declarations_ be LexicallyScopedDeclarations of | ClassElementList | .
148
+ 1. Append to _declarations_ the elements of the LexicallyScopedDeclarations of | ClassElement | .
149
+ 1. Return _declarations_ .
150
+ </emu-alg >
151
+ <emu-grammar >ClassElementList : ClassElement </emu-grammar >
152
+ <emu-alg >
153
+ 1. Return the LexicallyScopedDeclarations of | ClassElement | .
154
+ </emu-alg >
155
+ <emu-grammar >ClassElement : MethodDefinition </emu-grammar >
156
+ <emu-grammar >ClassElement : ` static` MethodDefinition </emu-grammar >
157
+ <emu-grammar >FieldDefinition[?Yield, ?Await] `;`</emu-grammar >
158
+ <emu-grammar >`static` FieldDefinition[?Yield, ?Await] `;`</emu-grammar >
159
+ <emu-grammar >ClassElement : ` ;` </emu-grammar >
160
+ <emu-alg >
161
+ 1. Return a new empty List.
162
+ </emu-alg >
163
+ <emu-grammar >ClassElement : ` <placeholder>` Declaration </emu-grammar >
164
+ <emu-alg >
165
+ 1. Return a new List containing DeclarationPart of | Declaration | .
166
+ </emu-alg >
167
+ </emu-clause >
168
+
122
169
<emu-clause id =" runtime-semantics-class-definition-evaluation" >
123
170
<h1 >Runtime Semantics: ClassDefinitionEvaluation</h1 >
124
171
<p >With parameter _className_ .</p >
@@ -135,6 +182,7 @@ <h1>Runtime Semantics: ClassDefinitionEvaluation</h1>
135
182
1. If | ClassBody _opt | is present, then
136
183
1. For each element _dn_ of the PrivateBoundNames of | ClassBody _opt | ,
137
184
1. Perform _classPrivateEnvRec_ .CreateImmutableBinding(_dn_ , *true* ).
185
+ 1. <ins >Perform ! BlockDeclarationInstantiation(| ClassBody | , _classScopeEnvRec_ ).</ins >
138
186
1. If | ClassHeritage _opt | is not present, then
139
187
1. Let _protoParent_ be the intrinsic object %ObjectPrototype%.
140
188
1. Let _constructorParent_ be the intrinsic object %FunctionPrototype%.
@@ -186,17 +234,17 @@ <h1>Runtime Semantics: ClassDefinitionEvaluation</h1>
186
234
1. Set the running execution context's PrivateNameEnvironment to _outerPrivateEnvironment_ .
187
235
1. Return Completion(_status_ ).
188
236
1. Append to _fieldRecords_ the elements of _fields_ .
189
- 1. Set the running execution context's LexicalEnvironment to _lex_ .
190
237
1. If _className_ is not *undefined* , then
191
238
1. Perform _classScopeEnvRec_ .InitializeBinding(_className_ , _F_ ).
239
+ 1. <del >Set the running execution context's LexicalEnvironment to _lex_ .</del >
192
240
1. Set the value of _F_ 's [[Fields]] internal slot to _fieldRecords_ .
193
- 1. Set the running execution context's LexicalEnvironment to _classScope_ .
194
- 1. Set the running execution context's PrivateNameEnvironment to _outerPrivateEnvironment_ .
195
241
1. <ins >Let _result_ be InitializeStaticFields(_F_ ).</ins >
196
242
1. <ins >If _result_ is an abrupt completion, then</ins >
197
243
1. <ins >Set the running execution context's LexicalEnvironment to _lex_ .</ins >
244
+ 1. <ins >Set the running execution context's PrivateNameEnvironment to _outerPrivateEnvironment_ .</ins >
198
245
1. <ins >Return Completion(_result_ ).</ins >
199
- 1. Set the running execution context's LexicalEnvironment to _lex_ .
246
+ 1. <ins >Set the running execution context's LexicalEnvironment to _lex_ .</ins >
247
+ 1. Set the running execution context's PrivateNameEnvironment to _outerPrivateEnvironment_ .
200
248
1. Return _F_ .
201
249
</emu-alg >
202
250
</emu-clause >
0 commit comments