diff options
author | Jon Jensen <jenseng@gmail.com> | 2014-02-20 17:10:53 -0600 |
---|---|---|
committer | Jon Jensen <jenseng@gmail.com> | 2014-02-20 17:37:25 -0600 |
commit | 8493822b621470a7423ec05d9f09e717725e3943 (patch) | |
tree | 2776c9ba7034c9c1b32678111fb549410c392c1e /lib/handlebars/compiler/compiler.js | |
parent | a5ff1f3d22178b3889983be29b31b850a4528719 (diff) | |
download | handlebars.js-8493822b621470a7423ec05d9f09e717725e3943.zip handlebars.js-8493822b621470a7423ec05d9f09e717725e3943.tar.gz handlebars.js-8493822b621470a7423ec05d9f09e717725e3943.tar.bz2 |
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
Diffstat (limited to 'lib/handlebars/compiler/compiler.js')
-rw-r--r-- | lib/handlebars/compiler/compiler.js | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/handlebars/compiler/compiler.js b/lib/handlebars/compiler/compiler.js index 7acff1f..99d6f4f 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<l; i++) { - pair = pairs[i]; - - this.pushParam(pair[1]); - this.opcode('assignToHash', pair[0]); + for(i=0, l=pairs.length; i<l; i++) { + this.pushParam(pairs[i][1]); + } + while(i--) { + this.opcode('assignToHash', pairs[i][0]); } this.opcode('popHash'); }, |