You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 25, 2022. It is now read-only.
Copy file name to clipboardExpand all lines: spec.html
+68-51
Original file line number
Diff line number
Diff line change
@@ -11,8 +11,7 @@
11
11
<emu-introid=sec-intro>
12
12
<h1>Introduction</h1>
13
13
<p>This document specifies parts of the class features proposals which were split off in the November 2017 TC39 meeting from <ahref="https://github.com/tc39/proposal-class-fields">class fields</a> and <ahref="https://github.com/tc39/proposal-private-methods">private methods</a> proposals, for further consideration and advancement. In that meeting, static public fields, static private fields and static private methods were split off from the earlier "Stage 3" proposal and demoted to "Stage 2".</p>
14
-
<p>This proposal defines static public fields, static private fields, and static private methods. Compared to past proposals, the semantics of private static methods have changed to allow the receiver of a private static method to be a subclass. For further context and motivation, see <ahref="https://github.com/tc39/proposal-static-class-features">the explainer document</a>.</p>
15
-
<p>This specification is phrased as a diff against the combination of the private methods and class fields proposals.</p>
14
+
<p>This proposal defines only static public fields. Static private fields and static private methods are omitted, with rationale documented <ahref="https://github.com/tc39/proposal-static-class-features/issues/1">in this bug</a>. This specification text maintains the previously proposed semantics that each static public field is created just once, on the class it is defined, and not additional times for each subclass, as motivated <ahref="https://github.com/tc39/proposal-static-class-features/issues/2">in this bug</a>. For further context and motivation, see <ahref="https://github.com/tc39/proposal-static-class-features">the explainer document</a> for this proposal.</p>
1. If |ClassBody_opt| is not present, let _elements_ be a new empty List.
165
-
1. Else, let _definitions_ be NonConstructorElementDefinitions of |ClassBody|. NOTE: Simply renaming this internal algorithm will be enough; it includes fields.
166
-
1. Let _elements_ be a new empty List.
167
-
1. For each |ClassElement|_d_ in order from _definitions_,
168
-
1. Let _newElements_ be the result of performing ClassElementEvaluation for _d_ with arguments _F_, *false*, and ~empty~.
169
-
1. If _newElements_ is an abrupt completion, then
176
+
1. If |ClassBody_opt| is not present, let _methods_ be a new empty List.
177
+
1. Else, let _elements_ be NonConstructorMethodDefinitions of |ClassBody|.
178
+
1. Let _fieldRecords_ be a new empty List.
179
+
1. For each |ClassElement|_e_ in order from _elements_
180
+
1. If IsStatic of _e_ is *false*, then
181
+
1. Let _fields_ be the result of performing ClassElementEvaluation for _e_ with arguments _proto_ and *false*.
182
+
1. Else,
183
+
1. Let _fields_ be the result of performing ClassElementEvaluation for _e_ with arguments _F_ and *false*.
184
+
1. If _fields_ is an abrupt completion, then
170
185
1. Set the running execution context's LexicalEnvironment to _lex_.
171
186
1. Set the running execution context's PrivateNameEnvironment to _outerPrivateEnvironment_.
172
187
1. Return Completion(_status_).
173
-
1. Append _newElements_ to _elements_
174
-
1. Let _elements_ be CoalescePrivateAccessors(_elements_).
188
+
1. Append to _fieldRecords_ the elements of _fields_.
175
189
1. Set the running execution context's LexicalEnvironment to _lex_.
176
-
1. Set the running execution context's PrivateNameEnvironment to _outerPrivateEnvironment_.
0 commit comments