kevinl added inline comments.

================
Comment at: lib/Format/TokenAnnotator.cpp:1497
+        !(PrevToken->is(tok::exclaim) &&
+          Style.Language == FormatStyle::LK_JavaScript))
       // There aren't any trailing unary operators except for TypeScript's
----------------
krasimir wrote:
> I think that TypeScript has both `if (!cond)` and `x!`. I'd expect that `if 
> (!+i) {\n}` is also handled in the TypeScript case. Could you add a test for 
> this for TypeScript please.
Turns out the comment below was misleading. The `x!` operator is classified as 
`TT_JsNonNullAssertion` and not `TT_UnaryOperator`, so removing the check for 
`tok::exclaim` entirely fixes `if (!+i) {\n}` in TypeScript as well as C++. 
Tests are now added for both languages


Repository:
  rC Clang

https://reviews.llvm.org/D43312



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to