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

Code before:
        {
            let ctx = self
                .ctx
                .clone()
                .with(BitCtx::IsThisAwareCallee, false)
                .with(BitCtx::IsLhsOfAssign, false)
                .with(BitCtx::IsExactLhsOfAssign, false)
                .with(BitCtx::IsUpdateArg, false);
            // TODO: Prevent inline if callee is unknown.
            e.args.visit_mut_with(&mut *self.with_ctx(ctx));
        }

        self.ignore_unused_args_of_iife(e);
        self.inline_args_of_iife(e);
        self.drop_arguments_of_symbol_call(e);
    }

    #[cfg_attr(feature = "debug", tracing::instrument(level = "debug", skip_all))]
    fn visit_mut_class(&mut self, n: &mut Class) {
        n.decorators.visit_mut_with(self);

        {
            let ctx = self
                .ctx
                .clone()
                // .with(BitCtx::DontInvokeIife, true)
                .with(BitCtx::IsUpdateArg, false);
            n.super_class.visit_mut_with(&mut *self.with_ctx(ctx));
        }

        {
            let ctx = Ctx {
                bit_ctx: self.ctx.bit_ctx.with(BitCtx::IsUpdateArg, false),
                expr_ctx: ExprCtx {
                    in_strict: true,
                    ..self.ctx.clone().expr_ctx
                },
                ..self.ctx.clone()
            };
            n.body.visit_mut_with(&mut *self.with_ctx(ctx));
        }

        {
            if n.super_class.is_none() {
                self.drop_empty_constructors(n);
            }
        }
    }

    #[cfg_attr(feature = "debug", tracing::instrument(level = "debug", skip_all))]
    fn visit_mut_class_member(&mut self, n: &mut ClassMember) {

Review comment (refactor):
The commented-out code should be removed rather than left in place. This code is no longer needed after the refactoring, as evidenced by the removal of the DontInvokeIife flag usage throughout the codebase. Leaving commented code reduces readability and can cause confusion for future maintainers.
```suggestion

```

Code after:
                .ctx
                .clone()
                .with(BitCtx::IsThisAwareCallee, false)
                .with(BitCtx::IsLhsOfAssign, false)
                .with(BitCtx::IsExactLhsOfAssign, false)
                .with(BitCtx::IsUpdateArg, false);
            // TODO: Prevent inline if callee is unknown.
            e.args.visit_mut_with(&mut *self.with_ctx(ctx));
        }

        self.ignore_unused_args_of_iife(e);
        self.inline_args_of_iife(e);
        self.drop_arguments_of_symbol_call(e);
    }

    #[cfg_attr(feature = "debug", tracing::instrument(level = "debug", skip_all))]
    fn visit_mut_class(&mut self, n: &mut Class) {
        n.decorators.visit_mut_with(self);

        {
            let ctx = self.ctx.clone().with(BitCtx::IsUpdateArg, false);
            n.super_class.visit_mut_with(&mut *self.with_ctx(ctx));
        }

        {
            let ctx = Ctx {
                bit_ctx: self.ctx.bit_ctx.with(BitCtx::IsUpdateArg, false),
                expr_ctx: ExprCtx {
                    in_strict: true,
                    ..self.ctx.clone().expr_ctx
                },
                ..self.ctx.clone()
            };
            n.body.visit_mut_with(&mut *self.with_ctx(ctx));
        }

        {
            if n.super_class.is_none() {
                self.drop_empty_constructors(n);
            }
        }
    }

    #[cfg_attr(feature = "debug", tracing::instrument(level = "debug", skip_all))]
    fn visit_mut_class_member(&mut self, n: &mut ClassMember) {
        let ctx = self
            .ctx
            .clone()
            .with(BitCtx::InFnLike, false)
            .with(BitCtx::InClass, true);