Fixed strange stack issue.
This commit is contained in:
+4
-3
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user