oxc/crates
overlookmotel 6996948825
refactor(parser): remove extraneous code from regex parsing (#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 #2007 for ease)
2024-01-13 02:34:05 +00:00
..
oxc Publish crates v0.5.0 2024-01-12 23:33:47 +08:00
oxc_allocator Publish crates v0.5.0 2024-01-12 23:33:47 +08:00
oxc_ast Publish crates v0.5.0 2024-01-12 23:33:47 +08:00
oxc_cli feat(linter): add support for same rule name but different plugin names (#1992) 2024-01-11 18:05:05 +08:00
oxc_codegen Publish crates v0.5.0 2024-01-12 23:33:47 +08:00
oxc_diagnostics Publish crates v0.5.0 2024-01-12 23:33:47 +08:00
oxc_index Publish crates v0.5.0 2024-01-12 23:33:47 +08:00
oxc_js_regex
oxc_language_server chore: remove DSL based linter plugin (#1985) 2024-01-11 04:54:39 +00:00
oxc_linter fix(linter): fix false positive for erasing-op in 0/0 case (#2009) 2024-01-13 10:32:26 +08:00
oxc_macros
oxc_minifier Publish crates v0.5.0 2024-01-12 23:33:47 +08:00
oxc_parser refactor(parser): remove extraneous code from regex parsing (#2008) 2024-01-13 02:34:05 +00:00
oxc_prettier feat(linter): no-irregular-whitespace rule (#1835) 2023-12-31 12:05:38 +08:00
oxc_semantic Publish crates v0.5.0 2024-01-12 23:33:47 +08:00
oxc_span Publish crates v0.5.0 2024-01-12 23:33:47 +08:00
oxc_syntax Publish crates v0.5.0 2024-01-12 23:33:47 +08:00
oxc_transformer Publish crates v0.5.0 2024-01-12 23:33:47 +08:00
oxc_type_synthesis
oxc_wasm chore: remove DSL based linter plugin (#1985) 2024-01-11 04:54:39 +00:00