diff options
Diffstat (limited to 'lib/handlebars/compiler/compiler.js')
-rw-r--r-- | lib/handlebars/compiler/compiler.js | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/handlebars/compiler/compiler.js b/lib/handlebars/compiler/compiler.js index 5f4dca6..b0647da 100644 --- a/lib/handlebars/compiler/compiler.js +++ b/lib/handlebars/compiler/compiler.js @@ -574,14 +574,17 @@ Handlebars.JavaScriptCompiler = function() {}; populateParams: function(paramSize, helperId, program, inverse, hasHash, fn) { var needsRegister = hasHash || this.options.stringParams || inverse || this.options.data; var id = this.popStack(), nextStack; - var params = [], param, stringParam; + var params = [], param, stringParam, stringOptions; if (needsRegister) { this.register('tmp1', program); + stringOptions = 'tmp1'; + } else { + stringOptions = '{ hash: {} }'; } - if (hasHash) { - var hash = this.popStack(); + if (needsRegister) { + var hash = (hasHash ? this.popStack() : '{}'); this.source.push('tmp1.hash = ' + hash + ';'); } @@ -607,7 +610,7 @@ Handlebars.JavaScriptCompiler = function() {}; this.source.push('tmp1.data = data;'); } - params.push(needsRegister ? 'tmp1' : '{}'); + params.push(stringOptions); this.populateCall(params, id, helperId || id, fn); }, |