Accessing constant expressions from implicit types in the AST #1340
Replies: 2 comments
-
|
You can still get the syntax node for the variable declaration, and then within that syntax node should be the type syntax. There isn't a good way to get the resolved AST Expression inside the type declaration though. Probably nothing stops you from re-binding the Expression object once you have that type syntax though, which is maybe good enough. |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Thanks for the clarification. For my use case, it seems I should work from the syntax tree and manually rebind the type expressions to collect symbols. I will proceed in this direction. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I have a question about accessing constant expressions from implicit types in the final AST.
For example, if I have something like
logic [WIDTH-1:0] my_var;, it seems that in the final AST, there is no longer a way to retrieve the original constant expression/range or the symbol references inside the type. I understand that this is reasonable from a compiler perspective, since what ultimately matters is the resolved type.However, for tooling like language servers or formatters, it would be very useful to still have access to the original constant expression from the AST. In my case, I need to be able to resolve symbols like WIDTH even if they only appear inside a constant expression within an implicit type.
I was wondering if there is currently a way to retrieve this information, or if you would consider allowing the AST to optionally preserve the original constant expression.
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions