@@ -369,7 +369,7 @@ JavaScriptCompiler.prototype = {
|
||||
return ' != null ? ' + lookup + ' : ' + current;
|
||||
} else {
|
||||
// Otherwise we can use generic falsy handling
|
||||
return ' != null && ' + lookup;
|
||||
return (falsy ? ' && ' : ' != null && ') + lookup;
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
@@ -527,19 +527,18 @@ JavaScriptCompiler.prototype = {
|
||||
// and pushes the helper's return value onto the stack.
|
||||
//
|
||||
// If the helper is not found, `helperMissing` is called.
|
||||
invokeHelper: function(paramSize, name, isRoot) {
|
||||
invokeHelper: function(paramSize, name, isSimple, isRoot) {
|
||||
this.aliases.helperMissing = 'helpers.helperMissing';
|
||||
this.useRegister('helper');
|
||||
|
||||
var nonHelper = this.popStack();
|
||||
var helper = this.setupHelper(paramSize, name);
|
||||
|
||||
var lookup = 'helper = ' + helper.name + ' || ' + nonHelper + ' || helperMissing';
|
||||
var lookup = (isSimple ? helper.name + ' || ' : '') + nonHelper + ' || helperMissing';
|
||||
if (helper.paramsInit) {
|
||||
lookup += ',' + helper.paramsInit;
|
||||
}
|
||||
|
||||
this.push('(' + lookup + ',helper.call(' + helper.callParams + '))');
|
||||
this.push('((' + lookup + ').call(' + helper.callParams + '))');
|
||||
|
||||
// Always flush subexpressions. This is both to prevent the compounding size issue that
|
||||
// occurs when the code has to be duplicated for inlining and also to prevent errors
|
||||
|
||||
Reference in New Issue
Block a user