diff options
Diffstat (limited to 'lib/handlebars/compiler/javascript-compiler.js')
-rw-r--r-- | lib/handlebars/compiler/javascript-compiler.js | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/handlebars/compiler/javascript-compiler.js b/lib/handlebars/compiler/javascript-compiler.js index 7fbddf7..22937f6 100644 --- a/lib/handlebars/compiler/javascript-compiler.js +++ b/lib/handlebars/compiler/javascript-compiler.js @@ -687,7 +687,8 @@ JavaScriptCompiler.prototype = { replaceStack: function(callback) { var prefix = '', inline = this.isInline(), - stack; + stack, + usedLiteral; // If we are currently inline then we want to merge the inline statement into the // replacement statement via ',' @@ -697,6 +698,7 @@ JavaScriptCompiler.prototype = { if (top instanceof Literal) { // Literals do not need to be inlined stack = top.value; + usedLiteral = true; } else { // Get or create the current stack name for use by the inline var name = this.stackSlot ? this.topStackName() : this.incrStack(); @@ -711,7 +713,7 @@ JavaScriptCompiler.prototype = { var item = callback.call(this, stack); if (inline) { - if (this.inlineStack.length || this.compileStack.length) { + if (!usedLiteral) { this.popStack(); } this.push('(' + prefix + item + ')'); |