summaryrefslogtreecommitdiffstats
path: root/lib/handlebars/compiler/javascript-compiler.js
diff options
context:
space:
mode:
authorkpdecker <kpdecker@gmail.com>2014-11-05 23:23:43 -0600
committerkpdecker <kpdecker@gmail.com>2014-11-05 23:23:43 -0600
commitd3bd1a523d13453e0b7028ac8a3015100bd63eda (patch)
treed11880ffde066b452594027fb71dd71b3400659e /lib/handlebars/compiler/javascript-compiler.js
parent9665379cdc20d6ef9f8e21157f623b69d6f21db0 (diff)
downloadhandlebars.js-d3bd1a523d13453e0b7028ac8a3015100bd63eda.zip
handlebars.js-d3bd1a523d13453e0b7028ac8a3015100bd63eda.tar.gz
handlebars.js-d3bd1a523d13453e0b7028ac8a3015100bd63eda.tar.bz2
Simplify flushInline implementation
Diffstat (limited to 'lib/handlebars/compiler/javascript-compiler.js')
-rw-r--r--lib/handlebars/compiler/javascript-compiler.js29
1 files changed, 10 insertions, 19 deletions
diff --git a/lib/handlebars/compiler/javascript-compiler.js b/lib/handlebars/compiler/javascript-compiler.js
index 61e99cb..661d1e2 100644
--- a/lib/handlebars/compiler/javascript-compiler.js
+++ b/lib/handlebars/compiler/javascript-compiler.js
@@ -697,7 +697,7 @@ JavaScriptCompiler.prototype = {
},
pushStackLiteral: function(item) {
- return this.push(new Literal(item));
+ this.push(new Literal(item));
},
pushSource: function(source) {
@@ -711,15 +711,6 @@ JavaScriptCompiler.prototype = {
}
},
- pushStack: function(item) {
- this.flushInline();
-
- var stack = this.incrStack();
- this.pushSource(stack + " = " + item + ";");
- this.compileStack.push(stack);
- return stack;
- },
-
replaceStack: function(callback) {
var prefix = '',
inline = this.isInline(),
@@ -769,15 +760,15 @@ JavaScriptCompiler.prototype = {
},
flushInline: function() {
var inlineStack = this.inlineStack;
- if (inlineStack.length) {
- this.inlineStack = [];
- for (var i = 0, len = inlineStack.length; i < len; i++) {
- var entry = inlineStack[i];
- if (entry instanceof Literal) {
- this.compileStack.push(entry);
- } else {
- this.pushStack(entry);
- }
+ this.inlineStack = [];
+ for (var i = 0, len = inlineStack.length; i < len; i++) {
+ var entry = inlineStack[i];
+ if (entry instanceof Literal) {
+ this.compileStack.push(entry);
+ } else {
+ var stack = this.incrStack();
+ this.pushSource(stack + " = " + entry + ";");
+ this.compileStack.push(stack);
}
}
},