diff options
author | kpdecker <kpdecker@gmail.com> | 2013-01-19 12:15:43 -0600 |
---|---|---|
committer | kpdecker <kpdecker@gmail.com> | 2013-01-19 12:15:43 -0600 |
commit | 247babbe1a8509637fec62aeefeae562d52cc0ca (patch) | |
tree | e24c8bcefada4e3f7408b59b28b0a6219a2fab48 /lib/handlebars/compiler/compiler.js | |
parent | b1ea697b7d4bc887ea38352dbe0f028968c5387b (diff) | |
download | handlebars.js-247babbe1a8509637fec62aeefeae562d52cc0ca.zip handlebars.js-247babbe1a8509637fec62aeefeae562d52cc0ca.tar.gz handlebars.js-247babbe1a8509637fec62aeefeae562d52cc0ca.tar.bz2 |
Empty hash literal output
Diffstat (limited to 'lib/handlebars/compiler/compiler.js')
-rw-r--r-- | lib/handlebars/compiler/compiler.js | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/handlebars/compiler/compiler.js b/lib/handlebars/compiler/compiler.js index 44228d6..e25e826 100644 --- a/lib/handlebars/compiler/compiler.js +++ b/lib/handlebars/compiler/compiler.js @@ -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('{}'); |