Before:
enum?: string
[];
After:
enum?: string[];
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@259628
91177308-0d34-0410-b5e6-
96231b3b80d8
// In TypeScript, "enum" can also be used as property name, e.g. in interface
// declarations. An "enum" keyword followed by a colon would be a syntax
// error and thus assume it is just an identifier.
- if (Style.Language == FormatStyle::LK_JavaScript && FormatTok->is(tok::colon))
+ if (Style.Language == FormatStyle::LK_JavaScript &&
+ FormatTok->isOneOf(tok::colon, tok::question))
return false;
// Eat up enum class ...
verifyFormat("interface I {\n"
" x: string;\n"
" enum: string[];\n"
+ " enum?: string[];\n"
"}\n"
"var y;");
// Ensure that state is reset after parsing the interface.