Skip to content

Commit

Permalink
perf(es/ast): Make Expr 64 bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Feb 27, 2025
1 parent f1381a1 commit 1b8fa42
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions crates/swc_ecma_ast/src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ pub enum Expr {
Bin(BinExpr),

#[tag("AssignmentExpression")]
Assign(AssignExpr),
Assign(Box<AssignExpr>),

//
// Logical {
Expand All @@ -79,7 +79,7 @@ pub enum Expr {
Cond(CondExpr),

#[tag("CallExpression")]
Call(CallExpr),
Call(Box<CallExpr>),

/// `new Cat()`
#[tag("NewExpression")]
Expand Down Expand Up @@ -107,7 +107,7 @@ pub enum Expr {
TaggedTpl(TaggedTpl),

#[tag("ArrowFunctionExpression")]
Arrow(ArrowExpr),
Arrow(Box<ArrowExpr>),

#[tag("ClassExpression")]
Class(ClassExpr),
Expand Down Expand Up @@ -449,18 +449,18 @@ boxed_expr!(FnExpr);
boxed_expr!(UnaryExpr);
boxed_expr!(UpdateExpr);
boxed_expr!(BinExpr);
boxed_expr!(AssignExpr);
boxed_expr!(Box<AssignExpr>);
boxed_expr!(MemberExpr);
boxed_expr!(SuperPropExpr);
boxed_expr!(CondExpr);
boxed_expr!(CallExpr);
boxed_expr!(Box<CallExpr>);
boxed_expr!(NewExpr);
boxed_expr!(SeqExpr);
bridge_from!(Box<Expr>, Expr, Ident);
boxed_expr!(Lit);
boxed_expr!(Tpl);
boxed_expr!(TaggedTpl);
boxed_expr!(ArrowExpr);
boxed_expr!(Box<ArrowExpr>);
boxed_expr!(ClassExpr);
boxed_expr!(YieldExpr);
boxed_expr!(MetaPropExpr);
Expand Down Expand Up @@ -1706,13 +1706,13 @@ impl From<OptChainBase> for Expr {
callee,
args,
type_args,
}) => Self::Call(CallExpr {
}) => Self::Call(Box::new(CallExpr {
callee: Callee::Expr(callee),
args,
span,
type_args,
ctxt,
}),
})),
OptChainBase::Member(member) => Self::Member(member),
}
}
Expand Down Expand Up @@ -1746,6 +1746,7 @@ impl From<OptCall> for CallExpr {
}
}

bridge_expr_from!(Box<CallExpr>, CallExpr);
bridge_expr_from!(CallExpr, OptCall);

test_de!(
Expand Down

0 comments on commit 1b8fa42

Please sign in to comment.