swc-project/swc · error

swc does not support bind expressions

Error message

swc does not support bind expressions

What it means

Raised in `Swcify for BindExpression` (swcify/expr.rs:1106). A BindExpression is the stage-0 `::` bind-operator proposal (`obj::method`); swc's AST has no node for it because the proposal never advanced. The implementation is a stub with `Never` output that unconditionally panics whenever a bind expression node reaches this swcify impl. The bind expression node in the Babel input is what triggers it.

Source

Thrown at crates/swc_estree_compat/src/swcify/expr.rs:1106

        }
    }
}

impl Swcify for swc_estree_ast::JSXClosingFragment {
    type Output = swc_ecma_ast::JSXClosingFragment;

    fn swcify(self, ctx: &Context) -> Self::Output {
        swc_ecma_ast::JSXClosingFragment {
            span: ctx.span(&self.base),
        }
    }
}

impl Swcify for BindExpression {
    type Output = Never;

    fn swcify(self, _: &Context) -> Self::Output {
        panic!("swc does not support bind expressions")
    }
}

impl Swcify for DoExpression {
    type Output = Never;

    fn swcify(self, _: &Context) -> Self::Output {
        panic!("swc does not support do expressions")
    }
}

impl Swcify for PipelinePrimaryTopicReference {
    type Output = Never;

    fn swcify(self, _: &Context) -> Self::Output {
        panic!("swc does not support `PipelinePrimaryTopicReference`")
    }
}

View on GitHub (pinned to 5176682b65)

Solutions

  1. Reject Babel ASTs containing bind expressions up front with a clear unsupported-syntax error
  2. Transpile `a::b` to `b.bind(a)` in a preprocessing pass before swcification
  3. Ensure the parser/plugin that produced the Babel AST has bind-expression syntax disabled
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at crates/swc_estree_compat/src/swcify/expr.rs:1106 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/b9b60f21af1c53be. Report an issue: GitHub.