clang-format: [JS] Support annotated classes.

llvm-svn: 272654
This commit is contained in:
Daniel Jasper 2016-06-14 11:28:02 +00:00
parent 985c0c274b
commit 6465008e0e
2 changed files with 7 additions and 1 deletions

View File

@ -1461,7 +1461,8 @@ private:
return Current->getPrecedence();
if (Current->isOneOf(tok::period, tok::arrow))
return PrecedenceArrowAndPeriod;
if (Style.Language == FormatStyle::LK_Java &&
if ((Style.Language == FormatStyle::LK_Java ||
Style.Language == FormatStyle::LK_JavaScript) &&
Current->isOneOf(Keywords.kw_extends, Keywords.kw_implements,
Keywords.kw_throws))
return 0;

View File

@ -948,6 +948,11 @@ TEST_F(FormatTestJS, ClassDeclarations) {
" },\n"
" };\n"
"}");
verifyFormat("@Component({\n"
" moduleId: module.id,\n"
"})\n"
"class SessionListComponent implements OnDestroy, OnInit {\n"
"}");
}
TEST_F(FormatTestJS, InterfaceDeclarations) {