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/compiler/base.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/compiler/base.js')
-rw-r--r-- | lib/handlebars/compiler/base.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/handlebars/compiler/base.js b/lib/handlebars/compiler/base.js index 1378463..df6b928 100644 --- a/lib/handlebars/compiler/base.js +++ b/lib/handlebars/compiler/base.js @@ -8,11 +8,16 @@ export { parser }; var yy = {}; extend(yy, Helpers, AST); -export function parse(input) { +export function parse(input, options) { // Just return if an already-compile AST was passed in. if (input.constructor === AST.ProgramNode) { return input; } parser.yy = yy; + // Altering the shared object here, but this is ok as parser is a sync operation + yy.locInfo = function(locInfo) { + return new yy.SourceLocation(options && options.srcName, locInfo); + }; + return parser.parse(input); } |