mishoo/UglifyJS2 — pull request #404 by divdavem (2014-01-20 21:45:47+00:00)
Title: Wrong end token in conditionals

This pull request fixes the end token for `AST_Conditional` nodes.

The following piece of code displays the start and end tokens of both a conditional and a binary node.
The end token of a conditional node is wrong.

**Code**

```js
var UglifyJS = require("uglify-js");
var ast = UglifyJS.parse("var c = a ? 1 : 2 ; var d = a != 2; var e = 4;");
var walker = new UglifyJS.TreeWalker(function (node){
if (node instanceof UglifyJS.AST_Conditional) {
console.log("Conditional from '" + node.start.value + "' to '" + node.end.value+ "'.");
} else if (node instanceof UglifyJS.AST_Binary) {
console.log("Binary from '" + node.start.value + "' to '"+ node.end.value + "'.");
}
});
ast.walk(walker);
```

**Expected result**

```
Conditional from 'a' to '2'.
Binary from 'a' to '2'.
```

**Actual result**

```
Conditional from 'a' to 'var'.
Binary from 'a' to '2'.
```

**Version**

Tested with UglifyJS version 2.4.10.