forked from OSchip/llvm-project
clang-format: [JS] Tweak behavior for multiline array initializer parameters
Before: var someVariable = SomeFuntion(aaaa, [ aaaaaaaaaaaaaaaaaaaaaaaaaaa, bbbbbbbbbbbbbbbbbbbbbbbbbbb, ccccccccccccccccccccccccccc ], aaaa); After: var someVariable = SomeFuntion(aaaa, [ aaaaaaaaaaaaaaaaaaaaaaaaaaa, bbbbbbbbbbbbbbbbbbbbbbbbbbb, ccccccccccccccccccccccccccc ], aaaa); llvm-svn: 239722
This commit is contained in:
parent
d6d12a1192
commit
b2ad4d4c26
|
@ -688,7 +688,8 @@ unsigned ContinuationIndenter::moveStateToNextToken(LineState &State,
|
||||||
// foo();
|
// foo();
|
||||||
// bar();
|
// bar();
|
||||||
// }, a, b, c);
|
// }, a, b, c);
|
||||||
if (Current.isNot(tok::comment) && Previous && Previous->is(tok::l_brace) &&
|
if (Current.isNot(tok::comment) && Previous &&
|
||||||
|
Previous->isOneOf(tok::l_brace, TT_ArrayInitializerLSquare) &&
|
||||||
State.Stack.size() > 1) {
|
State.Stack.size() > 1) {
|
||||||
if (State.Stack[State.Stack.size() - 2].NestedBlockInlined && Newline)
|
if (State.Stack[State.Stack.size() - 2].NestedBlockInlined && Newline)
|
||||||
for (unsigned i = 0, e = State.Stack.size() - 1; i != e; ++i)
|
for (unsigned i = 0, e = State.Stack.size() - 1; i != e; ++i)
|
||||||
|
|
|
@ -278,6 +278,13 @@ TEST_F(FormatTestJS, ArrayLiterals) {
|
||||||
" bbbbbbbbbbbbbbbbbbbbbbbbbbb,\n"
|
" bbbbbbbbbbbbbbbbbbbbbbbbbbb,\n"
|
||||||
" ccccccccccccccccccccccccccc\n"
|
" ccccccccccccccccccccccccccc\n"
|
||||||
"]);");
|
"]);");
|
||||||
|
verifyFormat("var someVariable = SomeFuntion(aaaa,\n"
|
||||||
|
" [\n"
|
||||||
|
" aaaaaaaaaaaaaaaaaaaaaaaaaaa,\n"
|
||||||
|
" bbbbbbbbbbbbbbbbbbbbbbbbbbb,\n"
|
||||||
|
" ccccccccccccccccccccccccccc\n"
|
||||||
|
" ],\n"
|
||||||
|
" aaaa);");
|
||||||
|
|
||||||
verifyFormat("someFunction([], {a: a});");
|
verifyFormat("someFunction([], {a: a});");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue