From 8493822b621470a7423ec05d9f09e717725e3943 Mon Sep 17 00:00:00 2001 From: Jon Jensen Date: Thu, 20 Feb 2014 17:10:53 -0600 Subject: [PATCH] properly handle multiple subexpressions in the same hash, fixes #748 push all hash params before popping any so as to avoid the last stackN var stomping previous ones --- lib/handlebars/compiler/compiler.js | 12 ++++++------ lib/handlebars/compiler/javascript-compiler.js | 7 +++---- spec/subexpressions.js | 17 +++++++++++++++++ 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/lib/handlebars/compiler/compiler.js b/lib/handlebars/compiler/compiler.js index 7acff1fee..99d6f4f75 100644 --- a/lib/handlebars/compiler/compiler.js +++ b/lib/handlebars/compiler/compiler.js @@ -188,15 +188,15 @@ Compiler.prototype = { }, hash: function(hash) { - var pairs = hash.pairs, pair; + var pairs = hash.pairs, i, l; this.opcode('pushHash'); - for(var i=0, l=pairs.length; i'); + }, + t: function(defaultString) { + return new Handlebars.SafeString(defaultString); + } + } + shouldCompileTo(string, [{}, helpers], ''); + }); + it("in string params mode,", function() { var template = CompilerContext.compile('{{snog (blorg foo x=y) yeah a=b}}', {stringParams: true});