swc-project/swc · error
swcify
Error message
swcify: {:?} What it means
A catch-all panic in the Statement-to-ModuleItem swcify conversion (swcify/stmt.rs:94). Each Babel Statement variant is mapped explicitly; the trailing arm fires when a Statement arrives whose variant has no explicit arm in this match — i.e. a statement kind the swcify layer has not implemented or does not expect. The debug-formatted statement ({:?}) names the exact unmapped variant, marking a conversion-completeness gap.
Solutions
- Look at the {:?} output to identify the Statement variant, then add its swcify arm
- Reject the Babel input earlier if that statement kind is unsupported in swc's AST
- Update swc_estree_ast/swc_ecma_ast if the missing kind requires new node support
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at crates/swc_estree_compat/src/swcify/stmt.rs:94 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of swc-project/swc@5176682b65 (2026-08-17).
Data as JSON: /api/errors/ff5ab42bb9d8d6bf.
Report an issue: GitHub.
Appendix: source
Thrown at crates/swc_estree_compat/src/swcify/stmt.rs:94
Statement::While(v) => v.swcify(ctx).into(),
Statement::With(v) => v.swcify(ctx).into(),
Statement::ClassDecl(v) => v.swcify(ctx).into(),
Statement::ExportAllDecl(v) => ModuleItem::ModuleDecl(v.swcify(ctx).into()),
Statement::ExportDefaultDecl(v) => ModuleItem::ModuleDecl(v.swcify(ctx)),
Statement::ExportNamedDecl(v) => ModuleItem::ModuleDecl(v.swcify(ctx).into()),
Statement::ForOf(v) => v.swcify(ctx).into(),
Statement::ImportDecl(v) => ModuleItem::ModuleDecl(v.swcify(ctx).into()),
Statement::DeclClass(v) => v.swcify(ctx).into(),
Statement::DeclFunc(v) => v.swcify(ctx).into(),
Statement::DeclInterface(v) => v.swcify(ctx).into(),
Statement::DeclModule(v) => v.swcify(ctx).into(),
Statement::DeclareModuleExports(v) => ModuleItem::ModuleDecl(v.swcify(ctx).into()),
Statement::DeclTypeAlias(v) => v.swcify(ctx).into(),
Statement::DeclVar(v) => v.swcify(ctx).into(),
Statement::DeclExportDeclaration(v) => ModuleItem::ModuleDecl(v.swcify(ctx).into()),
Statement::DeclExportAllDeclaration(v) => ModuleItem::ModuleDecl(v.swcify(ctx).into()),
_ => {
todo!("swcify: {:?}", self)
}
}
}
}
impl Swcify for BreakStatement {
type Output = BreakStmt;
fn swcify(self, ctx: &Context) -> Self::Output {
BreakStmt {
span: ctx.span(&self.base),
label: self.label.swcify(ctx).map(|v| v.into()),
}
}
}
impl Swcify for ContinueStatement {
type Output = ContinueStmt;View on GitHub (pinned to 5176682b65)