Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(es/minifier): Remove unnecessary check #8927

Merged
merged 2 commits into from
May 7, 2024
Merged
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
12 changes: 0 additions & 12 deletions crates/swc_ecma_minifier/src/compress/optimize/iife.rs
Original file line number Diff line number Diff line change
Expand Up @@ -751,18 +751,6 @@ impl Optimizer<'_> {
}
}

// We should not add a variable to top level scope if the user has disabled it.
//
// See https://github.com/swc-project/swc/issues/8909
if !self.options.top_level() && self.ctx.in_top_level() {
for s in body.stmts.iter() {
if let Stmt::Decl(Decl::Var(..)) = s {
log_abort!("iife: [x] Cannot inline because of top level scope");
return false;
}
}
}

if !body.stmts.iter().all(|stmt| match stmt {
Stmt::Decl(Decl::Var(var))
if matches!(
Expand Down
Loading