fix(codegen): remove parens from new (import(''), function() {}) (#8707)

This commit is contained in:
Boshen 2025-01-25 10:07:18 +00:00
parent f15bdce53b
commit 0944758cc7
2 changed files with 2 additions and 1 deletions

View file

@ -2069,7 +2069,7 @@ impl Gen for AssignmentTargetRest<'_> {
impl GenExpr for SequenceExpression<'_> {
fn gen_expr(&self, p: &mut Codegen, precedence: Precedence, ctx: Context) {
p.wrap(precedence >= self.precedence(), |p| {
p.print_expressions(&self.expressions, Precedence::Lowest, ctx);
p.print_expressions(&self.expressions, Precedence::Lowest, ctx.and_forbid_call(false));
});
}
}

View file

@ -40,6 +40,7 @@ fn expr() {
test_minify("delete 2e308", "delete(1/0);");
test_minify_same(r#"({"http://a\r\" \n<'b:b@c\r\nd/e?f":{}});"#);
test_minify_same("new(import(\"\"),function(){});");
}
#[test]