Constellation/escodegen — pull request #155 by 1999 (2013-12-20 16:11:16+00:00)
Title: Support for LetStatement

It seems like this is again Spidermonkey-only feature, but there's also LetStatement type which can be generated by Spidermonkey engine. Esprima produces [more expected result](http://esprima.org/demo/parse.html?code=for%20(let%20i%3D0%3B%20i%3C3%3B%20i%2B%2B)%20%7B%7D) and this is the output by Spidermonkey's Reflect:

```js -e 'print(JSON.stringify(Reflect.parse("for (let i=0; i<3; i++) {}", {loc: false}), null, " "))'```
```json
{
"loc": null,
"type": "Program",
"body": [
{
"loc": null,
"type": "LetStatement",
"head": [
{
"loc": null,
"type": "VariableDeclarator",
"id": {
"loc": null,
"type": "Identifier",
"name": "i"
},
"init": {
"loc": null,
"type": "Literal",
"value": 0
}
}
],
"body": {
"loc": null,
"type": "ForStatement",
"init": null,
"test": {
"loc": null,
"type": "BinaryExpression",
"operator": "<",
"left": {
"loc": null,
"type": "Identifier",
"name": "i"
},
"right": {
"loc": null,
"type": "Literal",
"value": 3
}
},
"update": {
"loc": null,
"type": "UpdateExpression",
"operator": "++",
"argument": {
"loc": null,
"type": "Identifier",
"name": "i"
},
"prefix": false
},
"body": {
"loc": null,
"type": "BlockStatement",
"body": []
}
}
}
]
}
```

[LetStatement](https://developer.mozilla.org/en-US/docs/SpiderMonkey/Parser_API#Statements) is similar to VariableDeclaration, so I combined them.