substack/node-burrito — Issue #7: Calling node.parent() on ternary operator fails
Author: TeslaNick
Created: 2012-01-19 20:23:13+00:00
State: open

Using `burrito@0.2.11`:

burrito('var foo = bar ? baz : null', function(node) {
console.log(node.source());
node.parent();
});

When it hits the "bar" node, calling parent fails with the following stack trace:

TypeError: Object name has no method 'slice'
at walk (/uglify-js/lib/process.js:220:51)
at make_block_statements (/uglify-js/lib/process.js:1778:36)
at Array. (/uglify-js/lib/process.js:1497:32)
at walk (/uglify-js/lib/process.js:215:47)
at /uglify-js/lib/process.js:1715:31
at Object.with_walkers (/uglify-js/lib/process.js:232:27)
at Object.gen_code (/uglify-js/lib/process.js:1492:18)
at /burrito/index.js:32:26
at Object.wrap (/burrito/index.js:72:22)
at /burrito/index.js:145:14