Hi djasper,

http://reviews.llvm.org/D9494

Files:
  lib/Format/UnwrappedLineFormatter.cpp
  unittests/Format/FormatTestJS.cpp

Index: lib/Format/UnwrappedLineFormatter.cpp
===================================================================
--- lib/Format/UnwrappedLineFormatter.cpp
+++ lib/Format/UnwrappedLineFormatter.cpp
@@ -239,7 +239,8 @@
     } else if (Limit != 0 && Line.First->isNot(tok::kw_namespace) &&
                !startsExternCBlock(Line)) {
       // We don't merge short records.
-      if (Line.First->isOneOf(tok::kw_class, tok::kw_union, tok::kw_struct))
+      if (Line.First->isOneOf(tok::kw_class, tok::kw_union, tok::kw_struct,
+                              Keywords.kw_interface))
         return 0;
 
       // Check that we still have three lines and they fit into the limit.
Index: unittests/Format/FormatTestJS.cpp
===================================================================
--- unittests/Format/FormatTestJS.cpp
+++ unittests/Format/FormatTestJS.cpp
@@ -547,6 +547,12 @@
   verifyFormat("class C extends p.P implements i.I {}");
 }
 
+TEST_F(FormatTestJS, InterfaceDeclarations) {
+  verifyFormat("interface I {\n"
+               "  x: string;\n"
+               "}");
+}
+
 TEST_F(FormatTestJS, MetadataAnnotations) {
   verifyFormat("@A\nclass C {\n}");
   verifyFormat("@A({arg: 'value'})\nclass C {\n}");
@@ -703,7 +709,9 @@
                "  y?: z;\n"
                "  z?;\n"
                "}");
-  verifyFormat("interface X { y?(): z; }");
+  verifyFormat("interface X {\n"
+               "  y?(): z;\n"
+               "}");
   verifyFormat("x ? 1 : 2;");
 }

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
Index: lib/Format/UnwrappedLineFormatter.cpp
===================================================================
--- lib/Format/UnwrappedLineFormatter.cpp
+++ lib/Format/UnwrappedLineFormatter.cpp
@@ -239,7 +239,8 @@
     } else if (Limit != 0 && Line.First->isNot(tok::kw_namespace) &&
                !startsExternCBlock(Line)) {
       // We don't merge short records.
-      if (Line.First->isOneOf(tok::kw_class, tok::kw_union, tok::kw_struct))
+      if (Line.First->isOneOf(tok::kw_class, tok::kw_union, tok::kw_struct,
+                              Keywords.kw_interface))
         return 0;
 
       // Check that we still have three lines and they fit into the limit.
Index: unittests/Format/FormatTestJS.cpp
===================================================================
--- unittests/Format/FormatTestJS.cpp
+++ unittests/Format/FormatTestJS.cpp
@@ -547,6 +547,12 @@
   verifyFormat("class C extends p.P implements i.I {}");
 }
 
+TEST_F(FormatTestJS, InterfaceDeclarations) {
+  verifyFormat("interface I {\n"
+               "  x: string;\n"
+               "}");
+}
+
 TEST_F(FormatTestJS, MetadataAnnotations) {
   verifyFormat("@A\nclass C {\n}");
   verifyFormat("@A({arg: 'value'})\nclass C {\n}");
@@ -703,7 +709,9 @@
                "  y?: z;\n"
                "  z?;\n"
                "}");
-  verifyFormat("interface X { y?(): z; }");
+  verifyFormat("interface X {\n"
+               "  y?(): z;\n"
+               "}");
   verifyFormat("x ? 1 : 2;");
 }
 
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to