clang-format: [JS] do not collapse short classes.
authorMartin Probst <martin@probst.io>
Sat, 25 Nov 2017 09:35:33 +0000 (09:35 +0000)
committerMartin Probst <martin@probst.io>
Sat, 25 Nov 2017 09:35:33 +0000 (09:35 +0000)
commitc160cfaf66c7e37afda23ab21f24fbe96a54e5f8
tree97a3aa08c451235f5866d4a543dfa384ef1e40b6
parente8e27ca866d89a40639c8592032ca21fdf4848bf
clang-format: [JS] do not collapse short classes.

Summary:
clang-format does not collapse short records, interfaces, unions, etc.,
but fails to do so if the record is preceded by certain modifiers
(export, default, abstract, declare). This change skips over all
modifiers, and thus handles all record definitions uniformly.

Before:
    export class Foo { bar: string; }
    class Baz {
      bam: string;
    }

After:
    export class Foo {
      bar: string;
    }
    class Baz {
      bam: string;
    }

Reviewers: djasper

Subscribers: klimek

Differential Revision: https://reviews.llvm.org/D40430

llvm-svn: 318976
clang/lib/Format/UnwrappedLineFormatter.cpp
clang/unittests/Format/FormatTestJS.cpp