-
Notifications
You must be signed in to change notification settings - Fork 586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Source maps #138
Source maps #138
Conversation
Seems you have quite a few unrelated fixes in here? Also really need to get some tests in for the new stuff. |
The other commits are the content of #115 - without them, the source maps are basically useless as there's no line/column information on a lot of exceptions. I know it needs tests, and they'll come eventually... Luckily I don't think anyone's in a hurry to merge this quite yet! |
This is rebased on master now, and significantly less noisy as a result. I still need to put together tests and such, and I've uncovered a couple of bugs in this particular sourcemap library, so we might have to fork/adopt it. |
7bc1d19
to
3f9c2cf
Compare
fe51a96
to
d81f2d6
Compare
I finally ended up getting this tested etc. Now that I look at it again though, I'm not a huge fan of all the |
2b7b635
to
fce553f
Compare
Okay, everything is squashed down and the API is much nicer now. This is pretty much ready to go. |
This patch implements source map support in the parser, the runtime, the script record, and the stack trace printing. The library used to parse and use the source maps is gopkg.in/sourcemap.v1. Unlike earlier versions of this patch, the consumer of otto does not need parse the source map on their own - it's now handled similarly to parsing JavaScript content. To use a source map, the consumer must explicitly parse their source into a `Script` object with `Otto.CompileWithSourceMap`. The script record returned from that call will carry source map information with it, and all location-related functions should reflect the original source positions.
I'd really like to get this into master soon. Everything appears to work okay, and it doesn't break any of the existing API or tests. If nobody comes forward to tell me this is broken in the next few days, I'm going to merge it into master. |
This is pretty rough at the moment, but I plan to clean it up and figure out some tests for it.