Inline foundHelper lookup
This commit is contained in:
@@ -763,9 +763,9 @@ Handlebars.JavaScriptCompiler = function() {};
|
||||
this.context.aliases.helperMissing = 'helpers.helperMissing';
|
||||
|
||||
var helper = this.lastHelper = this.setupHelper(paramSize, name);
|
||||
this.register('foundHelper', helper.name);
|
||||
this.useRegister('foundHelper');
|
||||
|
||||
this.pushStack("foundHelper ? foundHelper.call(" +
|
||||
this.pushStack("(foundHelper = " + helper.name + ") ? foundHelper.call(" +
|
||||
helper.callParams + ") " + ": helperMissing.call(" +
|
||||
helper.helperMissingParams + ")");
|
||||
},
|
||||
@@ -801,12 +801,12 @@ Handlebars.JavaScriptCompiler = function() {};
|
||||
var helper = this.setupHelper(0, name);
|
||||
|
||||
var helperName = this.lastHelper = this.nameLookup('helpers', name, 'helper');
|
||||
this.register('foundHelper', helperName);
|
||||
this.useRegister('foundHelper');
|
||||
|
||||
var nonHelper = this.nameLookup('depth' + this.lastContext, name, 'context');
|
||||
var nextStack = this.nextStack();
|
||||
|
||||
this.source.push('if (foundHelper) { ' + nextStack + ' = foundHelper.call(' + helper.callParams + '); }');
|
||||
this.source.push('if (foundHelper = ' + helperName + ') { ' + nextStack + ' = foundHelper.call(' + helper.callParams + '); }');
|
||||
this.source.push('else { ' + nextStack + ' = ' + nonHelper + '; ' + nextStack + ' = typeof ' + nextStack + ' === functionType ? ' + nextStack + '.apply(depth0) : ' + nextStack + '; }');
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user