-
-
Notifications
You must be signed in to change notification settings - Fork 315
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
Get the span of an Expr #267
Comments
No, currently there is no easy way to extract the span of an individual AST node, as spans are only stored on the tokens at the leafs of the AST. It might be possible in the future to add a |
I started to write such a function here even though it is not completely accurate (I don't merge |
I think we would probably want to generate that function, if we decided we wanted it, behind a feature flag and using syn_codegen so we can avoid manually writing large error-prone match statements. cc @dtolnay to see if we'd want to have something like that in syn behind a feature gate (I'm imagining we'd add some sort of #span attributes to some fields, or something like that, which would tell the codegen which fields to pull spans out of) |
Seems reasonable! I like the idea of the implementations being generated. |
This has been added in |
Hi, I have a question regarding this issue - If I run So far so good, however it's not clear to me how to use |
Hi.
Is there an easy way to get the Span of an Expr?
That is without having to use pattern matching on node and getting the span manually.
Thank you.
The text was updated successfully, but these errors were encountered: