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

Constructible / modifiable HIR #593

Closed
5 tasks
goto-bus-stop opened this issue Jul 14, 2023 · 4 comments
Closed
5 tasks

Constructible / modifiable HIR #593

goto-bus-stop opened this issue Jul 14, 2023 · 4 comments
Assignees
Labels
apollo-compiler issues/PRs pertaining to semantic analysis & validation

Comments

@goto-bus-stop
Copy link
Member

Supersedes #590, and likely #580.

To unify the hir/encoder types, HIR types should be constructible. To modify documents (#420), the HIR is likely the nicest level to do it at (vs the low-level parser AST).

So the rough plan is:

  • make the HIR nodes constructible (prob just add builders with buildstructor)
  • have the whole HIR have one root node, so you can clone + modify a HIR
  • add a serialization API to the HIR so you can use it instead of apollo-encoder
  • add some basic modification methods for eg. adding fields or removing directives
  • later integrate it with salsa possibly using a schema diff format??
@goto-bus-stop goto-bus-stop added the apollo-compiler issues/PRs pertaining to semantic analysis & validation label Jul 14, 2023
@goto-bus-stop goto-bus-stop self-assigned this Jul 14, 2023
@goto-bus-stop
Copy link
Member Author

A pretty big issue i'm running into with having a single root node at the moment is that it more or less guarantees that there will be multiple Arcs pointing at the same definition nodes. That makes modifying them non-obvious, you can't just do Arc::get_mut() with multiple pointees and having a ton of mutexes in the hir seems quite bad/heavy weight.

@goto-bus-stop
Copy link
Member Author

goto-bus-stop commented Aug 14, 2023

Our wording evolved a bit, so the issue is a bit outdated, as we are looking at having both a constructible HIR and a constructible "MIR". I'll keep it like this for now as we are still designing the higher level parts. Simon made a lot of progress on this branch: https://github.com/apollographql/apollo-rs/tree/mir

@SimonSapin
Copy link
Contributor

I think we can consider this done, with the release of apollo-compiler 1.0 beta: https://docs.rs/apollo-compiler/1.0.0-beta.1/

@SimonSapin
Copy link
Contributor

This was sort of a duplicate of #420

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
apollo-compiler issues/PRs pertaining to semantic analysis & validation
Projects
None yet
Development

No branches or pull requests

2 participants