Skip to content

Commit a2dae28

Browse files
committed
fix(formatter): Add parentheses for await and yield inside PrivateInExpression
1 parent fa866b3 commit a2dae28

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

crates/oxc_formatter/src/parentheses/expression.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,8 @@ fn await_or_yield_needs_parens(span: Span, node: &AstNodes<'_>) -> bool {
931931
| AstNodes::TSSatisfiesExpression(_)
932932
| AstNodes::SpreadElement(_)
933933
| AstNodes::LogicalExpression(_)
934-
| AstNodes::BinaryExpression(_),
934+
| AstNodes::BinaryExpression(_)
935+
| AstNodes::PrivateInExpression(_),
935936
) {
936937
return true;
937938
}

tasks/coverage/snapshots/formatter_test262.snap

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

33
formatter_test262 Summary:
44
AST Parsed : 44517/44517 (100.00%)
5-
Positive Passed: 44513/44517 (99.99%)
5+
Positive Passed: 44514/44517 (99.99%)
66
Mismatch: tasks/coverage/test262/test/built-ins/Function/prototype/toString/line-terminator-normalisation-CR-LF.js
77

88
Mismatch: tasks/coverage/test262/test/built-ins/Function/prototype/toString/line-terminator-normalisation-CR.js
99

1010
Mismatch: tasks/coverage/test262/test/built-ins/Function/prototype/toString/line-terminator-normalisation-LF.js
1111

12-
Expect to Parse: tasks/coverage/test262/test/language/expressions/in/private-field-rhs-yield-present.js
13-
Cannot use `yield` as an identifier in a generator context

0 commit comments

Comments
 (0)