return Style.BreakBeforeBinaryOperators == FormatStyle::BOS_None;
if (Right.is(Keywords.kw_in))
return Style.BreakBeforeBinaryOperators != FormatStyle::BOS_None;
+ if (Right.is(Keywords.kw_as))
+ return false; // must not break before as in 'x as type' casts
}
if (Left.is(tok::at))
// ... but not if from is just an identifier.
verifyFormat("export {\n"
" from as from,\n"
- " someSurprisinglyLongVariable\n"
- " as from\n"
+ " someSurprisinglyLongVariable as\n"
+ " from\n"
"};",
getGoogleJSStyleWithColumns(20));
verifyFormat("export class C {\n"
TEST_F(FormatTestJS, CastSyntax) {
verifyFormat("var x = <type>foo;");
verifyFormat("var x = foo as type;");
+ verifyFormat("let x = (a + b) as\n"
+ " LongTypeIsLong;",
+ getGoogleJSStyleWithColumns(20));
verifyFormat("foo = <Bar[]>[\n"
" 1, //\n"
" 2\n"