]> granicus.if.org Git - clang/commitdiff
clang-format: [JS] Fix regression caused by r239592.
authorDaniel Jasper <djasper@google.com>
Fri, 12 Jun 2015 04:56:34 +0000 (04:56 +0000)
committerDaniel Jasper <djasper@google.com>
Fri, 12 Jun 2015 04:56:34 +0000 (04:56 +0000)
Without it, it would do:

  interface I {
    x: string;
  } var y;

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239593 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 7f5df7dfba7779e3fe1368c4dd5d3fce625d5950..2762979b6bd01f737e211898be98a637c0420aad 100644 (file)
@@ -854,6 +854,7 @@ void UnwrappedLineParser::parseStructuralElement() {
            Style.Language == FormatStyle::LK_Java) &&
           FormatTok->is(Keywords.kw_interface)) {
         parseRecord();
+        addUnwrappedLine();
         break;
       }
 
index e01637bfad431036c4a625152ed82d7da006aa52..0f9f38240a3687a3208cd36299550db0ad3a346e 100644 (file)
@@ -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) {