Skip to content

Commit

Permalink
fix(visit): Fix regression of AST paths (#9420)
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 authored Aug 12, 2024
1 parent 041b1f0 commit 9751518
Show file tree
Hide file tree
Showing 14 changed files with 819 additions and 1,465 deletions.
9 changes: 9 additions & 0 deletions .changeset/famous-panthers-sparkle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
swc_ecma_ast: patch
swc_css_visit: patch
swc_ecma_visit: patch
swc_xml_visit: patch
swc_html_visit: patch
---

fix(es): Fix regression
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

542 changes: 351 additions & 191 deletions crates/swc_css_visit/src/generated.rs

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions crates/swc_ecma_ast/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub use self::{
},
list::ListFormat,
lit::{BigInt, Bool, Lit, Null, Number, Regex, Str},
module::{Module, ModuleItem, Program, ReservedUnused, Script},
module::{Module, ModuleItem, Program, Script},
module_decl::{
DefaultDecl, ExportAll, ExportDecl, ExportDefaultDecl, ExportDefaultExpr,
ExportDefaultSpecifier, ExportNamedSpecifier, ExportNamespaceSpecifier, ExportSpecifier,
Expand Down Expand Up @@ -198,9 +198,7 @@ pub use self::{
ArchivedBigInt, ArchivedBool, ArchivedLit, ArchivedNull, ArchivedNumber, ArchivedRegex,
ArchivedStr,
},
module::{
ArchivedModule, ArchivedModuleItem, ArchivedProgram, ArchivedReservedUnused, ArchivedScript,
},
module::{ArchivedModule, ArchivedModuleItem, ArchivedProgram, ArchivedScript},
module_decl::{
ArchivedDefaultDecl, ArchivedExportAll, ArchivedExportDecl, ArchivedExportDefaultDecl,
ArchivedExportDefaultExpr, ArchivedExportDefaultSpecifier, ArchivedExportNamedSpecifier,
Expand Down
22 changes: 0 additions & 22 deletions crates/swc_ecma_ast/src/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,6 @@ pub enum Program {
Module(Module),
#[tag("Script")]
Script(Script),
// Reserved type for the testing purpose only. Prod codes does not utilize
// this at all and user should not try to attempt to use this as well.
// TODO: reenable once experimental_metadata breaking change is merged
// #[tag("ReservedUnused")]
// ReservedUnused(ReservedUnused),
}

#[ast_node("ReservedUnused")]
#[derive(Eq, Hash, EqIgnoreSpan)]
pub struct ReservedUnused {
pub span: Span,
pub body: Option<Vec<ModuleItem>>,
}

#[cfg(feature = "arbitrary")]
#[cfg_attr(docsrs, doc(cfg(feature = "arbitrary")))]
impl<'a> arbitrary::Arbitrary<'a> for ReservedUnused {
fn arbitrary(u: &mut arbitrary::Unstructured<'_>) -> arbitrary::Result<Self> {
let span = u.arbitrary()?;
let body = u.arbitrary()?;
Ok(Self { span, body })
}
}

#[ast_node("Module")]
Expand Down
Loading

0 comments on commit 9751518

Please sign in to comment.