From 1a88356dc3ec86376392405b23f3cba1eaff8f73 Mon Sep 17 00:00:00 2001 From: kpdecker Date: Sun, 31 Jul 2011 17:17:14 -0500 Subject: [PATCH] Access context objects directly rather than using currentContext var. --- lib/handlebars/compiler/compiler.js | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/lib/handlebars/compiler/compiler.js b/lib/handlebars/compiler/compiler.js index 4a60c05a..26df6063 100644 --- a/lib/handlebars/compiler/compiler.js +++ b/lib/handlebars/compiler/compiler.js @@ -186,7 +186,7 @@ Handlebars.JavaScriptCompiler = function() {}; if(partial.context) { this.ID(partial.context); } else { - this.opcode('push', 'context'); + this.opcode('push', 'depth0'); } this.opcode('invokePartial', id.original); @@ -390,7 +390,7 @@ Handlebars.JavaScriptCompiler = function() {}; out.push(''); } - out.push("var buffer = " + this.initializeBuffer() + ", currentContext = context"); + out.push("var buffer = " + this.initializeBuffer()); // track the last context pushed into place to allow skipping the // getContext opcode when it would be a noop @@ -425,7 +425,7 @@ Handlebars.JavaScriptCompiler = function() {}; this.source.push("return buffer;"); - var params = this.isChild ? ["context", "data"] : ["Handlebars", "context", "helpers", "partials", "data"]; + var params = this.isChild ? ["depth0", "data"] : ["Handlebars", "depth0", "helpers", "partials", "data"]; for(var i=0, l=this.environment.depths.list.length; i