Skip to content

Commit

Permalink
refactor(es/compat): Remove usage of box_patterns (swc-project#7613)
Browse files Browse the repository at this point in the history
  • Loading branch information
dsherret authored Jul 3, 2023
1 parent cba9868 commit 0a26066
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,19 @@ impl VisitMut for OptChaining {
*e = self.construct(data, false, self.c.no_document_all);
}

// delete foo?.bar -> foo == null ? true : delete foo.bar
Expr::Unary(UnaryExpr {
arg: box Expr::OptChain(v),
arg,
op: op!("delete"),
..
}) => {
let data = self.gather(v.take(), vec![]);
*e = self.construct(data, true, self.c.no_document_all);
match &mut **arg {
// delete foo?.bar -> foo == null ? true : delete foo.bar
Expr::OptChain(v) => {
let data = self.gather(v.take(), vec![]);
*e = self.construct(data, true, self.c.no_document_all);
}
_ => e.visit_mut_children_with(self),
}
}

e => e.visit_mut_children_with(self),
Expand Down
1 change: 0 additions & 1 deletion crates/swc_ecma_transforms_compat/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#![allow(clippy::vec_box)]
#![allow(clippy::boxed_local)]
#![allow(clippy::match_like_matches_macro)]
#![feature(box_patterns)]

pub use self::{
bugfixes::bugfixes, es2015::es2015, es2016::es2016, es2017::es2017, es2018::es2018,
Expand Down

0 comments on commit 0a26066

Please sign in to comment.