Skip to content

Commit

Permalink
fix(es/quote): Add support for import phase to quote macro (#8536)
Browse files Browse the repository at this point in the history
**Description:**

When using quote! to generate import decl, compile error: missing field `phase` in initializer of 'swc_core::ecma::ast::Import'
  • Loading branch information
JSerFeng authored Jan 22, 2024
1 parent 240ed13 commit 71930ff
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions crates/swc_ecma_quote_macros/src/ast/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,4 @@ impl_simple_enum!(
impl_simple_enum!(Accessibility, [Public, Protected, Private]);
impl_simple_enum!(MethodKind, [Method, Getter, Setter]);
impl_simple_enum!(MetaPropKind, [NewTarget, ImportMeta]);
impl_simple_enum!(ImportPhase, [Defer, Source, Evaluation]);
2 changes: 1 addition & 1 deletion crates/swc_ecma_quote_macros/src/ast/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl_struct!(CondExpr, [span, test, cons, alt]);
impl_struct!(CallExpr, [span, callee, args, type_args]);
impl_struct!(ExprOrSpread, [spread, expr]);
impl_struct!(Super, [span]);
impl_struct!(Import, [span]);
impl_struct!(Import, [span, phase]);
impl_struct!(NewExpr, [span, callee, args, type_args]);
impl_struct!(SeqExpr, [span, exprs]);

Expand Down
2 changes: 1 addition & 1 deletion crates/swc_ecma_quote_macros/src/ast/module_decl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ impl_enum!(
]
);

impl_struct!(ImportDecl, [span, specifiers, src, type_only, with]);
impl_struct!(ImportDecl, [span, specifiers, src, type_only, with, phase]);
impl_struct!(ExportDecl, [span, decl]);
impl_struct!(ExportDefaultDecl, [span, decl]);
impl_struct!(ExportDefaultExpr, [span, expr]);
Expand Down

0 comments on commit 71930ff

Please sign in to comment.