From b916c7609b324bf09088d4a7dc80d2eae44132ce Mon Sep 17 00:00:00 2001 From: Michael Dyck Date: Wed, 16 Aug 2023 15:06:23 -0700 Subject: [PATCH] Editorial: Factor out BuiltinCallOrConstruct (#2637) ... so that 10.3.2 [[Construct]] can be defined properly, instead of "the same as 10.3.1 [[Call]] except that step 10 is different". --- spec.html | 51 ++++++++++++++++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 19 deletions(-) diff --git a/spec.html b/spec.html index 4507b9e39b..a1edf49136 100644 --- a/spec.html +++ b/spec.html @@ -13744,22 +13744,8 @@

a built-in function object _F_
- 1. Let _callerContext_ be the running execution context. - 1. If _callerContext_ is not already suspended, suspend _callerContext_. - 1. Let _calleeContext_ be a new execution context. - 1. Set the Function of _calleeContext_ to _F_. - 1. Let _calleeRealm_ be _F_.[[Realm]]. - 1. Set the Realm of _calleeContext_ to _calleeRealm_. - 1. Set the ScriptOrModule of _calleeContext_ to *null*. - 1. Perform any necessary implementation-defined initialization of _calleeContext_. - 1. Push _calleeContext_ onto the execution context stack; _calleeContext_ is now the running execution context. - 1. [id="step-call-builtin-function-result"] Let _result_ be the Completion Record that is the result of evaluating _F_ in a manner that conforms to the specification of _F_. _thisArgument_ is the *this* value, _argumentsList_ provides the named parameters, and the NewTarget value is *undefined*. - 1. Remove _calleeContext_ from the execution context stack and restore _callerContext_ as the running execution context. - 1. Return ? _result_. + 1. Return ? BuiltinCallOrConstruct(_F_, _thisArgument_, _argumentsList_, *undefined*). - -

When _calleeContext_ is removed from the execution context stack it must not be destroyed if it has been suspended and retained by an accessible Generator for later resumption.

-
@@ -13772,13 +13758,40 @@

for
a built-in function object _F_ (when the method is present)
+
+ + 1. Return ? BuiltinCallOrConstruct(_F_, ~uninitialized~, _argumentsList_, _newTarget_). + + -
description
-
The steps performed are the same as [[Call]] (see ) except that step is replaced by:
+ +

+ BuiltinCallOrConstruct ( + _F_: a built-in function object, + _thisArgument_: an ECMAScript language value or ~uninitialized~, + _argumentsList_: a List of ECMAScript language values, + _newTarget_: a constructor or *undefined*, + ): either a normal completion containing an ECMAScript language value or a throw completion +

+
- - 1. Let _result_ be the Completion Record that is the result of evaluating _F_ in a manner that conforms to the specification of _F_. The *this* value is uninitialized, _argumentsList_ provides the named parameters, and _newTarget_ provides the NewTarget value. + + 1. Let _callerContext_ be the running execution context. + 1. If _callerContext_ is not already suspended, suspend _callerContext_. + 1. Let _calleeContext_ be a new execution context. + 1. Set the Function of _calleeContext_ to _F_. + 1. Let _calleeRealm_ be _F_.[[Realm]]. + 1. Set the Realm of _calleeContext_ to _calleeRealm_. + 1. Set the ScriptOrModule of _calleeContext_ to *null*. + 1. Perform any necessary implementation-defined initialization of _calleeContext_. + 1. Push _calleeContext_ onto the execution context stack; _calleeContext_ is now the running execution context. + 1. [id="step-call-builtin-function-result"] Let _result_ be the Completion Record that is the result of evaluating _F_ in a manner that conforms to the specification of _F_. If _thisArgument_ is ~uninitialized~, the *this* value is uninitialized; otherwise, _thisArgument_ provides the *this* value. _argumentsList_ provides the named parameters. _newTarget_ provides the NewTarget value. + 1. Remove _calleeContext_ from the execution context stack and restore _callerContext_ as the running execution context. + 1. Return ? _result_. + +

When _calleeContext_ is removed from the execution context stack it must not be destroyed if it has been suspended and retained by an accessible Generator for later resumption.

+