fix(rome_js_parser): consume `...` in import expression
consume `...` in import expression
MODIFY
crates/rome_js_parser/src/syntax/expr.rs
crates/rome_js_parser/src/syntax/expr.rs
@@ -1236,10 +1236,15 @@ fn parse_primary_expression(p: &mut Parser, context: ExpressionContext) -> Parse
}
if p.at(T![...]) {
- let err = p
- .err_builder("`...` is not allowed in `import()`")
- .primary(p.cur_range(), "");
- p.error(err);
+ parse_spread_element(p, context)
+ .add_diagnostic_if_present(p, |p, range| {
+ p.err_builder("`...` is not allowed in `import()`")
+ .primary(range, "")
+ })
+ .map(|mut marker| {
+ marker.change_to_unknown(p);
+ marker
+ });
} else {
parse_assignment_expression_or_higher(p, ExpressionContext::default())
.or_add_diagnostic(p, js_parse_error::expected_expression_assignment);

fix(rome_js_parser): consume `...` in import expression (#2468)

consume `...` in import expression