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

Register location of name in TModel #13

Open
toinehartman opened this issue Feb 12, 2025 · 1 comment
Open

Register location of name in TModel #13

toinehartman opened this issue Feb 12, 2025 · 1 comment

Comments

@toinehartman
Copy link

For rename refactoring (and possibly other applications), we need to find the exact location of names to rename. In the case of definitions, we only have the location of the whole definition (e.g. function annotations+signature+body). The name is contained in the signature and analysis of the parse tree is required to find its exact location.

It would be very helpful if a TModel maps definition locations to locations of their names. This should be done in a backwards-compatible manner, so existing type checkers or code consuming TModels do not break.

@toinehartman
Copy link
Author

Currently, the define functions take a string for the definition name. One solution is to accept a value here, match on str or Tree, and extract the location of the name in case it is a Tree. A map[loc, loc] or rel[loc, loc] mapping definition locations to names could be added to the TModel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant