summaryrefslogtreecommitdiffstats
path: root/lib/handlebars/compiler/compiler.js
diff options
context:
space:
mode:
authorJon Jensen <jenseng@gmail.com>2014-02-20 17:10:53 -0600
committerJon Jensen <jenseng@gmail.com>2014-02-20 17:37:25 -0600
commit8493822b621470a7423ec05d9f09e717725e3943 (patch)
tree2776c9ba7034c9c1b32678111fb549410c392c1e /lib/handlebars/compiler/compiler.js
parenta5ff1f3d22178b3889983be29b31b850a4528719 (diff)
downloadhandlebars.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.js12
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');
},