diff options
Diffstat (limited to 'lib/handlebars/compiler/ast.js')
-rw-r--r-- | lib/handlebars/compiler/ast.js | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/lib/handlebars/compiler/ast.js b/lib/handlebars/compiler/ast.js index 850c605..c178960 100644 --- a/lib/handlebars/compiler/ast.js +++ b/lib/handlebars/compiler/ast.js @@ -67,21 +67,24 @@ Handlebars.AST.HashNode = function(pairs) { Handlebars.AST.IdNode = function(parts) { this.type = "ID"; - this.original = parts.join("."); - var dig = [], depth = 0; + var original = "", + dig = [], + depth = 0; for(var i=0,l=parts.length; i<l; i++) { - var part = parts[i]; + var part = parts[i].part; + original += (parts[i].separator || '') + part; if (part === ".." || part === "." || part === "this") { - if (dig.length > 0) { throw new Handlebars.Exception("Invalid path: " + this.original); } + if (dig.length > 0) { throw new Handlebars.Exception("Invalid path: " + original); } else if (part === "..") { depth++; } else { this.isScoped = true; } } else { dig.push(part); } } + this.original = original; this.parts = dig; this.string = dig.join('.'); this.depth = depth; @@ -105,13 +108,15 @@ Handlebars.AST.DataNode = function(id) { Handlebars.AST.StringNode = function(string) { this.type = "STRING"; - this.string = string; - this.stringModeValue = string; + this.original = + this.string = + this.stringModeValue = string; }; Handlebars.AST.IntegerNode = function(integer) { this.type = "INTEGER"; - this.integer = integer; + this.original = + this.integer = integer; this.stringModeValue = Number(integer); }; |