Repository: swc-project/swc
File: crates/swc_ecma_minifier/src/compress/optimize/iife.rs (Rust)

Code before:
        {
            if !call.callee.span().is_dummy() {
                log_abort!("skip");
                return false;
            }
        }

        trace_op!("iife: Checking noinline");

        if self.has_noinline(call.ctxt) {
            log_abort!("iife: Has no inline mark");
            return false;
        }

        let callee = match &call.callee {
            Callee::Super(_) | Callee::Import(_) => return false,
            Callee::Expr(e) => &**e,
            #[cfg(swc_ast_unknown)]
            _ => panic!("unable to access unknown nodes"),
        };

        // if self.ctx.bit_ctx.contains(BitCtx::DontInvokeIife) {
        //     log_abort!("iife: Inline is prevented");
        //     return false;
        // }

        for arg in &call.args {
            if arg.spread.is_some() {
                log_abort!("iife: Found spread argument");
                return false;
            }
        }

        trace_op!("iife: Checking callee");

        match callee {
            Expr::Arrow(f) => {
                if f.is_async {
                    log_abort!("iife: Cannot inline async fn");
                    return false;
                }

                if f.is_generator {
                    log_abort!("iife: Cannot inline generator");
                    return false;
                }

                if self.ctx.bit_ctx.contains(BitCtx::InParam) && !f.params.is_empty() {
                    log_abort!("iife: We don't invoke IIFE with params in function params");
                    return false;
                }

Review comment (refactor):
The commented-out code should be removed rather than left in place. This check is no longer needed after the refactoring, which now relies on the more comprehensive `may_add_ident()` check. Leaving commented code reduces readability and can cause confusion for future maintainers.
```suggestion

```

Code after:
        {
            if !call.callee.span().is_dummy() {
                log_abort!("skip");
                return false;
            }
        }

        trace_op!("iife: Checking noinline");

        if self.has_noinline(call.ctxt) {
            log_abort!("iife: Has no inline mark");
            return false;
        }

        let callee = match &call.callee {
            Callee::Super(_) | Callee::Import(_) => return false,
            Callee::Expr(e) => &**e,
            #[cfg(swc_ast_unknown)]
            _ => panic!("unable to access unknown nodes"),
        };

        for arg in &call.args {
            if arg.spread.is_some() {
                log_abort!("iife: Found spread argument");
                return false;
            }
        }

        trace_op!("iife: Checking callee");

        match callee {
            Expr::Arrow(f) => {
                if f.is_async {
                    log_abort!("iife: Cannot inline async fn");
                    return false;
                }

                if f.is_generator {
                    log_abort!("iife: Cannot inline generator");
                    return false;
                }

                if self.ctx.bit_ctx.contains(BitCtx::InParam) && !f.params.is_empty() {
                    log_abort!("iife: We don't invoke IIFE with params in function params");
                    return false;
                }

                if f.params.iter().any(|param| !param.is_ident()) {
                    return false;
                }
            }