Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/oxc_parser/src/lexer/numeric.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl Lexer<'_> {
// This seems to be a waste. It also requires us to put this
// call here instead of after we ensure the next character
// is a number character
self.token.set_has_separator();
self.token.set_has_separator(true);
if self.peek_byte().is_some_and(|b| kind.matches_number_byte(b)) {
self.consume_char();
} else {
Expand Down Expand Up @@ -148,7 +148,7 @@ impl Lexer<'_> {
// This seems to be a waste. It also requires us to put this
// call here instead of after we ensure the next character
// is an ASCII digit
self.token.set_has_separator();
self.token.set_has_separator(true);
if self.peek_byte().is_some_and(|b| b.is_ascii_digit()) {
self.consume_char();
} else {
Expand Down
14 changes: 7 additions & 7 deletions crates/oxc_parser/src/lexer/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ impl Token {
}

#[inline]
pub(crate) fn set_has_separator(&mut self) {
self.0 |= HAS_SEPARATOR_FLAG;
pub(crate) fn set_has_separator(&mut self, value: bool) {
self.0 = (self.0 & !HAS_SEPARATOR_FLAG) | (u128::from(value) * HAS_SEPARATOR_FLAG);
}
}

Expand Down Expand Up @@ -200,7 +200,7 @@ mod test {
token.set_lone_surrogates(lone_surrogates);
if has_separator {
// Assuming set_has_separator is not always called if false
token.set_has_separator();
token.set_has_separator(true);
}

assert_eq!(token.kind(), kind);
Expand Down Expand Up @@ -244,7 +244,7 @@ mod test {
token_with_flags.set_is_on_new_line(true);
token_with_flags.set_escaped(true);
token_with_flags.set_lone_surrogates(true);
token_with_flags.set_has_separator();
token_with_flags.set_has_separator(true);

token_with_flags.set_start(40);
assert_eq!(token_with_flags.start(), 40);
Expand All @@ -261,7 +261,7 @@ mod test {
token_with_flags2.set_is_on_new_line(true);
// escaped is false by default
token_with_flags2.set_lone_surrogates(true);
token_with_flags2.set_has_separator();
token_with_flags2.set_has_separator(true);

token_with_flags2.set_escaped(true);
assert_eq!(token_with_flags2.start(), 50);
Expand All @@ -283,7 +283,7 @@ mod test {
// is_on_new_line is false by default
token_flags_test_newline.set_escaped(true);
token_flags_test_newline.set_lone_surrogates(true);
token_flags_test_newline.set_has_separator();
token_flags_test_newline.set_has_separator(true);

token_flags_test_newline.set_is_on_new_line(true);
assert!(token_flags_test_newline.is_on_new_line());
Expand All @@ -305,7 +305,7 @@ mod test {
token_flags_test_lone_surrogates.set_is_on_new_line(true);
token_flags_test_lone_surrogates.set_escaped(true);
// lone_surrogates is false by default
token_flags_test_lone_surrogates.set_has_separator();
token_flags_test_lone_surrogates.set_has_separator(true);

token_flags_test_lone_surrogates.set_lone_surrogates(true);
assert!(token_flags_test_lone_surrogates.lone_surrogates());
Expand Down
Loading