Skip to content

Commit 4d591cb

Browse files
just describe some built-in function objects as async
1 parent 11f4faf commit 4d591cb

File tree

1 file changed

+21
-42
lines changed

1 file changed

+21
-42
lines changed

spec.html

Lines changed: 21 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -2975,7 +2975,7 @@ <h1>Object Internal Methods and Internal Slots</h1>
29752975
For the internal methods listed in <emu-xref href="#table-essential-internal-methods"></emu-xref>, the object uses those defined in <emu-xref href="#sec-ordinary-object-internal-methods-and-internal-slots"></emu-xref>.
29762976
</li>
29772977
<li>
2978-
If the object has a [[Call]] internal method, it uses the one defined in <emu-xref href="#sec-ecmascript-function-objects-call-thisargument-argumentslist"></emu-xref>, the one defined in <emu-xref href="#sec-built-in-function-objects-call-thisargument-argumentslist"></emu-xref>, or the one defined in <emu-xref href="#sec-built-in-async-function-objects-call"></emu-xref>.
2978+
If the object has a [[Call]] internal method, it uses either the one defined in <emu-xref href="#sec-ecmascript-function-objects-call-thisargument-argumentslist"></emu-xref> or the one defined in <emu-xref href="#sec-built-in-function-objects-call-thisargument-argumentslist"></emu-xref>.
29792979
</li>
29802980
<li>
29812981
If the object has a [[Construct]] internal method, it uses either the one defined in <emu-xref href="#sec-ecmascript-function-objects-construct-argumentslist-newtarget"></emu-xref> or the one defined in <emu-xref href="#sec-built-in-function-objects-construct-argumentslist-newtarget"></emu-xref>.
@@ -13858,7 +13858,7 @@ <h1>Built-in Function Objects</h1>
1385813858
<li>[[InitialName]], a String that is the initial name of the function. It is used by <emu-xref href="#sec-function.prototype.tostring"></emu-xref>.</li>
1385913859
</ul>
1386013860
<p>The initial value of a built-in function object's [[Prototype]] internal slot is %Function.prototype%, unless otherwise specified.</p>
13861-
<p>A built-in function object must have a [[Call]] internal method that conforms to either the definition in <emu-xref href="#sec-built-in-function-objects-call-thisargument-argumentslist"></emu-xref> or the definition in <emu-xref href="#sec-built-in-async-function-objects-call"></emu-xref>.</p>
13861+
<p>A built-in function object must have a [[Call]] internal method that conforms to the definition in <emu-xref href="#sec-built-in-function-objects-call-thisargument-argumentslist"></emu-xref>.</p>
1386213862
<p>A built-in function object has a [[Construct]] internal method if and only if it is described as a “constructor”, or some algorithm in this specification explicitly sets its [[Construct]] internal method. Such a [[Construct]] internal method must conform to the definition in <emu-xref href="#sec-built-in-function-objects-construct-argumentslist-newtarget"></emu-xref>.</p>
1386313863
<p>An implementation may provide additional built-in function objects that are not defined in this specification.</p>
1386413864

@@ -13874,7 +13874,24 @@ <h1>
1387413874
<dd>a built-in function object _F_</dd>
1387513875
</dl>
1387613876
<emu-alg>
13877-
1. Return ? BuiltinCallOrConstruct(_F_, _thisArgument_, _argumentsList_, *undefined*).
13877+
1. If _F_ is described as “async”, then
13878+
1. Let _callerContext_ be the running execution context.
13879+
1. If _callerContext_ is not already suspended, suspend _callerContext_.
13880+
1. Let _calleeContext_ be a new execution context.
13881+
1. Set the Function of _calleeContext_ to _F_.
13882+
1. Let _calleeRealm_ be _F_.[[Realm]].
13883+
1. Set the Realm of _calleeContext_ to _calleeRealm_.
13884+
1. Set the ScriptOrModule of _calleeContext_ to *null*.
13885+
1. Perform any necessary implementation-defined initialization of _calleeContext_.
13886+
1. Push _calleeContext_ onto the execution context stack; _calleeContext_ is now the running execution context.
13887+
1. Let _promiseCapability_ be ! NewPromiseCapability(%Promise%).
13888+
1. Let _resultsClosure_ be a new Abstract Closure with no parameters that captures _F_, _thisArgument_, and _argumentsList_ and performs the following steps when called:
13889+
1. Return the Completion Record that is <emu-meta effects="user-code">the result of evaluating</emu-meta> _F_ in a manner that conforms to the specification of _F_. _thisArgument_ provides the *this* value, _argumentsList_ provides the named parameters, and the NewTarget value is *undefined*.
13890+
1. Perform AsyncFunctionStart(_promiseCapability_, _resultsClosure_).
13891+
1. Remove _calleeContext_ from the execution context stack and restore _callerContext_ as the running execution context.
13892+
1. Return _promiseCapability_.[[Promise]].
13893+
1. Else,
13894+
1. Return ? BuiltinCallOrConstruct(_F_, _thisArgument_, _argumentsList_, *undefined*).
1387813895
</emu-alg>
1387913896
</emu-clause>
1388013897

