mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
refactor(parser): remove useless string builder from jsx text lexer (#2096)
relates #2094
This commit is contained in:
parent
8e43eeffe7
commit
3f2b48f1a9
1 changed files with 3 additions and 7 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue