diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp index 2762979b6bd0..7d9e5e98cfc6 100644 --- a/clang/lib/Format/UnwrappedLineParser.cpp +++ b/clang/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/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp index 888d73d48ee3..31386b448ac6 100644 --- a/clang/unittests/Format/FormatTestJS.cpp +++ b/clang/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) {