r239593 - clang-format: [JS] Fix regression caused by r239592.

Daniel Jasper djasper at google.com
Thu Jun 11 21:56:35 PDT 2015


Author: djasper
Date: Thu Jun 11 23:56:34 2015
New Revision: 239593

URL: http://llvm.org/viewvc/llvm-project?rev=239593&view=rev
Log:
clang-format: [JS] Fix regression caused by r239592.

Without it, it would do:

  interface I {
    x: string;
  } var y;

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=239593&r1=239592&r2=239593&view=diff
==============================================================================
--- cfe/trunk/lib/Format/UnwrappedLineParser.cpp (original)
+++ cfe/trunk/lib/Format/UnwrappedLineParser.cpp Thu Jun 11 23:56:34 2015
@@ -854,6 +854,7 @@ void UnwrappedLineParser::parseStructura
            Style.Language == FormatStyle::LK_Java) &&
           FormatTok->is(Keywords.kw_interface)) {
         parseRecord();
+        addUnwrappedLine();
         break;
       }
 

Modified: cfe/trunk/unittests/Format/FormatTestJS.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTestJS.cpp?rev=239593&r1=239592&r2=239593&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTestJS.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTestJS.cpp Thu Jun 11 23:56:34 2015
@@ -665,7 +665,8 @@ TEST_F(FormatTestJS, ClassDeclarations)
 TEST_F(FormatTestJS, InterfaceDeclarations) {
   verifyFormat("interface I {\n"
                "  x: string;\n"
-               "}");
+               "}\n"
+               "var y;");
 }
 
 TEST_F(FormatTestJS, MetadataAnnotations) {





More information about the cfe-commits mailing list