]> granicus.if.org Git - clang/commitdiff
clang-format: [JS] Teach clang-format about "export interface".
authorDaniel Jasper <djasper@google.com>
Mon, 11 Jan 2016 22:57:40 +0000 (22:57 +0000)
committerDaniel Jasper <djasper@google.com>
Mon, 11 Jan 2016 22:57:40 +0000 (22:57 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@257406 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Format/UnwrappedLineParser.cpp
unittests/Format/FormatTestJS.cpp

index 17bcac5d5902b274ecb04c8feab26dc5653ba431..d35d8a6053d3826c3299698b7d813cfd1fc504d8 100644 (file)
@@ -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)) {
index 9477580016a676c28f785982e3a25128c5a360a2..5e9a1b533cadb43d051b44b44e1a6f11e075183c 100644 (file)
@@ -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) {