Commits
Click on a commit to change the comparison rangerefactor(lexer): simplify byte handler macros (#13057)
Pure refactor. Simplify the byte handler macros in lexer in 3 ways:
#### 1. Remove the `const BLAH: ByteHandler = { ... };` wrappers from generated code
I don't think they're necessary, and I'm not sure why I put them there in the first place.
Before:
```rs
const UNI: ByteHandler = {
#[expect(non_snake_case)]
fn UNI(lexer: &mut Lexer) -> Kind {
lexer.unicode_char_handler()
}
UNI
};
```
After:
```rs
#[expect(non_snake_case)]
fn UNI(lexer: &mut Lexer) -> Kind {
lexer.unicode_char_handler()
}
```
Each byte handler still has a useful name in CodSpeed flame graphs after this change.
#### 2. Remove the `byte_handler!` macro.
`ascii_byte_handler!` and `ascii_identifier_handler!` macros remain, but they no longer use `byte_handler!` macro internally.
Removing the macro-within-macro pattern may make this code easier for AI to understand (and probably ditto for humans!).
#### 3. Shorten macro expansion
Hoist `use oxc_data_structures::assert_unchecked;` to top of file, so it doesn't need to be repeated in each macro expansion.3 months ago
by overlookmotel