Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(parser): remove extraneous code from regex parsing (oxc-proj…
…ect#2008) This PR removes some code in parsing regexp flags which is extraneous: ```rs if !ch.is_ascii_lowercase() { self.error(diagnostics::RegExpFlag(ch, self.current_offset())); continue; } ``` Which is followed by: ```rs let flag = if let Ok(flag) = RegExpFlags::try_from(ch) { flag } else { self.error(diagnostics::RegExpFlag(ch, self.current_offset())); continue; }; ``` `!ch.is_ascii_lowercase()` is equivalent to `ch < 'a' || ch > 'z'`. The compiler implements `RegExpFlags::try_from(ch)` as `ch < 'd' || ch > 'y'` and then a jump table. So `ch.is_ascii_lowercase()` does nothing that `RegExpFlags::try_from(ch)` doesn't do already. https://godbolt.org/z/51GPPY9nx (this PR built on top of oxc-project#2007 for ease)
- Loading branch information