Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/oxc_mangler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ oxc_data_structures = { workspace = true, features = ["inline_string"] }
oxc_index = { workspace = true }
oxc_semantic = { workspace = true }
oxc_span = { workspace = true }
oxc_syntax = { workspace = true }

itertools = { workspace = true }
rustc-hash = { workspace = true }
Expand Down
10 changes: 1 addition & 9 deletions crates/oxc_mangler/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ impl<'t> Mangler<'t> {
count += 1;
// Do not mangle keywords and unresolved references
let n = name.as_str();
if !is_keyword(n)
if !oxc_syntax::keyword::is_reserved_keyword(n)
&& !is_special_name(n)
&& !root_unresolved_references.contains_key(n)
&& !(root_bindings.contains_key(n)
Expand Down Expand Up @@ -605,14 +605,6 @@ impl<'t> SlotFrequency<'t> {
}
}

#[rustfmt::skip]
fn is_keyword(s: &str) -> bool {
matches!(s, "as" | "do" | "if" | "in" | "is" | "of" | "any" | "for" | "get"
| "let" | "new" | "out" | "set" | "try" | "var" | "case" | "else"
| "enum" | "from" | "meta" | "null" | "this" | "true" | "type"
| "void" | "with")
}

// Maximum length of string is 15 (`slot_4294967295` for `u32::MAX`).
fn debug_name(n: u32) -> InlineString<15, u8> {
// Using `format!` here allocates a string unnecessarily.
Expand Down
6 changes: 3 additions & 3 deletions tasks/minsize/minsize.snap
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@ Original | minified | minified | gzip | gzip | Iterations | Fi

544.10 kB | 71.04 kB | 72.48 kB | 25.78 kB | 26.20 kB | 2 | lodash.js

555.77 kB | 267.39 kB | 270.13 kB | 88.02 kB | 90.80 kB | 2 | d3.js
555.77 kB | 267.39 kB | 270.13 kB | 88.01 kB | 90.80 kB | 2 | d3.js

1.01 MB | 439.40 kB | 458.89 kB | 122.06 kB | 126.71 kB | 2 | bundle.min.js

1.25 MB | 642.65 kB | 646.76 kB | 159.39 kB | 163.73 kB | 2 | three.js

2.14 MB | 711.15 kB | 724.14 kB | 160.43 kB | 181.07 kB | 2 | victory.js

3.20 MB | 1.00 MB | 1.01 MB | 322.53 kB | 331.56 kB | 3 | echarts.js
3.20 MB | 1.00 MB | 1.01 MB | 322.59 kB | 331.56 kB | 3 | echarts.js

6.69 MB | 2.22 MB | 2.31 MB | 458.41 kB | 488.28 kB | 4 | antd.js

10.95 MB | 3.33 MB | 3.49 MB | 853.38 kB | 915.50 kB | 4 | typescript.js
10.95 MB | 3.33 MB | 3.49 MB | 853.34 kB | 915.50 kB | 4 | typescript.js

Loading