-
Notifications
You must be signed in to change notification settings - Fork 154
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
Parser options for either name_locs or names #1407
Comments
@jemmaissroff I had suggested the notion of a profile between the two use-cases back when we discussed how syntax tools want offsets but compilers want line number. The linting use case wants original source in memory and the compiler doesn't. There are a number of different preferences between the two use-cases. It feels like two tools which overlap 80% trying to consume the same format. |
Related to #807, which aims to remove all location fields for serialization and Java nodes (but keep start+length on the node itself, I consider that a different concern and TruffleRuby needs those anyway).
Could maybe be useful to do the same for C structs too but that seems far more involved as e.g. A more immediate gain for shrinking C structs could be to change |
Unfortunately a tool like rubocop needs both (I found out the hard way through https://github.com/kddnewton/parser-prism. I think since we're now not serialization the locations for JRuby/TruffleRuby and we could instead shrink the location struct, I think I'd like to close this one as not planned. |
Some nodes (eg
ClassVariableAndWriteNode
) have both aname
field and aname_loc
field. These are because it's helpful for some consumers (eg linters) to have the location, while it's helpful for other consumers (eg compilers) to have the name itself. Consumers need one, not both.We could eventually expose a way for consumers to specify which field type they need. This would reduce overall memory impact of the parse tree by not storing all of these fields twice.
This isn't necessary for V1, and is most helpful if we decide to reduce memory since it'll introduce some otherwise unnecessary complexity.
The text was updated successfully, but these errors were encountered: