Output options only once to unknownHelper case
This commit is contained in:
@@ -769,7 +769,7 @@ Handlebars.JavaScriptCompiler = function() {};
|
||||
invokeHelper: function(paramSize, name) {
|
||||
this.context.aliases.helperMissing = 'helpers.helperMissing';
|
||||
|
||||
var helper = this.lastHelper = this.setupHelper(paramSize, name);
|
||||
var helper = this.lastHelper = this.setupHelper(paramSize, name, true);
|
||||
this.useRegister('foundHelper');
|
||||
|
||||
this.pushStack("(foundHelper = " + helper.name + ") ? foundHelper.call(" +
|
||||
@@ -980,22 +980,22 @@ Handlebars.JavaScriptCompiler = function() {};
|
||||
.replace(/\r/g, '\\r') + '"';
|
||||
},
|
||||
|
||||
setupHelper: function(paramSize, name) {
|
||||
setupHelper: function(paramSize, name, missingParams) {
|
||||
var params = [];
|
||||
this.setupParams(paramSize, params);
|
||||
this.setupParams(paramSize, params, missingParams);
|
||||
var foundHelper = this.nameLookup('helpers', name, 'helper');
|
||||
|
||||
return {
|
||||
params: params,
|
||||
name: foundHelper,
|
||||
callParams: ["depth0"].concat(params).join(", "),
|
||||
helperMissingParams: ["depth0", this.quotedString(name)].concat(params).join(", ")
|
||||
helperMissingParams: missingParams && ["depth0", this.quotedString(name)].concat(params).join(", ")
|
||||
};
|
||||
},
|
||||
|
||||
// the params and contexts arguments are passed in arrays
|
||||
// to fill in
|
||||
setupParams: function(paramSize, params) {
|
||||
setupParams: function(paramSize, params, useRegister) {
|
||||
var options = [], contexts = [], types = [], param, inverse, program;
|
||||
|
||||
options.push("hash:" + this.popStack());
|
||||
@@ -1040,7 +1040,13 @@ Handlebars.JavaScriptCompiler = function() {};
|
||||
options.push("data:data");
|
||||
}
|
||||
|
||||
params.push("{" + options.join(",") + "}");
|
||||
options = "{" + options.join(",") + "}";
|
||||
if (useRegister) {
|
||||
this.register('options', options);
|
||||
params.push('options');
|
||||
} else {
|
||||
params.push(options);
|
||||
}
|
||||
return params.join(", ");
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user