Use push rather than pushStack for inline ops
This commit is contained in:
@@ -652,7 +652,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'), true);
|
||||
this.push(this.nameLookup('depth' + this.lastContext, name, 'context'));
|
||||
},
|
||||
|
||||
// [pushContext]
|
||||
@@ -700,7 +700,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'), true);
|
||||
this.push(this.nameLookup('data', id, 'data'));
|
||||
},
|
||||
|
||||
// [pushStringParam]
|
||||
@@ -740,7 +740,7 @@ Handlebars.JavaScriptCompiler = function() {};
|
||||
if (this.options.stringParams) {
|
||||
this.register('hashTypes', '{' + hash.types.join(',') + '}');
|
||||
}
|
||||
this.pushStack('{\n ' + hash.values.join(',\n ') + '\n }', true);
|
||||
this.push('{\n ' + hash.values.join(',\n ') + '\n }');
|
||||
},
|
||||
|
||||
// [pushString]
|
||||
@@ -760,7 +760,7 @@ Handlebars.JavaScriptCompiler = function() {};
|
||||
//
|
||||
// Push an expression onto the stack
|
||||
push: function(expr) {
|
||||
this.pushStack(expr, true);
|
||||
return this.pushStack(expr, true);
|
||||
},
|
||||
|
||||
// [pushLiteral]
|
||||
@@ -805,7 +805,7 @@ Handlebars.JavaScriptCompiler = function() {};
|
||||
|
||||
var helper = this.lastHelper = this.setupHelper(paramSize, name, true);
|
||||
|
||||
this.pushStack(helper.name, true);
|
||||
this.push(helper.name);
|
||||
this.replaceStack(function(name) {
|
||||
return name + ' ? ' + name + '.call(' +
|
||||
helper.callParams + ") " + ": helperMissing.call(" +
|
||||
@@ -822,7 +822,7 @@ Handlebars.JavaScriptCompiler = function() {};
|
||||
// so a `helperMissing` fallback is not required.
|
||||
invokeKnownHelper: function(paramSize, name) {
|
||||
var helper = this.setupHelper(paramSize, name);
|
||||
this.pushStack(helper.name + ".call(" + helper.callParams + ")", true);
|
||||
this.push(helper.name + ".call(" + helper.callParams + ")");
|
||||
},
|
||||
|
||||
// [invokeAmbiguous]
|
||||
@@ -840,7 +840,7 @@ Handlebars.JavaScriptCompiler = function() {};
|
||||
invokeAmbiguous: function(name, helperCall) {
|
||||
this.context.aliases.functionType = '"function"';
|
||||
|
||||
this.pushStackLiteral('{}');
|
||||
this.pushStackLiteral('{}'); // Hash value
|
||||
var helper = this.setupHelper(0, name, helperCall);
|
||||
|
||||
var helperName = this.lastHelper = this.nameLookup('helpers', name, 'helper');
|
||||
@@ -867,7 +867,7 @@ Handlebars.JavaScriptCompiler = function() {};
|
||||
}
|
||||
|
||||
this.context.aliases.self = "this";
|
||||
this.pushStack("self.invokePartial(" + params.join(", ") + ")");
|
||||
this.push("self.invokePartial(" + params.join(", ") + ")");
|
||||
},
|
||||
|
||||
// [assignToHash]
|
||||
@@ -952,7 +952,7 @@ Handlebars.JavaScriptCompiler = function() {};
|
||||
},
|
||||
|
||||
pushStackLiteral: function(item) {
|
||||
return this.pushStack(new Literal(item), true);
|
||||
return this.push(new Literal(item));
|
||||
},
|
||||
|
||||
pushStack: function(item, inline) {
|
||||
@@ -988,7 +988,7 @@ Handlebars.JavaScriptCompiler = function() {};
|
||||
// Get or create the current stack name for use by the inline
|
||||
var name = this.stackSlot ? this.topStackName() : this.incrStack();
|
||||
|
||||
prefix = '(' + this.pushStack(name, true) + ' = ' + top + '),';
|
||||
prefix = '(' + this.push(name) + ' = ' + top + '),';
|
||||
stack = this.topStack();
|
||||
}
|
||||
} else {
|
||||
@@ -1001,7 +1001,7 @@ Handlebars.JavaScriptCompiler = function() {};
|
||||
if (this.inlineStack.length || this.compileStack.length) {
|
||||
this.popStack();
|
||||
}
|
||||
this.pushStack('(' + prefix + item + ')', true);
|
||||
this.push('(' + prefix + item + ')');
|
||||
} else {
|
||||
// Prevent modification of the context depth variable. Through replaceStack
|
||||
if (!/^stack/.test(stack)) {
|
||||
|
||||
Reference in New Issue
Block a user