Use x = a[y] || b[y] rather than if exists lookup
This commit is contained in:
@@ -476,17 +476,15 @@ Handlebars.JavaScriptCompiler = function() {};
|
||||
if(name) {
|
||||
var topStack = this.nextStack();
|
||||
|
||||
var lookupScoped = topStack + " = " + this.nameLookup('currentContext', name, 'context'),
|
||||
toPush;
|
||||
var toPush;
|
||||
|
||||
if (isScoped) {
|
||||
toPush = lookupScoped;
|
||||
toPush = topStack + " = " + this.nameLookup('currentContext', name, 'context');
|
||||
} else {
|
||||
toPush = "if('" + name + "' in helpers) { " + topStack +
|
||||
" = " + this.nameLookup('helpers', name, 'helper') +
|
||||
"; } else { " +
|
||||
lookupScoped +
|
||||
"; }";
|
||||
toPush = topStack + " = "
|
||||
+ this.nameLookup('helpers', name, 'helper')
|
||||
+ " || "
|
||||
+ this.nameLookup('currentContext', name, 'context');
|
||||
}
|
||||
|
||||
this.source.push(toPush);
|
||||
|
||||
Reference in New Issue
Block a user