nau/jscala — pull request #24 by zbsz (2014-01-18 12:48:06+00:00)
Title: Improved foreach support.

Improved for statements to better handle arrays and sequences.
For example this is now supported:
```scala
javascript { Array(1, 2) foreach { i => print(i) } }
```
and generates following js code:
```javascript
for (var iColl = [1, 2], iIdx = 0, i = iColl[iIdx]; iIdx < iColl.length; i = iColl[++iIdx]) print(i)
```
Generated for loop has now additional variable to store currently iterated array.

We can also now iterate over sequences inside other objects, like this:
```scala
case class User(name: String)
case class Project(title: String, users: Seq[User])

javascript({ (p: Project) =>
if (p.title == "title")
for (u <- p.users) print(u.name)
})
```
The most significant change to make this possible was removing of JsExprStmt, we don't really need it, since each expr can be treated as statement.
And now we don't need to treat expressions in any special way when parsing javascript, jsExpr is just another case inside jsStmt rule, and main rule for jsAst is now:
```scala
lazy val jsAst: ToExpr[JsAst] = jsStmtOrDie
```
This change was needed because foreach calls were caught in JsCall.