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

Restructure the HIR to use indices for nested declarations #44

Open
fmease opened this issue Nov 19, 2020 · 0 comments
Open

Restructure the HIR to use indices for nested declarations #44

fmease opened this issue Nov 19, 2020 · 0 comments
Labels
A-name-resolution Area: Name resolution A-type-system Area: Type system T-enhancement Type: Enhancement

Comments

@fmease
Copy link
Owner

fmease commented Nov 19, 2020

Instead of having hir::Declarations inside hir::{Module, Data}, use HIRIndex/HIRIdentifier and store all declarations linearly in CrateScope. This would make iterating over declarations easier. We can and should then also store the parent for each declaration.
This would get rid of our Index/Environment "hack" in the typer (and resolver(?)) we currently require in some cases for handling constructors and need some data from the parent data declaration — in the new system, we can simply look up the parent by HIRIndex (plus some "downcasting"). Maybe this would also allow us to throw out the typer::Registration system by just having a list of those indices. I don't know.

This might also help finding unused declarations, implementing privacy and printing relative paths but maybe it does not but only if we also do this change to lowered_ast::Declaration b.c. the resolver needs it. I dunno.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-name-resolution Area: Name resolution A-type-system Area: Type system T-enhancement Type: Enhancement
Projects
None yet
Development

No branches or pull requests

1 participant