From 904365edb126fca6434a14dc241686a8734b485c Mon Sep 17 00:00:00 2001 From: Daniel Jasper Date: Mon, 6 Jul 2015 14:26:04 +0000 Subject: [PATCH] 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 --- lib/Format/UnwrappedLineParser.cpp | 2 +- unittests/Format/FormatTestJS.cpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) 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) { -- 2.40.0