forked from OSchip/llvm-project
clang-format: [JS] Fix line breaks in computed property names.
Before: let foo = { [someLongKeyHere]: 1, someOtherLongKeyHere: 2, [keyLongEnoughToWrap]: 3, lastLongKey: 4 }; After: let foo = { [someLongKeyHere]: 1, someOtherLongKeyHere: 2, [keyLongEnoughToWrap]: 3, lastLongKey: 4 }; llvm-svn: 238671
This commit is contained in:
parent
aa47cf9dae
commit
cd8d4ff985
|
@ -1321,7 +1321,7 @@ private:
|
||||||
else if (Current->is(TT_LambdaArrow))
|
else if (Current->is(TT_LambdaArrow))
|
||||||
return prec::Comma;
|
return prec::Comma;
|
||||||
else if (Current->isOneOf(tok::semi, TT_InlineASMColon,
|
else if (Current->isOneOf(tok::semi, TT_InlineASMColon,
|
||||||
TT_SelectorName) ||
|
TT_SelectorName, TT_JsComputedPropertyName) ||
|
||||||
(Current->is(tok::comment) && NextNonComment &&
|
(Current->is(tok::comment) && NextNonComment &&
|
||||||
NextNonComment->is(TT_SelectorName)))
|
NextNonComment->is(TT_SelectorName)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -153,8 +153,11 @@ TEST_F(FormatTestJS, ContainerLiterals) {
|
||||||
verifyFormat("var x = {y: (a) => a};");
|
verifyFormat("var x = {y: (a) => a};");
|
||||||
|
|
||||||
// Computed keys.
|
// Computed keys.
|
||||||
|
verifyFormat("var x = {[a]: 1, b: 2, [c]: 3};");
|
||||||
verifyFormat("var x = {\n"
|
verifyFormat("var x = {\n"
|
||||||
" [a]: 1,\n"
|
" [a]: 1,\n"
|
||||||
|
" b: 2,\n"
|
||||||
|
" [c]: 3,\n"
|
||||||
"};");
|
"};");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue