forked from OSchip/llvm-project
clang-format: [JS] Support arrays of object-type literals.
Before: interface I { o: {} []; } After: interface I { o: {}[]; } llvm-svn: 256247
This commit is contained in:
parent
e2deb59fa3
commit
b542f9f144
|
@ -357,7 +357,7 @@ void UnwrappedLineParser::calculateBraceTypes(bool ExpectClassBody) {
|
|||
ProbablyBracedList =
|
||||
NextTok->isOneOf(tok::comma, tok::period, tok::colon,
|
||||
tok::r_paren, tok::r_square, tok::l_brace,
|
||||
tok::l_paren, tok::ellipsis) ||
|
||||
tok::l_square, tok::l_paren, tok::ellipsis) ||
|
||||
(NextTok->is(tok::semi) &&
|
||||
(!ExpectClassBody || LBraceStack.size() != 1)) ||
|
||||
(NextTok->isBinaryOperator() && !NextIsObjCMethod);
|
||||
|
|
|
@ -768,6 +768,11 @@ TEST_F(FormatTestJS, InterfaceDeclarations) {
|
|||
verifyFormat("interface a {}\n"
|
||||
"export function b() {}\n"
|
||||
"var x;");
|
||||
|
||||
// Arrays of object type literals.
|
||||
verifyFormat("interface I {\n"
|
||||
" o: {}[];\n"
|
||||
"}");
|
||||
}
|
||||
|
||||
TEST_F(FormatTestJS, EnumDeclarations) {
|
||||
|
|
Loading…
Reference in New Issue