oxc-project / oxc-project/backlog
Add explicit discriminants to all enums in `#[ast]` macro
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 7
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
oxc-project/oxc#4614 made all AST types #[repr(C)]. To complete the work of making everything about the AST's in-memory representation predictable and guaranteed, we need to add explicit discriminants to all enums.
We can do this in the #[ast] macro rather than writing them out by hand. I think we can consider enum discriminants as an internal implementation detail, which does not need to be visible from reading the type defs. The discriminants we set will be the same as Rust compiler would set anyway.
e.g.:
#[ast]
pub enum PropertyKind {
Init = 0,
Get = 1,
Set = 2,
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the #[ast] macro implementation and trace how it processes enum definitions. Check the PropertyKind example against the macro's generated representation, then verify that every enum handled by the macro receives explicit discriminants matching Rust's default values. The issue names no specific files or tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100