From: Daniel Jasper Date: Mon, 6 Jul 2015 14:26:04 +0000 (+0000) Subject: clang-format: [JS] Properly reset parse state after parsing interface. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=904365edb126fca6434a14dc241686a8734b485c;p=clang clang-format: [JS] Properly reset parse state after parsing interface. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@241446 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Format/UnwrappedLineParser.cpp b/lib/Format/UnwrappedLineParser.cpp index 7fd07a269e..345e109be8 100644 --- a/lib/Format/UnwrappedLineParser.cpp +++ b/lib/Format/UnwrappedLineParser.cpp @@ -900,7 +900,7 @@ void UnwrappedLineParser::parseStructuralElement() { FormatTok->is(Keywords.kw_interface)) { parseRecord(); addUnwrappedLine(); - break; + return; } StringRef Text = FormatTok->TokenText; diff --git a/unittests/Format/FormatTestJS.cpp b/unittests/Format/FormatTestJS.cpp index d8e17f9d8d..24891f54a6 100644 --- a/unittests/Format/FormatTestJS.cpp +++ b/unittests/Format/FormatTestJS.cpp @@ -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) {