Skip to content

Commit d0e079e

Browse files
authored
Editorial: fix SetFunctionName assertion (tc39#88)
1 parent 28fa66d commit d0e079e

File tree

1 file changed

+49
-1
lines changed

1 file changed

+49
-1
lines changed

spec.html

+49-1
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,54 @@ <h1>
155155
</emu-clause>
156156
</emu-clause>
157157

158+
<emu-clause id="sec-ordinary-and-exotic-objects-behaviours">
159+
<h1>Ordinary and Exotic Objects Behaviours</h1>
160+
161+
<emu-clause id="sec-built-in-function-objects">
162+
<h1>Built-in Function Objects</h1>
163+
164+
<emu-clause id="sec-createbuiltinfunction" type="abstract operation">
165+
<h1>
166+
CreateBuiltinFunction (
167+
_behaviour_: an Abstract Closure, a set of algorithm steps, or some other definition of a function's behaviour provided in this specification,
168+
optional _length_: a non-negative integer or +&infin;,
169+
optional _name_: a property key or a Private Name,
170+
optional _additionalInternalSlotsList_: a List of names of internal slots,
171+
optional _realm_: a Realm Record,
172+
optional _prototype_: an Object or *null*,
173+
optional _prefix_: a String,
174+
): a function object
175+
</h1>
176+
<dl class="header">
177+
<dt>description</dt>
178+
<dd>_additionalInternalSlotsList_ contains the names of additional internal slots that must be defined as part of the object. This operation creates a built-in function object.</dd>
179+
</dl>
180+
<emu-alg>
181+
1. <ins>If _additionalInternalSlotsList_ is not present, set _additionalInternalSlotsList_ to a new empty List.</ins>
182+
1. If _realm_ is not present, set _realm_ to the current Realm Record.
183+
1. If _prototype_ is not present, set _prototype_ to _realm_.[[Intrinsics]].[[%Function.prototype%]].
184+
1. Let _internalSlotsList_ be a List containing the names of all the internal slots that <emu-xref href="#sec-built-in-function-objects"></emu-xref> requires for the built-in function object that is about to be created.
185+
1. Append to _internalSlotsList_ the elements of _additionalInternalSlotsList_.
186+
1. Let _func_ be a new built-in function object that, when called, performs the action described by _behaviour_ using the provided arguments as the values of the corresponding parameters specified by _behaviour_. The new function object has internal slots whose names are the elements of _internalSlotsList_, and an [[InitialName]] internal slot.
187+
1. Set _func_.[[Prototype]] to _prototype_.
188+
1. Set _func_.[[Extensible]] to *true*.
189+
1. Set _func_.[[Realm]] to _realm_.
190+
1. Set _func_.[[InitialName]] to *null*.
191+
1. <ins>If _length_ is present, then</ins>
192+
1. Perform SetFunctionLength(_func_, _length_).
193+
1. <ins>If _name_ is present, then</ins>
194+
1. If _prefix_ is not present, then
195+
1. Perform SetFunctionName(_func_, _name_).
196+
1. Else,
197+
1. Perform SetFunctionName(_func_, _name_, _prefix_).
198+
1. Return _func_.
199+
</emu-alg>
200+
<p>Each built-in function defined in this specification is created by calling the CreateBuiltinFunction abstract operation.</p>
201+
</emu-clause>
202+
</emu-clause>
203+
</emu-clause>
204+
</emu-clause>
205+
158206
<emu-clause id="sec-ecmascript-language-functions-and-classes">
159207
<h1>ECMAScript Language: Functions and Classes</h1>
160208

@@ -1002,7 +1050,7 @@ <h1>AsyncContext.Snapshot.wrap ( _fn_ )</h1>
10021050
1. Let _result_ be Completion(Call(_fn_, _thisArgument_, _args_)).
10031051
1. AsyncContextSwap(_previousContextMapping_).
10041052
1. Return _result_.
1005-
1. Let _wrapped_ be CreateBuiltinFunction(_closure_, *+0*<sub>𝔽</sub>, *""*, &laquo; &raquo;).
1053+
1. Let _wrapped_ be CreateBuiltinFunction(_closure_).
10061054
1. Perform ? CopyNameAndLength(_wrapped_, _fn_, *"wrapped"*).
10071055
1. Return _wrapped_.
10081056
</emu-alg>

0 commit comments

Comments
 (0)