Skip to content

Commit

Permalink
Editorial: make EvaluateBody return return/throw completion (#2924)
Browse files Browse the repository at this point in the history
  • Loading branch information
bakkot authored and ljharb committed Nov 21, 2024
1 parent d309ec4 commit a44ea31
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -13407,8 +13407,8 @@ <h1>
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_.
</emu-alg>
<emu-note>
<p>When _calleeContext_ is removed from the execution context stack in step <emu-xref href="#step-call-pop-context-stack"></emu-xref> it must not be destroyed if it is suspended and retained for later resumption by an accessible Generator.</p>
Expand Down Expand Up @@ -13478,7 +13478,7 @@ <h1>
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
</h1>
<dl class="header">
</dl>
Expand Down Expand Up @@ -13543,7 +13543,7 @@ <h1>
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
</h1>
<dl class="header">
</dl>
Expand Down Expand Up @@ -13580,12 +13580,12 @@ <h1>
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_.
Expand Down Expand Up @@ -23571,14 +23571,16 @@ <h1>
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
</h1>
<dl class="header">
</dl>
<emu-grammar>FunctionBody : FunctionStatementList</emu-grammar>
<emu-alg>
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*).
</emu-alg>
</emu-clause>

Expand Down Expand Up @@ -23754,7 +23756,7 @@ <h1>
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
</h1>
<dl class="header">
</dl>
Expand Down Expand Up @@ -24960,15 +24962,16 @@ <h1>
<h1>
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
</h1>
<dl class="header">
</dl>
<emu-grammar>ClassStaticBlockBody : ClassStaticBlockStatementList</emu-grammar>
<emu-alg>
1. Assert: _functionObject_ is a synthetic function created by ClassStaticBlockDefinitionEvaluation step <emu-xref href="#step-synthetic-class-static-block-fn"></emu-xref>.
1. Perform ! FunctionDeclarationInstantiation(_functionObject_, « »).
1. Return ? Evaluation of |ClassStaticBlockStatementList|.
1. Perform ? Evaluation of |ClassStaticBlockStatementList|.
1. Return ReturnCompletion(*undefined*).
</emu-alg>
</emu-clause>

Expand Down

0 comments on commit a44ea31

Please sign in to comment.