Skip to content

Commit

Permalink
fix(codegen): fix whitespace issue when minifying x in new Error() (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
Boshen committed Aug 14, 2024
1 parent c164bb8 commit e8de4bd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions crates/oxc_codegen/src/gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2101,6 +2101,7 @@ impl<'a, const MINIFY: bool> GenExpr<MINIFY> for NewExpression<'a> {
if let Some(comment) = annotate_comment {
p.print_comment(comment);
}
p.print_space_before_identifier();
p.add_source_mapping(self.span.start);
p.print_str("new ");
self.callee.gen_expr(p, Precedence::New, Context::FORBID_CALL);
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 @@ -17,6 +17,7 @@ fn expr() {
}",
"class Foo {\n\t#test;\n\tbar() {\n\t\tif (!(#test in Foo)) {}\n\t}\n}\n",
);
test_minify("x in new Error()", "x in new Error();");
}

#[test]
Expand Down

0 comments on commit e8de4bd

Please sign in to comment.