summaryrefslogtreecommitdiffstats
path: root/lib/handlebars/compiler/compiler.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/handlebars/compiler/compiler.js')
-rw-r--r--lib/handlebars/compiler/compiler.js14
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/handlebars/compiler/compiler.js b/lib/handlebars/compiler/compiler.js
index d7ff3a7..613fbd3 100644
--- a/lib/handlebars/compiler/compiler.js
+++ b/lib/handlebars/compiler/compiler.js
@@ -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);