Skip to content

Commit

Permalink
Editorial: EvaluateClassStaticBlockBody cannot throw during function …
Browse files Browse the repository at this point in the history
…instantiation (tc39#2931)

FunctionDeclarationInstantiation only throws if there is a parameter expression (computed member in destructuring, or default value) which throws. In this case the "function object" being evaluated is a synthetic value created by ClassStaticBlockDefinitionEvaluation which is used to explain how static blocks work. This synthetic value does not have any parameters, so FunctionDeclarationInstantiation on it cannot throw.
  • Loading branch information
bakkot authored and ljharb committed Feb 14, 2024
1 parent 84f6234 commit e20763a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -24816,7 +24816,7 @@ <h1>
1. Let _privateEnv_ be the running execution context's PrivateEnvironment.
1. Let _sourceText_ be the empty sequence of Unicode code points.
1. Let _formalParameters_ be an instance of the production <emu-grammar>FormalParameters : [empty]</emu-grammar>.
1. Let _bodyFunction_ be OrdinaryFunctionCreate(%Function.prototype%, _sourceText_, _formalParameters_, |ClassStaticBlockBody|, ~non-lexical-this~, _lex_, _privateEnv_).
1. [id="step-synthetic-class-static-block-fn"] Let _bodyFunction_ be OrdinaryFunctionCreate(%Function.prototype%, _sourceText_, _formalParameters_, |ClassStaticBlockBody|, ~non-lexical-this~, _lex_, _privateEnv_).
1. Perform MakeMethod(_bodyFunction_, _homeObject_).
1. Return the ClassStaticBlockDefinition Record { [[BodyFunction]]: _bodyFunction_ }.
</emu-alg>
Expand All @@ -24833,7 +24833,8 @@ <h1>
</dl>
<emu-grammar>ClassStaticBlockBody : ClassStaticBlockStatementList</emu-grammar>
<emu-alg>
1. Perform ? FunctionDeclarationInstantiation(_functionObject_, « »).
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|.
</emu-alg>
</emu-clause>
Expand Down

0 comments on commit e20763a

Please sign in to comment.