From a44ea31343e962b1c22f69c8a8f851aafa7e3ccf Mon Sep 17 00:00:00 2001 From: Kevin Gibbons Date: Thu, 21 Nov 2024 08:04:30 -1000 Subject: [PATCH] Editorial: make EvaluateBody return return/throw completion (#2924) --- spec.html | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/spec.html b/spec.html index cedec14104..01a536baa4 100644 --- a/spec.html +++ b/spec.html @@ -13407,8 +13407,8 @@

1. Let _result_ be Completion(OrdinaryCallEvaluateBody(_F_, _argumentsList_)). 1. [id="step-call-pop-context-stack"] Remove _calleeContext_ from the execution context stack and restore _callerContext_ as the running execution context. 1. If _result_ is a return completion, return _result_.[[Value]]. - 1. ReturnIfAbrupt(_result_). - 1. Return *undefined*. + 1. Assert: _result_ is a throw completion. + 1. Return ? _result_.

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

@@ -13478,7 +13478,7 @@

Runtime Semantics: EvaluateBody ( _functionObject_: an ECMAScript function object, _argumentsList_: a List of ECMAScript language values, - ): either a normal completion containing either an ECMAScript language value or ~empty~, or an abrupt completion + ): a return completion or a throw completion

@@ -13543,7 +13543,7 @@

OrdinaryCallEvaluateBody ( _F_: an ECMAScript function object, _argumentsList_: a List of ECMAScript language values, - ): either a normal completion containing either an ECMAScript language value or ~empty~, or an abrupt completion + ): a return completion or a throw completion

@@ -13580,12 +13580,12 @@

1. Let _constructorEnv_ be the LexicalEnvironment of _calleeContext_. 1. Let _result_ be Completion(OrdinaryCallEvaluateBody(_F_, _argumentsList_)). 1. Remove _calleeContext_ from the execution context stack and restore _callerContext_ as the running execution context. - 1. If _result_ is a return completion, then - 1. If _result_.[[Value]] is an Object, return _result_.[[Value]]. - 1. If _kind_ is ~base~, return _thisArgument_. - 1. If _result_.[[Value]] is not *undefined*, throw a *TypeError* exception. - 1. Else, - 1. ReturnIfAbrupt(_result_). + 1. If _result_ is a throw completion, then + 1. Return ? _result_. + 1. Assert: _result_ is a return completion. + 1. If _result_.[[Value]] is an Object, return _result_.[[Value]]. + 1. If _kind_ is ~base~, return _thisArgument_. + 1. If _result_.[[Value]] is not *undefined*, throw a *TypeError* exception. 1. Let _thisBinding_ be ? _constructorEnv_.GetThisBinding(). 1. Assert: _thisBinding_ is an Object. 1. Return _thisBinding_. @@ -23571,14 +23571,16 @@

Runtime Semantics: EvaluateFunctionBody ( _functionObject_: an ECMAScript function object, _argumentsList_: a List of ECMAScript language values, - ): either a normal completion containing either an ECMAScript language value or ~empty~, or an abrupt completion + ): a return completion or a throw completion

FunctionBody : FunctionStatementList 1. Perform ? FunctionDeclarationInstantiation(_functionObject_, _argumentsList_). - 1. Return ? Evaluation of |FunctionStatementList|. + 1. Perform ? Evaluation of |FunctionStatementList|. + 1. NOTE: If the previous step resulted in a normal completion, then evaluation finished by proceeding past the end of the |FunctionStatementList|. + 1. Return ReturnCompletion(*undefined*). @@ -23754,7 +23756,7 @@

Runtime Semantics: EvaluateConciseBody ( _functionObject_: an ECMAScript function object, _argumentsList_: a List of ECMAScript language values, - ): either a normal completion containing an ECMAScript language value or an abrupt completion + ): a return completion or a throw completion

@@ -24960,7 +24962,7 @@

Runtime Semantics: EvaluateClassStaticBlockBody ( _functionObject_: an ECMAScript function object, - ): either a normal completion containing either an ECMAScript language value or ~empty~, or an abrupt completion + ): a return completion or a throw completion

@@ -24968,7 +24970,8 @@

1. Assert: _functionObject_ is a synthetic function created by ClassStaticBlockDefinitionEvaluation step . 1. Perform ! FunctionDeclarationInstantiation(_functionObject_, « »). - 1. Return ? Evaluation of |ClassStaticBlockStatementList|. + 1. Perform ? Evaluation of |ClassStaticBlockStatementList|. + 1. Return ReturnCompletion(*undefined*).