diff --git a/lib/compiler.js b/lib/compiler.js index 71afc721a..c2fe2a4d0 100644 --- a/lib/compiler.js +++ b/lib/compiler.js @@ -123,7 +123,7 @@ Compiler.prototype = { */ visit: function(node){ - var debug = this.debug && false !== node.debug; + var debug = this.debug; if (debug) { this.buf.push('__.unshift({ lineno: ' + node.line @@ -133,6 +133,13 @@ Compiler.prototype = { + ' });'); } + // Massive hack to fix our context + // stack for - else[ if] etc + if (false === node.debug) { + this.buf.pop(); + this.buf.pop(); + } + this.visitNode(node); if (debug) this.buf.push('__.shift();'); diff --git a/lib/nodes/code.js b/lib/nodes/code.js index 5e904a450..babc67598 100644 --- a/lib/nodes/code.js +++ b/lib/nodes/code.js @@ -25,7 +25,7 @@ var Code = module.exports = function Code(val, buffer, escape) { this.val = val; this.buffer = buffer; this.escape = escape; - if (/^ *else/.test(val)) this.debug = false; + if (val.match(/^ *else/)) this.debug = false; }; /**