mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 12:19:15 +00:00
feat(minifier): remove parenthesized expression for dce (#5439)
relates #5436
This commit is contained in:
parent
d9d7e7c596
commit
ba4b68cf63
2 changed files with 9 additions and 1 deletions
|
|
@ -93,6 +93,11 @@ impl CompressOptions {
|
|||
}
|
||||
|
||||
pub fn dead_code_elimination() -> Self {
|
||||
Self { fold_constants: true, remove_dead_code: true, ..Self::all_false() }
|
||||
Self {
|
||||
remove_syntax: true,
|
||||
fold_constants: true,
|
||||
remove_dead_code: true,
|
||||
..Self::all_false()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,6 +78,9 @@ fn dce_if_statement() {
|
|||
"const a = { fn: function() { if (true) { foo; } } }",
|
||||
"const a = { fn: function() { { foo; } } }",
|
||||
);
|
||||
|
||||
// parenthesized
|
||||
test("if (!!(false)) { REMOVE; } else { KEEP; }", "{ KEEP }");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
Loading…
Reference in a new issue