diff --git a/lib/handlebars/compiler/ast.js b/lib/handlebars/compiler/ast.js index 459b8636f..a8a684464 100644 --- a/lib/handlebars/compiler/ast.js +++ b/lib/handlebars/compiler/ast.js @@ -88,6 +88,8 @@ var Handlebars = require('./base'); // an ID is simple if it only has one part, and that part is not // `..` or `this`. this.isSimple = parts.length === 1 && !this.isScoped && depth === 0; + + this.stringModeValue = this.string; }; Handlebars.AST.PartialNameNode = function(name) { @@ -103,16 +105,19 @@ var Handlebars = require('./base'); Handlebars.AST.StringNode = function(string) { this.type = "STRING"; this.string = string; + this.stringModeValue = string; }; Handlebars.AST.IntegerNode = function(integer) { this.type = "INTEGER"; this.integer = integer; + this.stringModeValue = Number(integer); }; Handlebars.AST.BooleanNode = function(bool) { this.type = "BOOLEAN"; this.bool = bool; + this.stringModeValue = Boolean(bool); }; Handlebars.AST.CommentNode = function(comment) { diff --git a/lib/handlebars/compiler/compiler.js b/lib/handlebars/compiler/compiler.js index 48a3db51e..e1bc01b74 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('pushLiteral', '{}'); + this.opcode('pushHash'); 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('pushLiteral', '{}'); + this.opcode('pushHash'); this.opcode('ambiguousBlockValue'); } @@ -148,13 +148,18 @@ Handlebars.JavaScriptCompiler = function() {}; hash: function(hash) { var pairs = hash.pairs, pair, val; - this.opcode('push', '{}'); + this.opcode('pushHash'); for(var i=0, l=pairs.length; i