Skip to content

Commit b43ad49

Browse files
authored
fix(formatter): Add parentheses for PrivateInExpression in super class (#13806)
1 parent 7879f85 commit b43ad49

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

crates/oxc_formatter/src/parentheses/expression.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ fn is_in_for_initializer(expr: &AstNode<'_, BinaryExpression<'_>>) -> bool {
367367
impl<'a> NeedsParentheses<'a> for AstNode<'a, PrivateInExpression<'a>> {
368368
#[inline]
369369
fn needs_parentheses(&self, f: &Formatter<'_, 'a>) -> bool {
370-
false
370+
is_class_extends(self.span, self.parent)
371371
}
372372
}
373373

tasks/coverage/snapshots/formatter_babel.snap

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@ commit: 41d96516
22

33
formatter_babel Summary:
44
AST Parsed : 2423/2423 (100.00%)
5-
Positive Passed: 2419/2423 (99.83%)
5+
Positive Passed: 2420/2423 (99.88%)
66
Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/comments/basic/try-statement/input.js
77

88
Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/comments/regression/13750/input.js
99

1010
Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/es2015/class/division/input.js
1111

12-
Expect to Parse: tasks/coverage/babel/packages/babel-parser/test/fixtures/es2022/private-in/private-in-class-heritage/input.js
13-

0 commit comments

Comments
 (0)