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 09bf927..002fd3b 100644 --- a/lib/handlebars/compiler/ast.js +++ b/lib/handlebars/compiler/ast.js @@ -106,12 +106,12 @@ var AST = { }, BlockNode: function(mustache, program, inverse, close, locInfo) { + LocationInfo.call(this, locInfo); + if(mustache.sexpr.id.original !== close.path.original) { - throw new Exception(mustache.sexpr.id.original + " doesn't match " + close.path.original); + throw new Exception(mustache.sexpr.id.original + " doesn't match " + close.path.original, this); } - LocationInfo.call(this, locInfo); - this.type = 'block'; this.mustache = mustache; this.program = program; @@ -155,11 +155,16 @@ var AST = { original += (parts[i].separator || '') + part; if (part === ".." || part === "." || part === "this") { - if (dig.length > 0) { throw new Exception("Invalid path: " + original); } - else if (part === "..") { depth++; } - else { this.isScoped = true; } + if (dig.length > 0) { + throw new Exception("Invalid path: " + original, this); + } else if (part === "..") { + depth++; + } else { + this.isScoped = true; + } + } else { + dig.push(part); } - else { dig.push(part); } } this.original = original; |