r241446 - clang-format: [JS] Properly reset parse state after parsing interface.
Daniel Jasper
djasper at google.com
Mon Jul 6 07:26:05 PDT 2015
Author: djasper
Date: Mon Jul 6 09:26:04 2015
New Revision: 241446
URL: http://llvm.org/viewvc/llvm-project?rev=241446&view=rev
Log:
clang-format: [JS] Properly reset parse state after parsing interface.
Modified:
cfe/trunk/lib/Format/UnwrappedLineParser.cpp
cfe/trunk/unittests/Format/FormatTestJS.cpp
Modified: cfe/trunk/lib/Format/UnwrappedLineParser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/UnwrappedLineParser.cpp?rev=241446&r1=241445&r2=241446&view=diff
==============================================================================
--- cfe/trunk/lib/Format/UnwrappedLineParser.cpp (original)
+++ cfe/trunk/lib/Format/UnwrappedLineParser.cpp Mon Jul 6 09:26:04 2015
@@ -900,7 +900,7 @@ void UnwrappedLineParser::parseStructura
FormatTok->is(Keywords.kw_interface)) {
parseRecord();
addUnwrappedLine();
- break;
+ return;
}
StringRef Text = FormatTok->TokenText;
Modified: cfe/trunk/unittests/Format/FormatTestJS.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/FormatTestJS.cpp?rev=241446&r1=241445&r2=241446&view=diff
==============================================================================
--- cfe/trunk/unittests/Format/FormatTestJS.cpp (original)
+++ cfe/trunk/unittests/Format/FormatTestJS.cpp Mon Jul 6 09:26:04 2015
@@ -703,6 +703,10 @@ TEST_F(FormatTestJS, InterfaceDeclaratio
" 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) {
More information about the cfe-commits
mailing list