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
- Use one of the supported replacement shapes: Ident, `void 0`, or a MemberExpr
- Extend the match arm to set the span (or wrap in Paren) for the new Expr variant
- Report upstream with the replacement expression you need
Defensive patterns
Strategy: validation
Prevention
- Contributors: keep top-level `this` replacements as Ident, `void 0`, or MemberExpr
- When adding a module format, extend the span-fixup match arm together with the new replacement expression
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
- Unknown suffix `{}`
- determine_export_name({:?})
- Failed to unwrap Arc: other references to transform_result e
AI-assisted analysis of swc-project/swc@d7d7434666 (2026-08-16).
Data as JSON: /api/errors/523caf27de2070e4.
Report an issue: GitHub.