mirror of
https://github.com/aphrody-labs/oxc.git
synced 2026-10-15 06:39:17 +00:00
perf(minifier): avoid creation of empty block when folding try finally (#26971)
This commit is contained in:
1 parent
e9ff529e87
commit
3471f2944c
1 file changed
+2
-4
@@ -413,10 +413,8 @@ impl<'a> PeepholeOptimizations {
|
||||
if s.block.body.is_empty()
|
||||
&& s.handler.as_ref().is_none_or(|handler| handler.body.body.is_empty())
|
||||
{
|
||||
let new_stmt = if let Some(finalizer) = &mut s.finalizer {
|
||||
let mut block = BlockStatement::boxed(finalizer.span, [], ctx);
|
||||
std::mem::swap(finalizer, &mut block);
|
||||
Statement::BlockStatement(block)
|
||||
let new_stmt = if let Some(finalizer) = s.finalizer.take() {
|
||||
Statement::BlockStatement(finalizer)
|
||||
} else {
|
||||
Statement::new_empty_statement(s.span, ctx)
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user