Empty hash literal output

This commit is contained in:
kpdecker
2013-01-19 12:15:43 -06:00
parent b1ea697b7d
commit 247babbe1a
+11 -4
View File
@@ -129,7 +129,7 @@ Handlebars.JavaScriptCompiler = function() {};
// evaluate it by executing `blockHelperMissing`
this.opcode('pushProgram', program);
this.opcode('pushProgram', inverse);
this.opcode('pushHash');
this.opcode('emptyHash');
this.opcode('blockValue');
} else {
this.ambiguousMustache(mustache, program, inverse);
@@ -138,7 +138,7 @@ Handlebars.JavaScriptCompiler = function() {};
// evaluate it by executing `blockHelperMissing`
this.opcode('pushProgram', program);
this.opcode('pushProgram', inverse);
this.opcode('pushHash');
this.opcode('emptyHash');
this.opcode('ambiguousBlockValue');
}
@@ -343,7 +343,7 @@ Handlebars.JavaScriptCompiler = function() {};
if(mustache.hash) {
this.hash(mustache.hash);
} else {
this.opcode('pushHash');
this.opcode('emptyHash');
}
return params;
@@ -360,7 +360,7 @@ Handlebars.JavaScriptCompiler = function() {};
if(mustache.hash) {
this.hash(mustache.hash);
} else {
this.opcode('pushHash');
this.opcode('emptyHash');
}
return params;
@@ -694,6 +694,13 @@ Handlebars.JavaScriptCompiler = function() {};
}
},
emptyHash: function() {
this.pushStackLiteral('{}');
if (this.options.stringParams) {
this.register('hashTypes', '{}');
}
},
pushHash: function() {
this.push('{}');