From: Daniel Jasper Date: Fri, 12 Jun 2015 05:08:18 +0000 (+0000) Subject: clang-format: [JS] Support "export enum" declarations. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e7869a575c03b91f1f6a0d4576316c50425aec8e;p=clang clang-format: [JS] Support "export enum" declarations. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@239595 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Format/UnwrappedLineParser.cpp b/lib/Format/UnwrappedLineParser.cpp index 2762979b6b..7d9e5e98cf 100644 --- a/lib/Format/UnwrappedLineParser.cpp +++ b/lib/Format/UnwrappedLineParser.cpp @@ -1725,7 +1725,8 @@ void UnwrappedLineParser::parseJavaScriptEs6ImportExport() { return; } - if (FormatTok->isOneOf(tok::kw_const, tok::kw_class, Keywords.kw_var)) + if (FormatTok->isOneOf(tok::kw_const, tok::kw_class, tok::kw_enum, + Keywords.kw_var)) return; // Fall through to parsing the corresponding structure. if (FormatTok->is(tok::l_brace)) { diff --git a/unittests/Format/FormatTestJS.cpp b/unittests/Format/FormatTestJS.cpp index 888d73d48e..31386b448a 100644 --- a/unittests/Format/FormatTestJS.cpp +++ b/unittests/Format/FormatTestJS.cpp @@ -747,6 +747,11 @@ TEST_F(FormatTestJS, Modules) { " a: 1,\n" " b: 2\n" "};"); + verifyFormat("export enum Foo {\n" + " BAR,\n" + " // adsdasd\n" + " BAZ\n" + "}"); } TEST_F(FormatTestJS, TemplateStrings) {