jashkenas/coffee-script — Issue #2110: Normal Assignment vs Conditional Assignment (?=) Produces Incorrect JS
Author: caseyWebDev
Created: 2012-02-07 08:39:34+00:00
State: open

Version 1.2.0

This example

```coffeescript
a =
b: 1
c: 2
```

Produces

```javascript
var a;

a = {
b: 1,
c: 2
};
```

As expected. However, the conditional assignment

```coffeescript
a ?=
b: 1
c: 2
```

Produces

```javascript

if (typeof a === "undefined" || a === null) {
a = {
b: 1
};
}

({
c: 2
});
```

Which is very much different. I would expect

```javascript
if (typeof a === "undefined" || a === null) {
var a = {
b: 1,
c: 2
};
}
```

However, I just started using CS so I may have this wrong.