jashkenas/coffee-script — pull request #3211 by marchaefner (2013-10-20 21:04:36+00:00)
Title: Fix compilation for conditional assignment

Fixes two errors with conditional assignments as subexpressions:

1. #2181: `||=` and `&&=` are not properly parenthesized.

Straightforward fix, analogous to the other assignment variants.

2. Variable caching for `?=` is broken. (Could not find a related issue.)

```coffee
x = foo().bar ?= baz
```

compiles to

```javascript
x = (_base = foo()).bar != null ? (_base = foo()).bar : _base.bar = baz;
```

Fixed by constructing the `If` directly in `Assign.compileConditional` instead of delegating to `Op` and losing the reference (`_base.bar`) in the process.

Compilation is now (as it should be):

```javascript
x = (_base = foo()).bar != null ? _base.bar : _base.bar = baz;
```