summaryrefslogtreecommitdiffstats
path: root/lib/handlebars/compiler/compiler.js
diff options
context:
space:
mode:
authorkpdecker <kpdecker@gmail.com>2013-01-19 17:36:38 -0600
committerkpdecker <kpdecker@gmail.com>2013-01-19 17:39:13 -0600
commitcb50caaf5336c43310ebfebaa38695b9fce6bfb7 (patch)
treedac4ab5703ff4f8aa5c36657bb31c4f31525f858 /lib/handlebars/compiler/compiler.js
parentae954077751ef0103684e840ca4f4d00e9de4cb1 (diff)
downloadhandlebars.js-cb50caaf5336c43310ebfebaa38695b9fce6bfb7.zip
handlebars.js-cb50caaf5336c43310ebfebaa38695b9fce6bfb7.tar.gz
handlebars.js-cb50caaf5336c43310ebfebaa38695b9fce6bfb7.tar.bz2
Use inline values for simple terminals
Diffstat (limited to 'lib/handlebars/compiler/compiler.js')
-rw-r--r--lib/handlebars/compiler/compiler.js9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/handlebars/compiler/compiler.js b/lib/handlebars/compiler/compiler.js
index f1d368b..3405eab 100644
--- a/lib/handlebars/compiler/compiler.js
+++ b/lib/handlebars/compiler/compiler.js
@@ -623,7 +623,7 @@ Handlebars.JavaScriptCompiler = function() {};
// Looks up the value of `name` on the current context and pushes
// it onto the stack.
lookupOnContext: function(name) {
- this.pushStack(this.nameLookup('depth' + this.lastContext, name, 'context'));
+ this.pushStack(this.nameLookup('depth' + this.lastContext, name, 'context'), true);
},
// [pushContext]
@@ -671,7 +671,7 @@ Handlebars.JavaScriptCompiler = function() {};
//
// Push the result of looking up `id` on the current data
lookupData: function(id) {
- this.pushStack(this.nameLookup('data', id, 'data'));
+ this.pushStack(this.nameLookup('data', id, 'data'), true);
},
// [pushStringParam]
@@ -914,8 +914,7 @@ Handlebars.JavaScriptCompiler = function() {};
},
pushStackLiteral: function(item) {
- this.compileStack.push(new Literal(item));
- return item;
+ return this.pushStack(new Literal(item), true);
},
pushStack: function(item, inline) {
@@ -935,6 +934,8 @@ Handlebars.JavaScriptCompiler = function() {};
},
replaceStack: function(callback) {
+ this.flushInline();
+
var stack = this.topStack(),
item = callback.call(this, stack);