llvm
4c9d6914 - clang-format: [JS] fix `??` opreator wrapping.

Commit
6 years ago
clang-format: [JS] fix `??` opreator wrapping. Summary: clang-format currently treats the nullish coalescing operator `??` like the ternary operator. That causes multiple nullish terms to be each indented relative to the last `??`, as they would in a ternary. The `??` operator is often used in chains though, and as such more similar to other binary operators, such as `||`. So to fix the indent, set its token type to `||`, so it inherits the same treatment. This opens up the question of operator precedence. However, `??` is required to be parenthesized when mixed with `||` and `&&`, so this is not a problem that can come up in syntactically legal code. Reviewers: krasimir Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D73026
Author
Committer
Parents
Loading