diff options
Diffstat (limited to 'clang')
-rw-r--r-- | clang/lib/Format/UnwrappedLineParser.cpp | 2 | ||||
-rw-r--r-- | clang/unittests/Format/FormatTestJS.cpp | 6 |
2 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp index 27e2f84d245..26ba929175d 100644 --- a/clang/lib/Format/UnwrappedLineParser.cpp +++ b/clang/lib/Format/UnwrappedLineParser.cpp @@ -841,6 +841,8 @@ void UnwrappedLineParser::parseStructuralElement() { // This does not apply for Java and JavaScript. if (Style.Language == FormatStyle::LK_Java || Style.Language == FormatStyle::LK_JavaScript) { + if (FormatTok->is(tok::semi)) + nextToken(); addUnwrappedLine(); return; } diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp index 2f1ba5bc146..cbfa2a33205 100644 --- a/clang/unittests/Format/FormatTestJS.cpp +++ b/clang/unittests/Format/FormatTestJS.cpp @@ -755,6 +755,12 @@ TEST_F(FormatTestJS, ClassDeclarations) { " aaaaaaaaaaaaaaaa(aaaaaaaaaaaaaaa: aaaaaaaaaaaaaaaaaaaa):\n" " aaaaaaaaaaaaaaaaaaaaaa {}\n" "}"); + verifyFormat("foo = class Name {\n" + " constructor() {}\n" + "};"); + verifyFormat("foo = class {\n" + " constructor() {}\n" + "};"); // ':' is not a type declaration here. verifyFormat("class X {\n" |