-
-
Notifications
You must be signed in to change notification settings - Fork 503
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
feat(ast_tools): allow defining foreign types with #[ast(foreign = ...)]
#8866
Merged
graphite-app
merged 1 commit into
main
from
02-03-feat_ast_tools_allow_defining_foreign_types_with_ast_foreign_._
Feb 4, 2025
Merged
feat(ast_tools): allow defining foreign types with #[ast(foreign = ...)]
#8866
graphite-app
merged 1 commit into
main
from
02-03-feat_ast_tools_allow_defining_foreign_types_with_ast_foreign_._
Feb 4, 2025
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This was referenced Feb 3, 2025
This was referenced Feb 3, 2025
a9d48f2
to
3fd392f
Compare
bd2f2e1
to
482836b
Compare
This was referenced Feb 3, 2025
3fd392f
to
c5841cf
Compare
482836b
to
dc0a998
Compare
This was referenced Feb 3, 2025
c5841cf
to
7b2a5a2
Compare
dc0a998
to
534c4f8
Compare
Merge activity
|
…..)]` (#8866) Allow informing `oxc_ast_tools` about foreign types in AST (e.g. `NonMaxU32`) and other types which it otherwise can't parse (e.g. `RegExpFlags`, which is generated by `bitflags!` macro). Mechanism is `#[ast(foreign = ...)]` attr on another type which acts as a "stand-in" for the real one, similar to `serde`'s [remote derive feature](https://serde.rs/remote-derive.html). ```rs bitflags! { pub struct RegExpFlags: u8 { /* ... */ } } /// This dummy type tells `oxc_ast_tools` about `RegExpFlags` #[ast(foreign = RegExpFlags)] struct RegExpFlagsAlias(u8); ```
7b2a5a2
to
440a439
Compare
534c4f8
to
9072f4c
Compare
graphite-app bot
pushed a commit
that referenced
this pull request
Feb 4, 2025
Add `#[ast]` attr to `ScopeId`, `SymbolId` and `ReferenceId` types. This makes them an "official" part of the AST, and removes the hacky "special case" logic from `oxc_ast_tools` which was previously working around that they weren't registered as part of the AST. This uses the `#[ast(foreign = ...)]` feature introduced in #8866 to inform `oxc_ast_tools` about the foreign `NonMaxU32` type, enabling the ID types to be parsed and understood.
Base automatically changed from
02-03-feat_ast_tools_support_nonzero_primitives
to
main
February 4, 2025 03:14
This was referenced Feb 4, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
0-merge
Merge with Graphite Merge Queue
A-ast-tools
Area - AST tools
C-enhancement
Category - New feature or request
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Allow informing
oxc_ast_tools
about foreign types in AST (e.g.NonMaxU32
) and other types which it otherwise can't parse (e.g.RegExpFlags
, which is generated bybitflags!
macro).Mechanism is
#[ast(foreign = ...)]
attr on another type which acts as a "stand-in" for the real one, similar toserde
's remote derive feature.