]> granicus.if.org Git - clang/commitdiff
clang-format: [JS] Properly reset parse state after parsing interface.
authorDaniel Jasper <djasper@google.com>
Mon, 6 Jul 2015 14:26:04 +0000 (14:26 +0000)
committerDaniel Jasper <djasper@google.com>
Mon, 6 Jul 2015 14:26:04 +0000 (14:26 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241446 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 7fd07a269e345b55ffe83c26ba976bd060537b48..345e109be8f715ff5eaa48e2b101b2515375df8a 100644 (file)
@@ -900,7 +900,7 @@ void UnwrappedLineParser::parseStructuralElement() {
           FormatTok->is(Keywords.kw_interface)) {
         parseRecord();
         addUnwrappedLine();
-        break;
+        return;
       }
 
       StringRef Text = FormatTok->TokenText;
index d8e17f9d8d699054a036b5a61c90dde28e1922e7..24891f54a6e3e979502149de13488715dd3cd322 100644 (file)
@@ -703,6 +703,10 @@ TEST_F(FormatTestJS, InterfaceDeclarations) {
                "  x: string;\n"
                "}\n"
                "var y;");
+  // Ensure that state is reset after parsing the interface.
+  verifyFormat("interface a {}\n"
+               "export function b() {}\n"
+               "var x;");
 }
 
 TEST_F(FormatTestJS, EnumDeclarations) {