Skip to content

Commit 59f00c0

Browse files
committed
refactor(parser): rename function (#4566)
Rename `matches_number_char` function to `matches_number_byte` as it takes a `u8` byte, not a `char`.
1 parent 8e3e910 commit 59f00c0

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

crates/oxc_parser/src/lexer/kind.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ impl Kind {
206206
)
207207
}
208208

209-
pub fn matches_number_char(self, b: u8) -> bool {
209+
pub fn matches_number_byte(self, b: u8) -> bool {
210210
match self {
211211
Decimal => b.is_ascii_digit(),
212212
Binary => matches!(b, b'0'..=b'1'),

crates/oxc_parser/src/lexer/numeric.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ impl<'a> Lexer<'a> {
4242
fn read_non_decimal(&mut self, kind: Kind) -> Kind {
4343
self.consume_char();
4444

45-
if self.peek_byte().is_some_and(|b| kind.matches_number_char(b)) {
45+
if self.peek_byte().is_some_and(|b| kind.matches_number_byte(b)) {
4646
self.consume_char();
4747
} else {
4848
self.unexpected_err();
@@ -58,14 +58,14 @@ impl<'a> Lexer<'a> {
5858
// call here instead of after we ensure the next character
5959
// is a number character
6060
self.token.set_has_separator();
61-
if self.peek_byte().is_some_and(|b| kind.matches_number_char(b)) {
61+
if self.peek_byte().is_some_and(|b| kind.matches_number_byte(b)) {
6262
self.consume_char();
6363
} else {
6464
self.unexpected_err();
6565
return Kind::Undetermined;
6666
}
6767
}
68-
b if kind.matches_number_char(b) => {
68+
b if kind.matches_number_byte(b) => {
6969
self.consume_char();
7070
}
7171
_ => break,

0 commit comments

Comments
 (0)