Skip to content

Commit

Permalink
Refactor to avoid "and" after the host-condition
Browse files Browse the repository at this point in the history
  • Loading branch information
jmdyck committed Mar 21, 2024
1 parent 2c3a9d4 commit 9503bed
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -13768,26 +13768,26 @@ <h1>
1. Let _initialValue_ be ! _env_.GetBindingValue(_n_, *false*).
1. Perform ! _varEnv_.InitializeBinding(_n_, _initialValue_).
1. NOTE: A var with the same name as a formal parameter initially has the same value as the corresponding initialized parameter.
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
1. For each |FunctionDeclaration| _f_ that is directly contained in the |StatementList| of a |Block|, |CaseClause|, or |DefaultClause|, do
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 _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_.
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>:
1. Let _fenv_ be the running execution context's VariableEnvironment.
1. Let _benv_ be the running execution context's LexicalEnvironment.
1. Let _fobj_ be ! _benv_.GetBindingValue(_F_, *false*).
1. Perform ! _fenv_.SetMutableBinding(_F_, _fobj_, *false*).
1. Return ~unused~.
1. If _strict_ is *false*, then
1. If _strict_ is *true*, then
1. Let _lexEnv_ be _varEnv_.
1. Else,
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
1. For each |FunctionDeclaration| _f_ that is directly contained in the |StatementList| of a |Block|, |CaseClause|, or |DefaultClause|, do
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 _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_.
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>:
1. Let _fenv_ be the running execution context's VariableEnvironment.
1. Let _benv_ be the running execution context's LexicalEnvironment.
1. Let _fobj_ be ! _benv_.GetBindingValue(_F_, *false*).
1. Perform ! _fenv_.SetMutableBinding(_F_, _fobj_, *false*).
1. Return ~unused~.
1. Let _lexEnv_ be NewDeclarativeEnvironment(_varEnv_).
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.
1. Else,
1. Let _lexEnv_ be _varEnv_.
1. Set the LexicalEnvironment of _calleeContext_ to _lexEnv_.
1. Let _lexDeclarations_ be the LexicallyScopedDeclarations of _code_.
1. For each element _d_ of _lexDeclarations_, do
Expand Down Expand Up @@ -21154,7 +21154,7 @@ <h1>Static Semantics: Early Errors</h1>
<emu-grammar>Block : `{` StatementList `}`</emu-grammar>
<ul>
<li>
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>.
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>.
</li>
<li>
It is a Syntax Error if any element of the LexicallyDeclaredNames of |StatementList| also occurs in the VarDeclaredNames of |StatementList|.
Expand Down Expand Up @@ -22620,7 +22620,7 @@ <h1>Static Semantics: Early Errors</h1>
<emu-grammar>SwitchStatement : `switch` `(` Expression `)` CaseBlock</emu-grammar>
<ul>
<li>
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>.
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>.
</li>
<li>
It is a Syntax Error if any element of the LexicallyDeclaredNames of |CaseBlock| also occurs in the VarDeclaredNames of |CaseBlock|.
Expand Down Expand Up @@ -22773,7 +22773,7 @@ <h1>Static Semantics: Early Errors</h1>
<emu-grammar>LabelledItem : FunctionDeclaration</emu-grammar>
<ul>
<li>
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>.
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>.
</li>
</ul>
</emu-clause>
Expand Down Expand Up @@ -22923,7 +22923,7 @@ <h1>Static Semantics: Early Errors</h1>
It is a Syntax Error if any element of the BoundNames of |CatchParameter| also occurs in the LexicallyDeclaredNames of |Block|.
</li>
<li>
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>.
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>.
</li>
</ul>
</emu-clause>
Expand Down Expand Up @@ -29060,7 +29060,7 @@ <h1>
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", 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
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
1. Let _declaredFunctionOrVarNames_ be the list-concatenation of _declaredFunctionNames_ and _declaredVarNames_.
1. For each |FunctionDeclaration| _f_ that is directly contained in the |StatementList| of a |Block|, |CaseClause|, or |DefaultClause| Contained within _body_, do
1. Let _F_ be StringValue of the |BindingIdentifier| of _f_.
Expand Down

0 comments on commit 9503bed

Please sign in to comment.