Skip to content

Commit

Permalink
refactor(parser): remove useless string builder from jsx text lexer (#…
Browse files Browse the repository at this point in the history
…2096)

relates #2094
  • Loading branch information
Boshen authored Jan 20, 2024
1 parent 8e43eef commit 3f2b48f
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions crates/oxc_parser/src/lexer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -952,18 +952,14 @@ impl<'a> Lexer<'a> {
self.current.chars.next();
Kind::LCurly
}
Some(c) => {
let mut builder = AutoCow::new(self);
builder.push_matching(c);
Some(_) => {
loop {
// `>` and `}` are errors in TypeScript but not Babel
// let's make this less strict so we can parse more code
if matches!(self.peek(), Some('{' | '<')) {
break;
}
if let Some(c) = self.current.chars.next() {
builder.push_matching(c);
} else {
if self.current.chars.next().is_none() {
break;
}
}
Expand Down Expand Up @@ -1369,7 +1365,7 @@ macro_rules! ascii_byte_handler {
const $id: ByteHandler = |$lex| {
// SAFETY: This macro is only used for ASCII characters
unsafe {
use ::assert_unchecked::assert_unchecked;
use assert_unchecked::assert_unchecked;
let s = $lex.current.chars.as_str();
assert_unchecked!(!s.is_empty());
assert_unchecked!(s.as_bytes()[0] < 128);
Expand Down

0 comments on commit 3f2b48f

Please sign in to comment.