Use inline values for simple terminals

This commit is contained in:
kpdecker
2013-01-19 17:36:38 -06:00
parent ae95407775
commit cb50caaf53
+5 -4
View File
@@ -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);