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

add optional SourceLocation to Node interface #7

merged 1 commit into from Dec 29, 2014


Copy link

michaelficarra commented Dec 25, 2014

/cc @josh

Copy link

josh commented Dec 25, 2014


I guess Comment nodes are the only thing left on my 🎄 wishlist 😉

Copy link
Member Author

michaelficarra commented Dec 27, 2014

Quoting myself from Twitter:

Unlikely to be attached to the AST. Everyone wants different placement. A parser is free to output side tables with CST info.

I strongly feel that it is not the parser's job to determine the node to which a comment gets attached. In recent conversations with @ariya, he has agreed. Esprima bundling comment attachment, choosing an algorithm for you, was a bad idea. I believe we should leave the decision of how to handle this up to the parsers themselves, and I recommend they simply expose the insignificant syntax in a side-table (or two) along with their source offsets. Then consumers can handle the association themselves.

Copy link
Member Author

michaelficarra commented Dec 29, 2014

Merging, since there have been no objections and I want to get started adding this feature to the parser.

michaelficarra added a commit that referenced this pull request Dec 29, 2014
add optional SourceLocation to Node interface
@michaelficarra michaelficarra merged commit 042ed27 into master Dec 29, 2014
@michaelficarra michaelficarra deleted the source-location branch Jan 22, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.