-
-
Notifications
You must be signed in to change notification settings - Fork 501
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ast_tools): allow defining foreign types with `#[ast(foreign = .…
…..)]` (#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); ```
- Loading branch information
1 parent
440a439
commit 9072f4c
Showing
2 changed files
with
70 additions
and
21 deletions.
There are no files selected for viewing
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 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