forked from OSchip/llvm-project
clang-format: [JS] Properly format dict literals that skip labels.
llvm-svn: 288121
This commit is contained in:
parent
22ed262c23
commit
e98e58111b
|
@ -442,6 +442,9 @@ private:
|
|||
Style.Language == FormatStyle::LK_JavaScript)
|
||||
Left->Type = TT_DictLiteral;
|
||||
}
|
||||
if (CurrentToken->is(tok::comma) &&
|
||||
Style.Language == FormatStyle::LK_JavaScript)
|
||||
Left->Type = TT_DictLiteral;
|
||||
if (!consumeToken())
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -259,6 +259,13 @@ TEST_F(FormatTestJS, ContainerLiterals) {
|
|||
" b: b,\n"
|
||||
" 'c': c,\n"
|
||||
"};");
|
||||
|
||||
// Dict literals can skip the label names.
|
||||
verifyFormat("var x = {\n"
|
||||
" aaa,\n"
|
||||
" aaa,\n"
|
||||
" aaa,\n"
|
||||
"};");
|
||||
}
|
||||
|
||||
TEST_F(FormatTestJS, MethodsInObjectLiterals) {
|
||||
|
|
Loading…
Reference in New Issue