This revision was automatically updated to reflect the committed changes.
Closed by commit rL272524: clang-format: [JS] post-fix non-null assertion
operator. (authored by mprobst).
Changed prior to commit:
http://reviews.llvm.org/D21204?vs=60311&id=60482#toc
Repository:
rL LLVM
http://revie
mprobst added inline comments.
Comment at: lib/Format/TokenAnnotator.cpp:2128
@@ +2127,3 @@
+if (Right.is(tok::exclaim) && (Left.isOneOf(tok::identifier, tok::r_paren,
+tok::r_square, tok::r_brace) ||
+
mprobst updated this revision to Diff 60311.
mprobst added a comment.
- more tests
http://reviews.llvm.org/D21204
Files:
lib/Format/TokenAnnotator.cpp
unittests/Format/FormatTestJS.cpp
Index: unittests/Format/FormatTestJS.cpp
djasper accepted this revision.
This revision is now accepted and ready to land.
Comment at: lib/Format/TokenAnnotator.cpp:2128
@@ +2127,3 @@
+if (Right.is(tok::exclaim) &&
+(Left.isOneOf(tok::identifier, tok::r_paren, tok::r_square) ||
+ Left.Tok.isLiteral()))
mprobst updated this revision to Diff 60308.
mprobst marked an inline comment as done.
mprobst added a comment.
- invert check to whitelist known tokens that can precede a non-null assertion.
http://reviews.llvm.org/D21204
Files:
lib/Format/TokenAnnotator.cpp
unittests/Format/FormatTestJS.c
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 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()