diff options
author | kpdecker <kpdecker@gmail.com> | 2014-11-26 09:01:03 -0600 |
---|---|---|
committer | kpdecker <kpdecker@gmail.com> | 2014-11-26 09:01:03 -0600 |
commit | 61dd721ca2a9055036d0f350970d033ca5227411 (patch) | |
tree | 398a184db4673792629973a3b11d9a46aa108bb0 /lib/handlebars/exception.js | |
parent | 3a9440f954092558275cd4c05a35ba34bcbfa210 (diff) | |
download | handlebars.js-61dd721ca2a9055036d0f350970d033ca5227411.zip handlebars.js-61dd721ca2a9055036d0f350970d033ca5227411.tar.gz handlebars.js-61dd721ca2a9055036d0f350970d033ca5227411.tar.bz2 |
Update AST location info to match SpiderMonkey
Part of #889
Diffstat (limited to 'lib/handlebars/exception.js')
-rw-r--r-- | lib/handlebars/exception.js | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/handlebars/exception.js b/lib/handlebars/exception.js index 8c5c2f6..3fde1c1 100644 --- a/lib/handlebars/exception.js +++ b/lib/handlebars/exception.js @@ -2,11 +2,14 @@ var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack']; function Exception(message, node) { - var line; - if (node && node.firstLine) { - line = node.firstLine; - - message += ' - ' + line + ':' + node.firstColumn; + var loc = node && node.loc, + line, + column; + if (loc) { + line = loc.start.line; + column = loc.start.column; + + message += ' - ' + line + ':' + column; } var tmp = Error.prototype.constructor.call(this, message); @@ -16,9 +19,9 @@ function Exception(message, node) { this[errorProps[idx]] = tmp[errorProps[idx]]; } - if (line) { + if (loc) { this.lineNumber = line; - this.column = node.firstColumn; + this.column = column; } } |