Skip to content

Commit 16e9d4c

Browse files
authoredFeb 5, 2024
fix(es/quote): Fix code generation of AssignTarget (#8604)
1 parent ae6debd commit 16e9d4c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed
 

‎crates/swc_ecma_quote_macros/src/ast/expr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use swc_ecma_ast::*;
22

3-
impl_enum!(AssignTarget, [Simple, Pat]);
3+
impl_enum!(AssignTarget, [Simple, Pat], true);
44
impl_enum!(
55
SimpleAssignTarget,
66
[

‎crates/swc_ecma_quote_macros/src/ast/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ macro_rules! impl_enum {
4242
($E:ident, [ $($v:ident),* ], true) => {
4343
impl crate::ast::ToCode for $E {
4444
fn to_code(&self, cx: &crate::ctxt::Ctx) -> syn::Expr {
45-
if let Self::Ident(i) = self {
45+
if let Some(i) = self.as_ident() {
4646
if let Some(var_name) = i.sym.strip_prefix('$') {
4747
if let Some(var) = cx.var(crate::ctxt::VarPos::$E, var_name) {
4848
return var.get_expr();

0 commit comments

Comments
 (0)
Please sign in to comment.