From 0213370eeb20112fa3e3557c23504a2e8cf41e6e Mon Sep 17 00:00:00 2001 From: Michael Dyck Date: Thu, 22 Jun 2023 22:44:05 -0500 Subject: [PATCH] Editorial: Fix 2 old bugs re Block-Level Function Declarations (#2951) Fixes #2540, which see for all the details. --- spec.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec.html b/spec.html index 3605cbfd0e..5c48c0a5c0 100644 --- a/spec.html +++ b/spec.html @@ -28856,7 +28856,6 @@

1. If _fnDefinable_ is *false*, throw a *TypeError* exception. 1. Append _fn_ to _declaredFunctionNames_. 1. Insert _d_ as the first element of _functionsToInitialize_. - 1. [id="step-evaldeclarationinstantiation-web-compat-insertion-point"] NOTE: Annex adds additional steps at this point. 1. Let _declaredVarNames_ be a new empty List. 1. For each element _d_ of _varDeclarations_, do 1. If _d_ is either a |VariableDeclaration|, a |ForBinding|, or a |BindingIdentifier|, then @@ -28867,6 +28866,7 @@

1. If _vnDefinable_ is *false*, throw a *TypeError* exception. 1. If _declaredVarNames_ does not contain _vn_, then 1. Append _vn_ to _declaredVarNames_. + 1. [id="step-evaldeclarationinstantiation-web-compat-insertion-point"] NOTE: Annex adds additional steps at this point. 1. [id="step-evaldeclarationinstantiation-post-validation"] NOTE: No abnormal terminations occur after this algorithm step unless _varEnv_ is a Global Environment Record and the global object is a Proxy exotic object. 1. Let _lexDeclarations_ be the LexicallyScopedDeclarations of _body_. 1. For each element _d_ of _lexDeclarations_, do @@ -49444,7 +49444,7 @@

Changes to FunctionDeclarationInstantiation

1. Let _F_ be StringValue of the |BindingIdentifier| of _f_. 1. If replacing the |FunctionDeclaration| _f_ with a |VariableStatement| that has _F_ as a |BindingIdentifier| would not produce any Early Errors for _func_ and _parameterNames_ does not contain _F_, then 1. NOTE: A var binding for _F_ is only instantiated here if it is neither a VarDeclaredName, the name of a formal parameter, or another |FunctionDeclaration|. - 1. If _initializedBindings_ does not contain _F_ and _F_ is not *"arguments"*, then + 1. If _instantiatedVarNames_ does not contain _F_ and _F_ is not *"arguments"*, then 1. Perform ! _varEnv_.CreateMutableBinding(_F_, *false*). 1. Perform ! _varEnv_.InitializeBinding(_F_, *undefined*). 1. Append _F_ to _instantiatedVarNames_.