Cyrus Najmabadi (2015-02-17T10:22:57.000Z)
Hey ES-discuss,

Hi,

For the following code:
for (var i = 0 in {}) { }

We are trying to figure out what grammar productions allow the left hand side of a for-in statement to have an initializer.

I notice that in the ES5 spec, the following productions can get you there:
IterationStatement :
for ( var VariableDeclarationNoIn in Expression ) Statement
VariableDeclarationNoIn :

Identifier InitialiserNoInopt

But in ES6, all I see is
IterationStatement[Yield, Return] :
            for ( var ForBinding[?Yield] in Expression[In, ?Yield] ) Statement[?Yield, ?Return]
ForBinding[Yield] :
BindingIdentifier[?Yield]
BindingPattern[?Yield]

And neither BindingIdentifier or BindingPattern allow an initializer.

Is there a grammar path that I am missing?

Thanks,
Jason

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150217/4a993cda/attachment.html>
d at domenic.me (2015-02-21T00:52:28.058Z)
For the following code:

```js
for (var i = 0 in {}) { }
```

We are trying to figure out what grammar productions allow the left hand side of a for-in statement to have an initializer.

I notice that in the ES5 spec, the following productions can get you there:

```
IterationStatement :
for ( var VariableDeclarationNoIn in Expression ) Statement
VariableDeclarationNoIn :

Identifier InitialiserNoInopt
```

But in ES6, all I see is

```
IterationStatement[Yield, Return] :
            for ( var ForBinding[?Yield] in Expression[In, ?Yield] ) Statement[?Yield, ?Return]
ForBinding[Yield] :
BindingIdentifier[?Yield]
BindingPattern[?Yield]
```

And neither BindingIdentifier or BindingPattern allow an initializer.

Is there a grammar path that I am missing?