We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
match_keyword
1 parent 09ae2a9 commit 00bdfc0Copy full SHA for 00bdfc0
crates/oxc_parser/src/lexer/kind.rs
@@ -418,9 +418,11 @@ impl Kind {
418
matches!(self, LCurly | LBrack | PrivateIdentifier) || self.is_binding_identifier()
419
}
420
421
+ #[cold]
422
pub fn match_keyword(s: &str) -> Self {
423
let len = s.len();
- if len <= 1 || len >= 12 || !s.as_bytes()[0].is_ascii_lowercase() {
424
+ // SAFETY: Already checked `len <= 1`.
425
+ if len <= 1 || len >= 12 || !unsafe { s.as_bytes().get_unchecked(0) }.is_ascii_lowercase() {
426
return Ident;
427
428
Self::match_keyword_impl(s)
0 commit comments