From: Daniel Jasper Date: Mon, 11 Jan 2016 22:57:40 +0000 (+0000) Subject: clang-format: [JS] Teach clang-format about "export interface". X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8e1a7611bcc11c346ddc99a391f38b6760dac8c9;p=clang clang-format: [JS] Teach clang-format about "export interface". git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@257406 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Format/UnwrappedLineParser.cpp b/lib/Format/UnwrappedLineParser.cpp index 17bcac5d59..d35d8a6053 100644 --- a/lib/Format/UnwrappedLineParser.cpp +++ b/lib/Format/UnwrappedLineParser.cpp @@ -1810,7 +1810,8 @@ void UnwrappedLineParser::parseJavaScriptEs6ImportExport() { } if (FormatTok->isOneOf(tok::kw_const, tok::kw_class, tok::kw_enum, - Keywords.kw_let, Keywords.kw_var)) + Keywords.kw_interface, Keywords.kw_let, + Keywords.kw_var)) return; // Fall through to parsing the corresponding structure. while (!eof() && FormatTok->isNot(tok::semi)) { diff --git a/unittests/Format/FormatTestJS.cpp b/unittests/Format/FormatTestJS.cpp index 9477580016..5e9a1b533c 100644 --- a/unittests/Format/FormatTestJS.cpp +++ b/unittests/Format/FormatTestJS.cpp @@ -900,6 +900,10 @@ TEST_F(FormatTestJS, Modules) { "];"); verifyFormat("export default [];"); verifyFormat("export default () => {};"); + verifyFormat("export interface Foo { foo: number; }\n" + "export class Bar {\n" + " blah(): string { return this.blah; };\n" + "}"); } TEST_F(FormatTestJS, TemplateStrings) {