summaryrefslogtreecommitdiffstats
path: root/lib/handlebars/compiler/javascript-compiler.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/handlebars/compiler/javascript-compiler.js')
-rw-r--r--lib/handlebars/compiler/javascript-compiler.js18
1 files changed, 7 insertions, 11 deletions
diff --git a/lib/handlebars/compiler/javascript-compiler.js b/lib/handlebars/compiler/javascript-compiler.js
index fcd58fd..e53b4f2 100644
--- a/lib/handlebars/compiler/javascript-compiler.js
+++ b/lib/handlebars/compiler/javascript-compiler.js
@@ -50,7 +50,7 @@ JavaScriptCompiler.prototype = {
compile: function(environment, options, context, asObject) {
this.environment = environment;
- this.options = options || {};
+ this.options = options;
this.stringParams = this.options.stringParams;
this.trackIds = this.options.trackIds;
this.precompile = !asObject;
@@ -361,9 +361,9 @@ JavaScriptCompiler.prototype = {
return ' != null ? ' + lookup + ' : ' + current;
} else {
// Otherwise we can use generic falsy handling
- return (falsy ? ' && ' : ' != null && ') + lookup;
+ return ' && ' + lookup;
}
- }, true);
+ });
}
},
@@ -385,7 +385,7 @@ JavaScriptCompiler.prototype = {
for (var i = 0; i < len; i++) {
this.replaceStack(function(current) {
return ' && ' + this.nameLookup(current, parts[i], 'data');
- }, true);
+ });
}
},
@@ -714,7 +714,7 @@ JavaScriptCompiler.prototype = {
return stack;
},
- replaceStack: function(callback, chain) {
+ replaceStack: function(callback) {
var prefix = '',
inline = this.isInline(),
stack,
@@ -731,18 +731,14 @@ JavaScriptCompiler.prototype = {
if (top instanceof Literal) {
// Literals do not need to be inlined
- stack = top.value;
+ prefix = stack = top.value;
usedLiteral = true;
-
- if (chain) {
- prefix = stack;
- }
} else {
// Get or create the current stack name for use by the inline
createdStack = !this.stackSlot;
var name = !createdStack ? this.topStackName() : this.incrStack();
- prefix = '(' + this.push(name) + ' = ' + top + (chain ? ')' : '),');
+ prefix = '(' + this.push(name) + ' = ' + top + ')';
stack = this.topStack();
}