Skip to content

Commit

Permalink
Fix parser
Browse files Browse the repository at this point in the history
  • Loading branch information
kdy1 committed Aug 12, 2024
1 parent 0dc6acc commit 72ecaea
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion crates/swc_ecma_parser/src/parser/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,13 @@ impl<I: Tokens> Parser<I> {
elems.push(
self.include_in_expr(true)
.parse_expr_or_spread()
.map(Some)?,
.map(|x| match x {
ExprOrSpread { spread: None, expr } => ArrayElement::Expr(expr),
ExprOrSpread { spread, expr } => ArrayElement::Spread(Spread {
span: spread.unwrap(),
expr,
}),
})?,
);
if !is!(self, ']') {
expect!(self, ',');
Expand Down

0 comments on commit 72ecaea

Please sign in to comment.