Before:
class X {
delete(val) {
return null;
}
* gen() {
yield[1, 2];
}
* gen() {
yield{a: 1};
}
};
After:
class X {
delete(val) {
return null;
}
* gen() {
yield [1, 2];
}
* gen() {
yield {a: 1};
}
};
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@285569
91177308-0d34-0410-b5e6-
96231b3b80d8
if (Right.is(tok::star) &&
Left.isOneOf(Keywords.kw_function, Keywords.kw_yield))
return false;
+ if (Right.isOneOf(tok::l_brace, tok::l_square) &&
+ Left.isOneOf(Keywords.kw_function, Keywords.kw_yield))
+ return true;
// JS methods can use some keywords as names (e.g. `delete()`).
if (Right.is(tok::l_paren) && Line.MustBeDeclaration &&
Left.Tok.getIdentifierInfo())
" let x = 1;\n"
" yield x;\n"
" yield* something();\n"
+ " yield [1, 2];\n"
+ " yield {a: 1};\n"
"}");
verifyFormat("function*\n"
" f() {\n"