Skip to content

Commit

Permalink
Editorial: Regroup IterationStatement static semantics (#1284)
Browse files Browse the repository at this point in the history
Coalesce children of `for`-`in`, `for`-`of`, and `for`-`await`-`of`
statements with identical definitions for VarDeclaredNames and
VarScopedDeclarations for better readability: instead of having six
different algorithm blocks for each of VarDeclaredNames and
VarScopedDeclarations now there are only two.
  • Loading branch information
TimothyGu authored and syg committed Oct 10, 2019
1 parent 6f32d3e commit fa8e6b3
Showing 1 changed file with 10 additions and 47 deletions.
57 changes: 10 additions & 47 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -17527,30 +17527,21 @@ <h1>Static Semantics: IsDestructuring</h1>
<emu-clause id="sec-for-in-and-for-of-statements-static-semantics-vardeclarednames">
<h1>Static Semantics: VarDeclaredNames</h1>
<emu-see-also-para op="VarDeclaredNames"></emu-see-also-para>
<emu-grammar>IterationStatement : `for` `(` LeftHandSideExpression `in` Expression `)` Statement</emu-grammar>
<emu-alg>
1. Return the VarDeclaredNames of |Statement|.
</emu-alg>
<emu-grammar>IterationStatement : `for` `(` `var` ForBinding `in` Expression `)` Statement</emu-grammar>
<emu-alg>
1. Let _names_ be the BoundNames of |ForBinding|.
1. Append to _names_ the elements of the VarDeclaredNames of |Statement|.
1. Return _names_.
</emu-alg>
<emu-grammar>IterationStatement : `for` `(` ForDeclaration `in` Expression `)` Statement</emu-grammar>
<emu-alg>
1. Return the VarDeclaredNames of |Statement|.
</emu-alg>
<emu-grammar>
IterationStatement :
`for` `(` LeftHandSideExpression `in` Expression `)` Statement
`for` `(` ForDeclaration `in` Expression `)` Statement
`for` `(` LeftHandSideExpression `of` AssignmentExpression `)` Statement
`for` `(` ForDeclaration `of` AssignmentExpression `)` Statement
`for` `await` `(` LeftHandSideExpression `of` AssignmentExpression `)` Statement
`for` `await` `(` ForDeclaration `of` AssignmentExpression `)` Statement
</emu-grammar>
<emu-alg>
1. Return the VarDeclaredNames of |Statement|.
</emu-alg>
<emu-grammar>
IterationStatement :
`for` `(` `var` ForBinding `in` Expression `)` Statement
`for` `(` `var` ForBinding `of` AssignmentExpression `)` Statement
`for` `await` `(` `var` ForBinding `of` AssignmentExpression `)` Statement
</emu-grammar>
Expand All @@ -17559,14 +17550,6 @@ <h1>Static Semantics: VarDeclaredNames</h1>
1. Append to _names_ the elements of the VarDeclaredNames of |Statement|.
1. Return _names_.
</emu-alg>
<emu-grammar>
IterationStatement :
`for` `(` ForDeclaration `of` AssignmentExpression `)` Statement
`for` `await` `(` ForDeclaration `of` AssignmentExpression `)` Statement
</emu-grammar>
<emu-alg>
1. Return the VarDeclaredNames of |Statement|.
</emu-alg>
<emu-note>
<p>This section is extended by Annex <emu-xref href="#sec-initializers-in-forin-statement-heads"></emu-xref>.</p>
</emu-note>
Expand All @@ -17575,33 +17558,21 @@ <h1>Static Semantics: VarDeclaredNames</h1>
<emu-clause id="sec-for-in-and-for-of-statements-static-semantics-varscopeddeclarations">
<h1>Static Semantics: VarScopedDeclarations</h1>
<emu-see-also-para op="VarScopedDeclarations"></emu-see-also-para>
<emu-grammar>IterationStatement : `for` `(` LeftHandSideExpression `in` Expression `)` Statement</emu-grammar>
<emu-alg>
1. Return the VarScopedDeclarations of |Statement|.
</emu-alg>
<emu-grammar>IterationStatement : `for` `(` `var` ForBinding `in` Expression `)` Statement</emu-grammar>
<emu-alg>
1. Let _declarations_ be a List containing |ForBinding|.
1. Append to _declarations_ the elements of the VarScopedDeclarations of |Statement|.
1. Return _declarations_.
</emu-alg>
<emu-grammar>
IterationStatement :
`for` `(` LeftHandSideExpression `in` Expression `)` Statement
`for` `(` ForDeclaration `in` Expression `)` Statement
`for` `await` `(` LeftHandSideExpression `of` AssignmentExpression `)` Statement
</emu-grammar>
<emu-alg>
1. Return the VarScopedDeclarations of |Statement|.
</emu-alg>
<emu-grammar>
IterationStatement :
`for` `(` LeftHandSideExpression `of` AssignmentExpression `)` Statement
`for` `(` ForDeclaration `of` AssignmentExpression `)` Statement
`for` `await` `(` LeftHandSideExpression `of` AssignmentExpression `)` Statement
`for` `await` `(` ForDeclaration `of` AssignmentExpression `)` Statement
</emu-grammar>
<emu-alg>
1. Return the VarScopedDeclarations of |Statement|.
</emu-alg>
<emu-grammar>
IterationStatement :
`for` `(` `var` ForBinding `in` Expression `)` Statement
`for` `(` `var` ForBinding `of` AssignmentExpression `)` Statement
`for` `await` `(` `var` ForBinding `of` AssignmentExpression `)` Statement
</emu-grammar>
Expand All @@ -17610,14 +17581,6 @@ <h1>Static Semantics: VarScopedDeclarations</h1>
1. Append to _declarations_ the elements of the VarScopedDeclarations of |Statement|.
1. Return _declarations_.
</emu-alg>
<emu-grammar>
IterationStatement :
`for` `(` ForDeclaration `of` AssignmentExpression `)` Statement
`for` `await` `(` ForDeclaration `of` AssignmentExpression `)` Statement
</emu-grammar>
<emu-alg>
1. Return the VarScopedDeclarations of |Statement|.
</emu-alg>
<emu-note>
<p>This section is extended by Annex <emu-xref href="#sec-initializers-in-forin-statement-heads"></emu-xref>.</p>
</emu-note>
Expand Down

0 comments on commit fa8e6b3

Please sign in to comment.