You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1. NOTE: A var with the same name as a formal parameter initially has the same value as the corresponding initialized parameter.
13786
-
1. [id="step-functiondeclarationinstantiation-web-compat-insertion-point", normative-optional] If the host is a web browser or otherwise supports <emu-xref href="#sec-block-level-function-declarations-web-legacy-compatibility-semantics" title></emu-xref> and _strict_ is *false*, then
13787
-
1. For each |FunctionDeclaration| _f_ that is directly contained in the |StatementList| of any |Block|, |CaseClause|, or |DefaultClause| _x_ such that _code_ Contains _x_ is *true*, do
13788
-
1. Let _F_ be the StringValue of the |BindingIdentifier| of _f_.
13789
-
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
13790
-
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|.
13791
-
1. If _instantiatedVarNames_ does not contain _F_ and _F_ is not *"arguments"*, then
1. [id="step-functiondeclarationinstantiation-alt-funcdecl-eval"] When the |FunctionDeclaration| _f_ is evaluated, perform the following steps in place of the |FunctionDeclaration| Evaluation algorithm provided in <emu-xref href="#sec-function-definitions-runtime-semantics-evaluation"></emu-xref>:
13796
-
1. Let _fEnv_ be the running execution context's VariableEnvironment.
13797
-
1. Let _bEnv_ be the running execution context's LexicalEnvironment.
13798
-
1. Let _fObj_ be ! _bEnv_.GetBindingValue(_F_, *false*).
1. [id="step-functiondeclarationinstantiation-web-compat-insertion-point", normative-optional] If the host is a web browser or otherwise supports <emu-xref href="#sec-block-level-function-declarations-web-legacy-compatibility-semantics" title></emu-xref>, then
13790
+
1. For each |FunctionDeclaration| _f_ that is directly contained in the |StatementList| of any |Block|, |CaseClause|, or |DefaultClause| _x_ such that _code_ Contains _x_ is *true*, do
13791
+
1. Let _F_ be the StringValue of the |BindingIdentifier| of _f_.
13792
+
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
13793
+
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|.
13794
+
1. If _instantiatedVarNames_ does not contain _F_ and _F_ is not *"arguments"*, then
1. [id="step-functiondeclarationinstantiation-alt-funcdecl-eval"] When the |FunctionDeclaration| _f_ is evaluated, perform the following steps in place of the |FunctionDeclaration| Evaluation algorithm provided in <emu-xref href="#sec-function-definitions-runtime-semantics-evaluation"></emu-xref>:
13799
+
1. Let _fEnv_ be the running execution context's VariableEnvironment.
13800
+
1. Let _bEnv_ be the running execution context's LexicalEnvironment.
13801
+
1. Let _fObj_ be ! _bEnv_.GetBindingValue(_F_, *false*).
1. Let _lexEnv_ be NewDeclarativeEnvironment(_varEnv_).
13803
13805
1. NOTE: Non-strict functions use a separate Environment Record for top-level lexical declarations so that a direct eval can determine whether any var scoped declarations introduced by the eval code conflict with pre-existing top-level lexically scoped declarations. This is not needed for strict functions because a strict direct eval always places all declarations into a new Environment Record.
13804
-
1. Else,
13805
-
1. Let _lexEnv_ be _varEnv_.
13806
13806
1. Set the LexicalEnvironment of _calleeContext_ to _lexEnv_.
13807
13807
1. Let _lexDeclarations_ be the LexicallyScopedDeclarations of _code_.
13808
13808
1. For each element _d_ of _lexDeclarations_, do
@@ -21185,7 +21185,7 @@ <h1>Static Semantics: Early Errors</h1>
It is a Syntax Error if the LexicallyDeclaredNames of |StatementList| contains any duplicate entries<span normative-optional>, unless the host is a web browser or otherwise supports <emu-xref href="#sec-block-level-function-declarations-web-legacy-compatibility-semantics" title></emu-xref>, IsStrict(this production) is *false*, and the duplicate entries are only bound by FunctionDeclarations</span>.
21188
+
It is a Syntax Error if the LexicallyDeclaredNames of |StatementList| contains any duplicate entries<span normative-optional>, unless IsStrict(this production) is *false*, the duplicate entries are only bound by FunctionDeclarations, and the host is a web browser or otherwise supports <emu-xref href="#sec-block-level-function-declarations-web-legacy-compatibility-semantics" title></emu-xref></span>.
21189
21189
</li>
21190
21190
<li>
21191
21191
It is a Syntax Error if any element of the LexicallyDeclaredNames of |StatementList| also occurs in the VarDeclaredNames of |StatementList|.
@@ -22653,7 +22653,7 @@ <h1>Static Semantics: Early Errors</h1>
It is a Syntax Error if the LexicallyDeclaredNames of |CaseBlock| contains any duplicate entries<span normative-optional>, unless the host is a web browser or otherwise supports <emu-xref href="#sec-block-level-function-declarations-web-legacy-compatibility-semantics" title></emu-xref>, IsStrict(this production) is *false*, and the duplicate entries are only bound by FunctionDeclarations</span>.
22656
+
It is a Syntax Error if the LexicallyDeclaredNames of |CaseBlock| contains any duplicate entries<span normative-optional>, unless IsStrict(this production) is *false*, the duplicate entries are only bound by FunctionDeclarations, and the host is a web browser or otherwise supports <emu-xref href="#sec-block-level-function-declarations-web-legacy-compatibility-semantics" title></emu-xref></span>.
22657
22657
</li>
22658
22658
<li>
22659
22659
It is a Syntax Error if any element of the LexicallyDeclaredNames of |CaseBlock| also occurs in the VarDeclaredNames of |CaseBlock|.
@@ -22806,7 +22806,7 @@ <h1>Static Semantics: Early Errors</h1>
It is a Syntax Error if any source text is matched by this production<span normative-optional>, unless the host is a web browser or otherwise supports <emu-xref href="#sec-labelled-function-declarations" title></emu-xref> and that source text is non-strict code</span>.
22809
+
It is a Syntax Error if any source text is matched by this production<span normative-optional>, unless that source text is non-strict code and the host is a web browser or otherwise supports <emu-xref href="#sec-labelled-function-declarations" title></emu-xref></span>.
22810
22810
</li>
22811
22811
</ul>
22812
22812
</emu-clause>
@@ -22956,7 +22956,7 @@ <h1>Static Semantics: Early Errors</h1>
22956
22956
It is a Syntax Error if any element of the BoundNames of |CatchParameter| also occurs in the LexicallyDeclaredNames of |Block|.
22957
22957
</li>
22958
22958
<li>
22959
-
It is a Syntax Error if any element of the BoundNames of |CatchParameter| also occurs in the VarDeclaredNames of |Block|<span normative-optional>, unless the host is a web browser or otherwise supports <emu-xref href="#sec-variablestatements-in-catch-blocks" title></emu-xref> and |CatchParameter| is <emu-grammar>CatchParameter : BindingIdentifier</emu-grammar></span>.
22959
+
It is a Syntax Error if any element of the BoundNames of |CatchParameter| also occurs in the VarDeclaredNames of |Block|<span normative-optional>, unless |CatchParameter| is <emu-grammar>CatchParameter : BindingIdentifier</emu-grammar> and the host is a web browser or otherwise supports <emu-xref href="#sec-variablestatements-in-catch-blocks" title></emu-xref></span>.
22960
22960
</li>
22961
22961
</ul>
22962
22962
</emu-clause>
@@ -29191,7 +29191,7 @@ <h1>
29191
29191
1. If _vnDefinable_ is *false*, throw a *TypeError* exception.
29192
29192
1. If _declaredVarNames_ does not contain _vn_, then
29193
29193
1. Append _vn_ to _declaredVarNames_.
29194
-
1. [id="step-evaldeclarationinstantiation-web-compat-insertion-point", normative-optional] If the host is a web browser or otherwise supports <emu-xref href="#sec-block-level-function-declarations-web-legacy-compatibility-semantics" title></emu-xref> and _strict_ is *false*, then
29194
+
1. [id="step-evaldeclarationinstantiation-web-compat-insertion-point", normative-optional] If _strict_ is *false* and the host is a web browser or otherwise supports <emu-xref href="#sec-block-level-function-declarations-web-legacy-compatibility-semantics" title></emu-xref>, then
29195
29195
1. Let _declaredFunctionOrVarNames_ be the list-concatenation of _declaredFunctionNames_ and _declaredVarNames_.
29196
29196
1. For each |FunctionDeclaration| _f_ that is directly contained in the |StatementList| of any |Block|, |CaseClause|, or |DefaultClause| _x_ such that _body_ Contains _x_ is *true*, do
29197
29197
1. Let _F_ be the StringValue of the |BindingIdentifier| of _f_.
0 commit comments