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

Daniel Jasper djasper at google.com
Thu Feb 19 08:03:16 PST 2015


Author: djasper
Date: Thu Feb 19 10:03:16 2015
New Revision: 229862

URL: http://llvm.org/viewvc/llvm-project?rev=229862&view=rev
Log:
clang-format: [js] Do not fall through for JS structural elements.

Patch by Martin Probst. Thank you.

Modified:
    cfe/trunk/lib/Format/UnwrappedLineParser.cpp
    cfe/trunk/unittests/Format/FormatTestJS.cpp

Modified: cfe/trunk/lib/Format/UnwrappedLineParser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/UnwrappedLineParser.cpp?rev=229862&r1=229861&r2=229862&view=diff
==============================================================================
--- cfe/trunk/lib/Format/UnwrappedLineParser.cpp (original)
+++ cfe/trunk/lib/Format/UnwrappedLineParser.cpp Thu Feb 19 10:03:16 2015
@@ -1519,7 +1519,8 @@ void UnwrappedLineParser::parseRecord()
   // 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();
 }
 

Modified: cfe/trunk/unittests/Format/FormatTestJS.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTestJS.cpp?rev=229862&r1=229861&r2=229862&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTestJS.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTestJS.cpp Thu Feb 19 10:03:16 2015
@@ -521,6 +521,8 @@ TEST_F(FormatTestJS, MetadataAnnotations
                "    return 'y';\n"
                "  }\n"
                "}");
+  verifyFormat("class X {}\n"
+               "class Y {}");
 }
 
 } // end namespace tooling





More information about the cfe-commits mailing list