diff options
Diffstat (limited to 'lib/handlebars/compiler/javascript-compiler.js')
-rw-r--r-- | lib/handlebars/compiler/javascript-compiler.js | 13 |
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(); } } |