summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--clang/lib/Format/UnwrappedLineParser.cpp2
-rw-r--r--clang/unittests/Format/FormatTestJS.cpp4
2 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp
index 7fd07a269e3..345e109be8f 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/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/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp
index d8e17f9d8d6..24891f54a6e 100644
--- a/clang/unittests/Format/FormatTestJS.cpp
+++ b/clang/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) {
OpenPOWER on IntegriCloud