refactor(react_compiler): shorten code by using NONE#24630
Conversation
|
@Boshen assigned to you because you're the don of React compiler. I think this change is good, but I don't know if you prefer the lengthy explicit style. |
There was a problem hiding this comment.
Pull request overview
This PR is a small refactor in the React compiler crate to reduce verbosity when passing “no value” for optional arena-allocated AST fields, by using the oxc_ast::builder::NONE marker instead of explicit None::<...> type annotations.
Changes:
- Import
NONEfromoxc_ast::builderwhere needed. - Replace repeated
None::<ArenaBox<...>>/None::<oxc_allocator::Box<...>>arguments withNONEacross several AST constructor calls. - Minor call-site shortening/line wrapping where
NONEmakes the expression more compact.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| crates/oxc_react_compiler/src/react_compiler/entrypoint/program.rs | Switches multiple optional AST builder arguments from explicit None::<...> to NONE and imports NONE. |
| crates/oxc_react_compiler/src/react_compiler_reactive_scopes/codegen_reactive_function.rs | Uses NONE for optional type-parameter/type-annotation/rest fields in generated AST nodes and imports NONE. |
Merging this PR will not alter performance
Comparing Footnotes
|
160ae9f to
993d30d
Compare
1617187 to
bfd19c5
Compare
bfd19c5 to
e613584
Compare
993d30d to
94f99b3
Compare
e613584 to
54ad9c5
Compare
Merge activity
|
54ad9c5 to
d76d899
Compare

Pure refactor.
Shorten code in React compiler by using
NONEinstead of writing out the type long-hand.e.g.
None::<ArenaBox<TSTypeParameterDeclaration>>->NONE