summaryrefslogtreecommitdiffstats
path: root/lib/handlebars/compiler/compiler.js
diff options
context:
space:
mode:
authorkpdecker <kpdecker@gmail.com>2013-01-19 11:39:23 -0600
committerkpdecker <kpdecker@gmail.com>2013-01-19 11:39:23 -0600
commitb1ea697b7d4bc887ea38352dbe0f028968c5387b (patch)
tree7d2c1c47babafc401e86499ad38c827e5abce283 /lib/handlebars/compiler/compiler.js
parent822d98a1ef3095a1c8337ad8ee0708b9fadf0b64 (diff)
downloadhandlebars.js-b1ea697b7d4bc887ea38352dbe0f028968c5387b.zip
handlebars.js-b1ea697b7d4bc887ea38352dbe0f028968c5387b.tar.gz
handlebars.js-b1ea697b7d4bc887ea38352dbe0f028968c5387b.tar.bz2
Inline foundHelper lookup
Diffstat (limited to 'lib/handlebars/compiler/compiler.js')
-rw-r--r--lib/handlebars/compiler/compiler.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/handlebars/compiler/compiler.js b/lib/handlebars/compiler/compiler.js
index 9cdf250..44228d6 100644
--- a/lib/handlebars/compiler/compiler.js
+++ b/lib/handlebars/compiler/compiler.js
@@ -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 + '; }');
},