mirror of
https://github.com/swc-project/swc.git
synced 2024-12-25 22:56:11 +03:00
fix(es/quote): Fix code generation of AssignTarget
(#8604)
This commit is contained in:
parent
ae6debdcb3
commit
16e9d4ca31
@ -1,6 +1,6 @@
|
||||
use swc_ecma_ast::*;
|
||||
|
||||
impl_enum!(AssignTarget, [Simple, Pat]);
|
||||
impl_enum!(AssignTarget, [Simple, Pat], true);
|
||||
impl_enum!(
|
||||
SimpleAssignTarget,
|
||||
[
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user