[PATCH] D30705: clang-format: [JS] allow breaking after non-null assertions.
Daniel Jasper via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 7 10:38:06 PST 2017
djasper added inline comments.
================
Comment at: lib/Format/TokenAnnotator.cpp:2292
return false;
- // Postfix non-null assertion operator, as in `foo!.bar()`.
- if (Right.is(tok::exclaim) && (Left.isOneOf(tok::identifier, tok::r_paren,
- tok::r_square, tok::r_brace) ||
- Left.Tok.isLiteral()))
+ if (isJSNonNullOperator(Right))
return false;
----------------
Hm. Generally, we try to set the TokenType instead of computing this information multiple times. It's not overly important here, but I can easily foresee that we are going to need to know what kind of "!" this is in ContinuationIndenter.cpp at some point. So I'd suggest to move this code into the huge mess that is determineTokenType (and define corresponding token type in FormatToken.h).
https://reviews.llvm.org/D30705
More information about the cfe-commits
mailing list