forked from OSchip/llvm-project
clang-format: [JS] Fix failing format with TypeScript casts.
Before, this could be formatted at all (with BracketAlignmentStyle AlwaysBreak): foo = <Bar[]>[ 1, /* */ 2 ]; llvm-svn: 272668
This commit is contained in:
parent
c49f6ce3e1
commit
887a399418
|
@ -319,9 +319,9 @@ private:
|
|||
Left->Type = TT_JsComputedPropertyName;
|
||||
} else if (Style.Language == FormatStyle::LK_Proto ||
|
||||
(Parent &&
|
||||
Parent->isOneOf(TT_BinaryOperator, tok::at, tok::comma,
|
||||
tok::l_paren, tok::l_square, tok::question,
|
||||
tok::colon, tok::kw_return,
|
||||
Parent->isOneOf(TT_BinaryOperator, TT_TemplateCloser, tok::at,
|
||||
tok::comma, tok::l_paren, tok::l_square,
|
||||
tok::question, tok::colon, tok::kw_return,
|
||||
// Should only be relevant to JavaScript:
|
||||
tok::kw_default))) {
|
||||
Left->Type = TT_ArrayInitializerLSquare;
|
||||
|
|
|
@ -1205,6 +1205,10 @@ TEST_F(FormatTestJS, TemplateStrings) {
|
|||
TEST_F(FormatTestJS, CastSyntax) {
|
||||
verifyFormat("var x = <type>foo;");
|
||||
verifyFormat("var x = foo as type;");
|
||||
verifyFormat("foo = <Bar[]>[\n"
|
||||
" 1, //\n"
|
||||
" 2\n"
|
||||
"];");
|
||||
}
|
||||
|
||||
TEST_F(FormatTestJS, TypeArguments) {
|
||||
|
|
Loading…
Reference in New Issue