clang-format: [JS/Java] ignore Objective-C constructs in JS & Java.
authorMartin Probst <martin@probst.io>
Wed, 26 Apr 2017 12:36:49 +0000 (12:36 +0000)
committerMartin Probst <martin@probst.io>
Wed, 26 Apr 2017 12:36:49 +0000 (12:36 +0000)
commitad06391ca98085a5245ac2fec6cccae23d3a1089
tree3bb8691474a9c2e76488f7fd540c3bfcd1885e7d
parent07a0307a407e7349c065a206c4fdb40396a57bde
clang-format: [JS/Java] ignore Objective-C constructs in JS & Java.

Summary:
Java and JavaScript support annotations and decorators, respectively, that use a leading "@" token. clang-format currently detects this as an Objective-C construct and applies special formatting, for example no whitespace around "=" operators. This change disables the distinction for Java and JavaScript, which leads to normal formatting of single line annotated and initialized properties.

Before:
    class X {
      @foo() bar=false;
    }

After:
    class X {
      @foo() bar = false;
    }

Reviewers: djasper, bkramer

Subscribers: klimek, cfe-commits

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

llvm-svn: 301399
clang/lib/Format/TokenAnnotator.cpp
clang/unittests/Format/FormatTestJS.cpp