clang-format: [JS] Support exporting abstract classes.

Before:
  export abstract class X {y: number;}
(and all sorts of other havoc in more complicated cases).

After:
  export abstract class X { y: number; }

llvm-svn: 257451
This commit is contained in:
Daniel Jasper 2016-01-12 06:24:38 +00:00
parent db147eb5ac
commit 8620d4c55b
2 changed files with 5 additions and 0 deletions

View File

@ -1809,6 +1809,10 @@ void UnwrappedLineParser::parseJavaScriptEs6ImportExport() {
return;
}
// Consume the "abstract" in "export abstract class".
if (FormatTok->is(Keywords.kw_abstract))
nextToken();
if (FormatTok->isOneOf(tok::kw_const, tok::kw_class, tok::kw_enum,
Keywords.kw_interface, Keywords.kw_let,
Keywords.kw_var))

View File

@ -878,6 +878,7 @@ TEST_F(FormatTestJS, Modules) {
" y: string;\n"
"}");
verifyFormat("export class X { y: number; }");
verifyFormat("export abstract class X { y: number; }");
verifyFormat("export default class X { y: number }");
verifyFormat("export default function() {\n return 1;\n}");
verifyFormat("export var x = 12;");