Skip to content

Commit

Permalink
perf(es/ast): Box ArrayPat and ObjectPat
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Feb 26, 2025
1 parent 5c9d508 commit d8794f4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions crates/swc_ecma_ast/src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1462,9 +1462,9 @@ impl TryFrom<Box<Expr>> for AssignTarget {
#[cfg_attr(feature = "shrink-to-fit", derive(shrink_to_fit::ShrinkToFit))]
pub enum AssignTargetPat {
#[tag("ArrayPattern")]
Array(ArrayPat),
Array(Box<ArrayPat>),
#[tag("ObjectPattern")]
Object(ObjectPat),
Object(Box<ObjectPat>),
#[tag("Invalid")]
Invalid(Invalid),
}
Expand Down Expand Up @@ -1593,8 +1593,8 @@ bridge_from!(AssignTarget, SimpleAssignTarget, TsSatisfiesExpr);
bridge_from!(AssignTarget, SimpleAssignTarget, TsNonNullExpr);
bridge_from!(AssignTarget, SimpleAssignTarget, TsTypeAssertion);

bridge_from!(AssignTarget, AssignTargetPat, ArrayPat);
bridge_from!(AssignTarget, AssignTargetPat, ObjectPat);
bridge_from!(AssignTarget, AssignTargetPat, Box<ArrayPat>);
bridge_from!(AssignTarget, AssignTargetPat, Box<ObjectPat>);

impl From<SimpleAssignTarget> for Box<Expr> {
fn from(s: SimpleAssignTarget) -> Self {
Expand Down
8 changes: 4 additions & 4 deletions crates/swc_ecma_ast/src/pat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ pub enum Pat {
Ident(BindingIdent),

#[tag("ArrayPattern")]
Array(ArrayPat),
Array(Box<ArrayPat>),

#[tag("RestElement")]
Rest(RestPat),

#[tag("ObjectPattern")]
Object(ObjectPat),
Object(Box<ObjectPat>),

#[tag("AssignmentPattern")]
Assign(AssignPat),
Expand Down Expand Up @@ -77,8 +77,8 @@ macro_rules! pat_to_other {
}

pat_to_other!(BindingIdent);
pat_to_other!(ArrayPat);
pat_to_other!(ObjectPat);
pat_to_other!(Box<ArrayPat>);
pat_to_other!(Box<ObjectPat>);
pat_to_other!(AssignPat);
pat_to_other!(RestPat);
pat_to_other!(Box<Expr>);
Expand Down

0 comments on commit d8794f4

Please sign in to comment.