summaryrefslogtreecommitdiffstats
path: root/lib/handlebars/compiler/javascript-compiler.js
diff options
context:
space:
mode:
authorkpdecker <kpdecker@gmail.com>2014-03-05 17:49:39 -0600
committerkpdecker <kpdecker@gmail.com>2014-03-05 17:49:39 -0600
commit55782f08c58e0ee0902545d77b79e89fe11ae840 (patch)
treed35bb57a458d39f119752b40e6022fb9f5ec0f16 /lib/handlebars/compiler/javascript-compiler.js
parent058c0fb6ba67acb06eb64a2385904da0972ccac8 (diff)
downloadhandlebars.js-55782f08c58e0ee0902545d77b79e89fe11ae840.zip
handlebars.js-55782f08c58e0ee0902545d77b79e89fe11ae840.tar.gz
handlebars.js-55782f08c58e0ee0902545d77b79e89fe11ae840.tar.bz2
Fix evaluation of paths and subexprs
Fixes #743
Diffstat (limited to 'lib/handlebars/compiler/javascript-compiler.js')
-rw-r--r--lib/handlebars/compiler/javascript-compiler.js13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/handlebars/compiler/javascript-compiler.js b/lib/handlebars/compiler/javascript-compiler.js
index 514dfcc..8bb5da6 100644
--- a/lib/handlebars/compiler/javascript-compiler.js
+++ b/lib/handlebars/compiler/javascript-compiler.js
@@ -915,16 +915,19 @@ JavaScriptCompiler.prototype = {
options.inverse = inverse;
}
- for (var i = 0; i < paramSize; i++) {
+ // The parameters go on to the stack in order (making sure that they are evaluated in order)
+ // so we need to pop them off the stack in reverse order
+ var i = paramSize;
+ while (i--) {
param = this.popStack();
- params.push(param);
+ params[i] = param;
if (this.trackIds) {
- ids.push(this.popStack());
+ ids[i] = this.popStack();
}
if (this.stringParams) {
- types.push(this.popStack());
- contexts.push(this.popStack());
+ types[i] = this.popStack();
+ contexts[i] = this.popStack();
}
}