Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(visit): Fix regression of AST paths #9420

Merged
merged 16 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading