refactor(ast): declare enum inheritance with INHERIT#23953
Conversation
Merging this PR will not alter performance
Comparing Footnotes
|
|
@claude review |
Merge activity
|
4d05d3e to
7af6a70
Compare
Change the syntax used to declare that one enum inherits the variants from another.
Before:
```rust
enum Expression<'a> {
// ... own variants ...
@inherit MemberExpression
}
```
After:
```rust
enum Expression<'a> {
// ... own variants ...
INHERIT(MemberExpression<'a>),
}
```
Reason for this change is that the latter is valid Rust code, and can be parsed normally by Rust compiler and `syn`.
This removes the need for custom parsing logic in `ast_tools` - now we can just use `syn`'s standard parser for enums.
The downside it that this complicates the `inherit_variants!` macro - this PR reimplements it as a TT-muncher. But this macro is removed entirely in a later PR (#23960).
No change to behavior - only affects _how_ inheritance is declared, not how it works.
107bd64 to
2616fc6
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. 🚀 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Change the syntax used to declare that one enum inherits the variants from another.
Before:
```rust
enum Expression<'a> {
// ... own variants ...
@inherit MemberExpression
}
```
After:
```rust
enum Expression<'a> {
// ... own variants ...
INHERIT(MemberExpression<'a>),
}
```
Reason for this change is that the latter is valid Rust code, and can be parsed normally by Rust compiler and `syn`.
This removes the need for custom parsing logic in `ast_tools` - now we can just use `syn`'s standard parser for enums.
The downside it that this complicates the `inherit_variants!` macro - this PR reimplements it as a TT-muncher. But this macro is removed entirely in a later PR (#23960).
No change to behavior - only affects _how_ inheritance is declared, not how it works.
7af6a70 to
e6d6e5a
Compare
2616fc6 to
35c71e3
Compare
Change the syntax used to declare that one enum inherits the variants from another.
Before:
```rust
enum Expression<'a> {
// ... own variants ...
@inherit MemberExpression
}
```
After:
```rust
enum Expression<'a> {
// ... own variants ...
INHERIT(MemberExpression<'a>),
}
```
Reason for this change is that the latter is valid Rust code, and can be parsed normally by Rust compiler and `syn`.
This removes the need for custom parsing logic in `ast_tools` - now we can just use `syn`'s standard parser for enums.
The downside it that this complicates the `inherit_variants!` macro - this PR reimplements it as a TT-muncher. But this macro is removed entirely in a later PR (#23960).
No change to behavior - only affects _how_ inheritance is declared, not how it works.

Change the syntax used to declare that one enum inherits the variants from another.
Before:
After:
Reason for this change is that the latter is valid Rust code, and can be parsed normally by Rust compiler and
syn.This removes the need for custom parsing logic in
ast_tools- now we can just usesyn's standard parser for enums.The downside it that this complicates the
inherit_variants!macro - this PR reimplements it as a TT-muncher. But this macro is removed entirely in a later PR (#23960).No change to behavior - only affects how inheritance is declared, not how it works.