Skip to content

Commit

Permalink
Normative: Treat IterationStatements uniformly in Annex B.3.5 (#1393)
Browse files Browse the repository at this point in the history
Fixes #1392.
  • Loading branch information
rkirsling authored and ljharb committed Feb 7, 2019
1 parent a6d940e commit 8a16cb8
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -40800,17 +40800,16 @@ <h1>VariableStatements in Catch Blocks</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| unless |CatchParameter| is <emu-grammar>CatchParameter : BindingIdentifier</emu-grammar> and that element is only bound by a |VariableStatement|, the |VariableDeclarationList| of a for statement, the |ForBinding| of a for-in statement, or the |BindingIdentifier| of a for-in statement.
It is a Syntax Error if any element of the BoundNames of |CatchParameter| also occurs in the VarDeclaredNames of |Block| unless |CatchParameter| is <emu-grammar>CatchParameter : BindingIdentifier</emu-grammar>.
</li>
</ul>
<emu-note>
<p>The |Block| of a |Catch| clause may contain `var` declarations that bind a name that is also bound by the |CatchParameter|. At runtime, such bindings are instantiated in the VariableDeclarationEnvironment. They do not shadow the same-named bindings introduced by the |CatchParameter| and hence the |Initializer| for such `var` declarations will assign to the corresponding catch parameter rather than the `var` binding. The relaxation of the normal static semantic rule does not apply to names only bound by for-of statements.</p>
<p>The |Block| of a |Catch| clause may contain `var` declarations that bind a name that is also bound by the |CatchParameter|. At runtime, such bindings are instantiated in the VariableDeclarationEnvironment. They do not shadow the same-named bindings introduced by the |CatchParameter| and hence the |Initializer| for such `var` declarations will assign to the corresponding catch parameter rather than the `var` binding.</p>
</emu-note>
<p>This modified behaviour also applies to `var` and `function` declarations introduced by direct eval calls contained within the |Block| of a |Catch| clause. This change is accomplished by modifying the algorithm of <emu-xref href="#sec-evaldeclarationinstantiation"></emu-xref> as follows:</p>
<p>Step 5.d.ii.2.a.i is replaced by:</p>
<emu-alg type="i">
1. If _thisEnvRec_ is not the Environment Record for a |Catch| clause, throw a *SyntaxError* exception.
1. If _name_ is bound by any syntactic form other than a |FunctionDeclaration|, a |VariableStatement|, the |VariableDeclarationList| of a for statement, the |ForBinding| of a for-in statement, or the |BindingIdentifier| of a for-in statement, throw a *SyntaxError* exception.
</emu-alg>
<p>Step 9.d.ii.4.b.i.i is replaced by:</p>
<emu-alg type="i">
Expand Down

0 comments on commit 8a16cb8

Please sign in to comment.