[PATCH] D24272: clang-format: [JS] whitespace required between ! and as.

Martin Probst via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 6 12:04:09 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL280731: clang-format: [JS] whitespace required between ! and as. (authored by mprobst).

Changed prior to commit:
  https://reviews.llvm.org/D24272?vs=70442&id=70446#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D24272

Files:
  cfe/trunk/lib/Format/TokenAnnotator.cpp
  cfe/trunk/unittests/Format/FormatTestJS.cpp

Index: cfe/trunk/lib/Format/TokenAnnotator.cpp
===================================================================
--- cfe/trunk/lib/Format/TokenAnnotator.cpp
+++ cfe/trunk/lib/Format/TokenAnnotator.cpp
@@ -2158,6 +2158,8 @@
                                                 tok::r_square, tok::r_brace) ||
                                    Left.Tok.isLiteral()))
       return false;
+    if (Left.is(tok::exclaim) && Right.is(Keywords.kw_as))
+      return true; // "x! as string"
   } else if (Style.Language == FormatStyle::LK_Java) {
     if (Left.is(tok::r_square) && Right.is(tok::l_brace))
       return true;
Index: cfe/trunk/unittests/Format/FormatTestJS.cpp
===================================================================
--- cfe/trunk/unittests/Format/FormatTestJS.cpp
+++ cfe/trunk/unittests/Format/FormatTestJS.cpp
@@ -1236,6 +1236,7 @@
   verifyFormat("x = x as [a, b];");
   verifyFormat("x = x as {a: string};");
   verifyFormat("x = x as (string);");
+  verifyFormat("x = x! as (string);");
 }
 
 TEST_F(FormatTestJS, TypeArguments) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24272.70446.patch
Type: text/x-patch
Size: 1058 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160906/66a04140/attachment.bin>


More information about the cfe-commits mailing list