Skip to content

Commit 4582f48

Browse files
committed
fix: do not fold assignment expression
1 parent d2a510f commit 4582f48

File tree

1 file changed

+2
-1
lines changed
  • crates/jsshaker/src/folding

1 file changed

+2
-1
lines changed

crates/jsshaker/src/folding/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ pub fn maybe_foldable_expr(node: &Expression) -> bool {
113113
match node {
114114
match_member_expression!(Expression) => true,
115115

116+
Expression::AssignmentExpression(_) => false, // Avoid (a=(b=1),1)
117+
116118
Expression::StringLiteral(_)
117119
| Expression::NumericLiteral(_)
118120
| Expression::BigIntLiteral(_)
@@ -141,7 +143,6 @@ pub fn maybe_foldable_expr(node: &Expression) -> bool {
141143
| Expression::AwaitExpression(_)
142144
| Expression::YieldExpression(_)
143145
| Expression::ArrayExpression(_)
144-
| Expression::AssignmentExpression(_)
145146
| Expression::ChainExpression(_)
146147
| Expression::MetaProperty(_)
147148
| Expression::PrivateInExpression(_)

0 commit comments

Comments
 (0)