mirror of
https://github.com/danbulant/oxc
synced 2026-05-25 12:51:57 +00:00
refactor(parser): remove unsafe code (#2527)
Remove some unnecessary unsafe code.
This commit is contained in:
parent
02c82c3f78
commit
0ddfc856d2
1 changed files with 4 additions and 5 deletions
|
|
@ -51,16 +51,15 @@ macro_rules! handle_string_literal {
|
||||||
handle_string_literal_escape!($lexer, $delimiter, $table, after_opening_quote)
|
handle_string_literal_escape!($lexer, $delimiter, $table, after_opening_quote)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
b'\r' | b'\n' => {
|
_ => {
|
||||||
// This is impossible in valid JS, so cold path
|
// Line break. This is impossible in valid JS, so cold path.
|
||||||
cold_branch(|| {
|
cold_branch(|| {
|
||||||
|
debug_assert!(matches!(next_byte, b'\r' | b'\n'));
|
||||||
$lexer.consume_char();
|
$lexer.consume_char();
|
||||||
$lexer.error(diagnostics::UnterminatedString($lexer.unterminated_range()));
|
$lexer.error(diagnostics::UnterminatedString($lexer.unterminated_range()));
|
||||||
Kind::Undetermined
|
Kind::Undetermined
|
||||||
})
|
})
|
||||||
},
|
}
|
||||||
// SAFETY: Macro user guarantees `$table` does not match any other bytes
|
|
||||||
_ => assert_unchecked::unreachable_unchecked!()
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handle_eof: || {
|
handle_eof: || {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue