swc-project/swc · info

not implemented

Error message

not implemented

What it means

Module transforms (CJS/AMD/UMD/SystemJS) rewrite top-level `this` via a crate-private util that clones the replacement expression per occurrence and only adjusts spans for `Unary` (`void 0`), `Ident` and `Member` replacements. Every in-tree caller passes `Expr::undefined(DUMMY_SP)` (`void 0`), so the bare `unimplemented!()` fires only when the util is changed to use a replacement expression of another shape (call, arrow, sequence, ...).

Source

Thrown at crates/swc_ecma_transforms_module/src/top_level_this.rs:75

                ..
            }) => computed.visit_mut_children_with(self),
            _ => {}
        }
    }

    fn visit_mut_expr(&mut self, n: &mut Expr) {
        if let Expr::This(ThisExpr { span }) = n {
            self.found = true;

            let mut this = self.this.clone();
            match &mut this {
                // for void 0
                Expr::Unary(unary_expr) => unary_expr.span = *span,
                Expr::Ident(ident) => ident.span = *span,
                Expr::Member(member) => member.span = *span,

                _ => {
                    unimplemented!();
                }
            }

            *n = this;
        } else {
            n.visit_mut_children_with(self);
        }
    }
}

View on GitHub (pinned to d7d7434666)

Solutions

  1. Use one of the supported replacement shapes: Ident, `void 0`, or a MemberExpr
  2. Extend the match arm to set the span (or wrap in Paren) for the new Expr variant
  3. Report upstream with the replacement expression you need
Defensive patterns

Strategy: validation

Prevention

When it happens

Trigger: Not reachable through public configuration; only swc contributors adding a new module format or changing the replacement expression (e.g. to `globalThis` written as a non-Member/Ident node) hit it.

Common situations: Fork or patch work on swc_ecma_transforms_module introducing a module format whose `this` binding is an arbitrary expression.

Related errors


AI-assisted analysis of swc-project/swc@d7d7434666 (2026-08-16). Data as JSON: /api/errors/523caf27de2070e4. Report an issue: GitHub.