&& causes burrito to crash #9

Open
framlin opened this Issue Oct 4, 2012 · 0 comments

Projects

None yet

1 participant

@framlin
framlin commented Oct 4, 2012

Servus,
the following line causes burrito to crash:

((lvst in special_calc_states) && !(this._calc_today)) ? ndat : this.vond

TypeError: Object binary has no method 'slice'
at walk (/home/framlin/Source/jsanalyzer/node_modules/burrito/node_modules/uglify-js/lib/process.js:220:51)
    at burrito.wrapNode (/home/framlin/Source/jsanalyzer/node_modules/burrito/index.js:142:16)
    at Object.mapper (/home/framlin/Source/jsanalyzer/node_modules/burrito/index.js:45:9)
    at walker (/home/framlin/Source/jsanalyzer/node_modules/burrito/node_modules/traverse/index.js:169:22)
    at /home/framlin/Source/jsanalyzer/node_modules/burrito/node_modules/traverse/index.js:185:29
    at Array.forEach (native)
    at forEach (/home/framlin/Source/jsanalyzer/node_modules/burrito/node_modules/traverse/index.js:255:31)
    at walker (/home/framlin/Source/jsanalyzer/node_modules/burrito/node_modules/traverse/index.js:180:13)
    at /home/framlin/Source/jsanalyzer/node_modules/burrito/node_modules/traverse/index.js:185:29
    at Array.forEach (native)

Is there any way to avoid the crash - besides changing the source ;) ?

to be more precise its the use of node.parent() within the burrito-callback, that's crashing:

JSAnalyzer.prototype.analyze = function analyze(fileName, source, callback) {
var me = this,
src = "";

this.emit('start');
src = burrito("((lvst in special_calc_states) && !(this._calc_today)) ? ndat : this.vond;", function (node) {
    var parent = null;
    parent = node.parent(); // <<<<----- crashes
});
this.emit('data', {fn: fileName, src: src});
this.emit('end');
if (callback) {
    callback(src);
}

};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment