[PATCH] clang-format: [js] Do not fall through for JS structural elements.

Martin Probst martinprobst at google.com
Thu Feb 19 07:07:35 PST 2015


Hi djasper,

http://reviews.llvm.org/D7759

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

Index: lib/Format/UnwrappedLineParser.cpp
===================================================================
--- lib/Format/UnwrappedLineParser.cpp
+++ lib/Format/UnwrappedLineParser.cpp
@@ -1526,7 +1526,8 @@
   // class A {} n, m;
   // will end up in one unwrapped line.
   // This does not apply for Java.
-  if (Style.Language == FormatStyle::LK_Java)
+  if (Style.Language == FormatStyle::LK_Java ||
+      Style.Language == FormatStyle::LK_JavaScript)
     addUnwrappedLine();
 }
 
Index: unittests/Format/FormatTestJS.cpp
===================================================================
--- unittests/Format/FormatTestJS.cpp
+++ unittests/Format/FormatTestJS.cpp
@@ -521,6 +521,8 @@
                "    return 'y';\n"
                "  }\n"
                "}");
+  verifyFormat("class X {}\n"
+               "class Y {}");
 }
 
 TEST_F(FormatTestJS, Modules) {

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7759.20298.patch
Type: text/x-patch
Size: 876 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150219/01dc5a6b/attachment.bin>


More information about the cfe-commits mailing list