mprobst added inline comments.
================
Comment at: lib/Format/TokenAnnotator.cpp:2127
@@ +2126,3 @@
+ // Postfix non-null assertion operator, as in `foo!.bar()`.
+ if (Right.is(tok::exclaim) && Right.Next &&
+ Right.Next->isNot(tok::identifier) && !Right.Next->Tok.isLiteral())
----------------
djasper wrote:
> From a quick look at our codebase, I think you need to also rule out the
> following for Right.Next:
>
> - (, [, {
> - ! ('!!' seems to be a thing)
> - -, +, ~ (don't know exactly what this does to a JS boolean value)
> - %, $ (not entirely sure whether these become part of the identifier)
>
>
Actually, I think inverting the condition and "whitelisting" preceding tokens
makes more sense and is probably a lot more robust. PTAL, now checking left for
identifier, r_paren, r_square, literal.
http://reviews.llvm.org/D21204
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits