Skip to content
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

Merged
merged 1 commit into from
May 7, 2016
Merged

Source maps #138

merged 1 commit into from
May 7, 2016

Conversation

deoxxa
Copy link
Collaborator

@deoxxa deoxxa commented Oct 29, 2015

This is pretty rough at the moment, but I plan to clean it up and figure out some tests for it.

@stevenh
Copy link
Collaborator

stevenh commented Oct 30, 2015

Seems you have quite a few unrelated fixes in here?

Also really need to get some tests in for the new stuff.

@deoxxa
Copy link
Collaborator Author

deoxxa commented Oct 30, 2015

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!

@deoxxa
Copy link
Collaborator Author

deoxxa commented Dec 5, 2015

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.

@deoxxa
Copy link
Collaborator Author

deoxxa commented Apr 28, 2016

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 WithSourceMap functions. Anyone got any ideas to make this less ugly? Preferably without breaking any of the existing API.

@deoxxa deoxxa force-pushed the source-maps branch 2 times, most recently from 2b7b635 to fce553f Compare April 30, 2016 05:18
@deoxxa
Copy link
Collaborator Author

deoxxa commented Apr 30, 2016

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.
@deoxxa
Copy link
Collaborator Author

deoxxa commented May 2, 2016

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.

@deoxxa deoxxa merged commit 3a69c44 into robertkrimen:master May 7, 2016
@deoxxa deoxxa deleted the source-maps branch May 7, 2016 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants