forked from OSchip/llvm-project
clang-format: [JS] Don't count shortened object literals as blocks.
Before: f({a}, () => { g(); // }); After: f({a}, () => { g(); // }); llvm-svn: 260060
This commit is contained in:
parent
d64186f5da
commit
9f4c9d418f
|
@ -423,7 +423,7 @@ private:
|
|||
}
|
||||
|
||||
void updateParameterCount(FormatToken *Left, FormatToken *Current) {
|
||||
if (Current->is(tok::l_brace) && !Current->is(TT_DictLiteral))
|
||||
if (Current->is(tok::l_brace) && Current->BlockKind == BK_Block)
|
||||
++Left->BlockParameterCount;
|
||||
if (Current->is(tok::comma)) {
|
||||
++Left->ParameterCount;
|
||||
|
|
|
@ -200,6 +200,11 @@ TEST_F(FormatTestJS, ContainerLiterals) {
|
|||
" b: 2,\n"
|
||||
" [c]: 3,\n"
|
||||
"};");
|
||||
|
||||
// Object literals can leave out labels.
|
||||
verifyFormat("f({a}, () => {\n"
|
||||
" g(); //\n"
|
||||
"});");
|
||||
}
|
||||
|
||||
TEST_F(FormatTestJS, MethodsInObjectLiterals) {
|
||||
|
|
Loading…
Reference in New Issue