@@ -13948,10 +13965,7 @@ <h1>
1394813965
1. If _prototype_ is not present, set _prototype_ to _realm_.[[Intrinsics]].[[%Function.prototype%]].
1394913966
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.
1395013967
1. Append to _internalSlotsList_ the elements of _additionalInternalSlotsList_.
13951-
1. If _behaviour_ is described as async, then
13952-
1. Let _func_ be a new built-in async 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.
13953-
1. Else,
13954-
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.
13968+
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.
1395513969
1. Set _func_.[[Prototype]] to _prototype_.
1395613970
1. Set _func_.[[Extensible]] to *true*.
1395713971
1. Set _func_.[[Realm]] to _realm_.
@@ -13967,41 +13981,6 @@ <h1>
1396713981
</emu-clause>
1396813982
</emu-clause>
1396913983

13970-
<emu-clause id="sec-built-in-async-function-objects">
13971-
<h1>Built-in Async Function Objects</h1>
13972-
<p><dfn variants="built-in async function object,built-in async function objects">Built-in async function objects</dfn> are built-in function objects that provide a [[Call]] internal method that conforms to the following definition:</p>
13973-
13974-
<emu-clause id="sec-built-in-async-function-objects-call" type="internal method">
13975-
<h1>
13976-
[[Call]] (
13977-
_thisArgument_: an ECMAScript language value,
13978-
_argumentsList_: a List of ECMAScript language values,
13979-
): a normal completion containing a Promise
13980-
</h1>
13981-
<dl class="header">
13982-
<dt>for</dt>
13983-
<dd>a built-in async function object _F_</dd>
13984-
</dl>
13985-
<emu-alg>
13986-
1. Let _callerContext_ be the running execution context.
13987-
1. If _callerContext_ is not already suspended, suspend _callerContext_.
13988-
1. Let _calleeContext_ be a new execution context.
13989-
1. Set the Function of _calleeContext_ to _F_.
13990-
1. Let _calleeRealm_ be _F_.[[Realm]].
13991-
1. Set the Realm of _calleeContext_ to _calleeRealm_.
13992-
1. Set the ScriptOrModule of _calleeContext_ to *null*.
13993-
1. Perform any necessary implementation-defined initialization of _calleeContext_.
13994-
1. Push _calleeContext_ onto the execution context stack; _calleeContext_ is now the running execution context.
13995-
1. Let _promiseCapability_ be ! NewPromiseCapability(%Promise%).
13996-
1. Let _resultsClosure_ be a new Abstract Closure with no parameters that captures _F_, _thisArgument_, and _argumentsList_ and performs the following steps when called:
13997-
1. Return the Completion Record that is <emu-meta effects="user-code">the result of evaluating</emu-meta> _F_ in a manner that conforms to the specification of _F_. _thisArgument_ provides the *this* value, _argumentsList_ provides the named parameters, and the NewTarget value is *undefined*.
13998-
1. Perform AsyncFunctionStart(_promiseCapability_, _resultsClosure_).
13999-
1. Remove _calleeContext_ from the execution context stack and restore _callerContext_ as the running execution context.
14000-
1. Return _promiseCapability_.[[Promise]].
14001-
</emu-alg>
14002-
</emu-clause>
14003-
</emu-clause>
14004-
1400513984
<emu-clause id="sec-built-in-exotic-object-internal-methods-and-slots">
1400613985
<h1>Built-in Exotic Object Internal Methods and Slots</h1>
1400713986
<p>This specification defines several kinds of built-in exotic objects. These objects generally behave similar to ordinary objects except for a few specific situations. The following exotic objects use the ordinary object internal methods except where it is explicitly specified otherwise below:</p>

0 commit comments

Comments
 (0)