Skip to content

Commit

Permalink
fix(codegen): print parentheses correctly for ClassHeritage (#7637)
Browse files Browse the repository at this point in the history
closes #7631
  • Loading branch information
Boshen committed Dec 4, 2024
1 parent d2767be commit e787e9d
Show file tree
Hide file tree
Showing 2 changed files with 3 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 @@ -2185,7 +2185,7 @@ impl Gen for Class<'_> {
}
if let Some(super_class) = self.super_class.as_ref() {
p.print_str(" extends ");
super_class.print_expr(p, Precedence::Call, Context::empty());
super_class.print_expr(p, Precedence::Postfix, Context::empty());
if let Some(super_type_parameters) = &self.super_type_parameters {
super_type_parameters.print(p, ctx);
}
Expand Down
2 changes: 2 additions & 0 deletions crates/oxc_codegen/tests/integration/esbuild.rs
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,8 @@ fn test_class() {
test("class Foo { static foo() {} }", "class Foo {\n\tstatic foo() {}\n}\n");
test("class Foo { static get foo() {} }", "class Foo {\n\tstatic get foo() {}\n}\n");
test("class Foo { static set foo(x) {} }", "class Foo {\n\tstatic set foo(x) {}\n}\n");

test("class Foo extends foo() {}", "class Foo extends foo() {}\n");
}

#[test]
Expand Down

0 comments on commit e787e9d

Please sign in to comment.