Skip to content

Commit

Permalink
fix(codegen): remove parens from new (import(''), function() {}) (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Boshen committed Jan 25, 2025
1 parent f15bdce commit 0944758
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion crates/oxc_codegen/src/gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
});
}
}
Expand Down
1 change: 1 addition & 0 deletions crates/oxc_codegen/tests/integration/unit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 0944758

Please sign in to comment.