diff --git a/crates/swc_ecma_quote_macros/src/ast/expr.rs b/crates/swc_ecma_quote_macros/src/ast/expr.rs index 7ec60f00ddd..bdcc8244ae2 100644 --- a/crates/swc_ecma_quote_macros/src/ast/expr.rs +++ b/crates/swc_ecma_quote_macros/src/ast/expr.rs @@ -1,6 +1,6 @@ use swc_ecma_ast::*; -impl_enum!(AssignTarget, [Simple, Pat]); +impl_enum!(AssignTarget, [Simple, Pat], true); impl_enum!( SimpleAssignTarget, [ diff --git a/crates/swc_ecma_quote_macros/src/ast/mod.rs b/crates/swc_ecma_quote_macros/src/ast/mod.rs index 2ebd6dad5ee..fc3ac90dd51 100644 --- a/crates/swc_ecma_quote_macros/src/ast/mod.rs +++ b/crates/swc_ecma_quote_macros/src/ast/mod.rs @@ -42,7 +42,7 @@ macro_rules! impl_enum { ($E:ident, [ $($v:ident),* ], true) => { impl crate::ast::ToCode for $E { fn to_code(&self, cx: &crate::ctxt::Ctx) -> syn::Expr { - if let Self::Ident(i) = self { + if let Some(i) = self.as_ident() { if let Some(var_name) = i.sym.strip_prefix('$') { if let Some(var) = cx.var(crate::ctxt::VarPos::$E, var_name) { return var.get_expr();