jashkenas/coffee-script — Issue #1843: supposedly local variables gets generated as a global variable
Author: bhavinkamani
Created: 2011-11-09 12:15:57+00:00
State: open

``` coffeescript
->
for num in [1..10]
error ?= {}
num
```

generates

``` javascript
(function() {
var num, _results;
_results = [];
for (num = 1; num <= 10; num++) {
if (typeof error === "undefined" || error === null) error = {};
_results.push(num);
}
return _results;
});
```

Shouldn't error be declared with local scope in the generated javascript? Currently, errors gets scoped as global.