Skip to content

Commit

Permalink
refactor(parser): rename function (#4566)
Browse files Browse the repository at this point in the history
Rename `matches_number_char` function to `matches_number_byte` as it takes a `u8` byte, not a `char`.
  • Loading branch information
overlookmotel committed Jul 31, 2024
1 parent 8e3e910 commit 59f00c0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion crates/oxc_parser/src/lexer/kind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ impl Kind {
)
}

pub fn matches_number_char(self, b: u8) -> bool {
pub fn matches_number_byte(self, b: u8) -> bool {
match self {
Decimal => b.is_ascii_digit(),
Binary => matches!(b, b'0'..=b'1'),
Expand Down
6 changes: 3 additions & 3 deletions crates/oxc_parser/src/lexer/numeric.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl<'a> Lexer<'a> {
fn read_non_decimal(&mut self, kind: Kind) -> Kind {
self.consume_char();

if self.peek_byte().is_some_and(|b| kind.matches_number_char(b)) {
if self.peek_byte().is_some_and(|b| kind.matches_number_byte(b)) {
self.consume_char();
} else {
self.unexpected_err();
Expand All @@ -58,14 +58,14 @@ impl<'a> Lexer<'a> {
// call here instead of after we ensure the next character
// is a number character
self.token.set_has_separator();
if self.peek_byte().is_some_and(|b| kind.matches_number_char(b)) {
if self.peek_byte().is_some_and(|b| kind.matches_number_byte(b)) {
self.consume_char();
} else {
self.unexpected_err();
return Kind::Undetermined;
}
}
b if kind.matches_number_char(b) => {
b if kind.matches_number_byte(b) => {
self.consume_char();
}
_ => break,
Expand Down

0 comments on commit 59f00c0

Please sign in to comment.