Fixed strange stack issue.

This commit is contained in:
Alan Johnson
2010-11-05 15:57:59 -04:00
parent 82529f5051
commit c54cadcf8f
+4 -3
View File
@@ -393,10 +393,11 @@ Handlebars.Compiler.prototype = {
// don't need to be globally unique, just per compiler
var fnId = "fn" + this.pointer.toString();
this.fn += "var wrappedContext = Handlebars.buildContext(context, stack);";
this.fn += "stack.push(context);";
this.fn += "var " + fnId + " = function(context) {" + result + "}; ";
this.fn += "lookup = " + this.lookupFor(mustache) + "; ";
this.fn += "arg = " + param + ";";
this.fn += "stack.push(context);";
if (compiler.continueInverted) {
var invertedCompiler = this.compileToEndOfBlock(mustache);
this.fn += " var " + fnId + "Not = function(context) { " + invertedCompiler.fn + " };";
@@ -404,7 +405,7 @@ Handlebars.Compiler.prototype = {
else {
this.fn += " var " + fnId + "Not = null;";
}
this.fn += "out = out + Handlebars.handleBlock(lookup, wrappedContext, " + param + ", " + fnId + ", " + fnId + "Not);"
this.fn += "out = out + Handlebars.handleBlock(lookup, wrappedContext, arg, " + fnId + ", " + fnId + "Not);"
this.fn += "stack.pop();";
this.openBlock = false;