Permalink
Browse files

Fixed - else bug introduced with new error context stack

  • Loading branch information...
1 parent c74ad7e commit df6845e6fb600efa69509940c9eeebaf88ab4544 @tj tj committed Sep 8, 2011
Showing with 9 additions and 2 deletions.
  1. +8 −1 lib/compiler.js
  2. +1 −1 lib/nodes/code.js
View
@@ -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();');
View
@@ -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;
};
/**

0 comments on commit df6845e

Please sign in to comment.