clang-format: [JS] prevent wraps before class members.
authorMartin Probst <martin@probst.io>
Wed, 26 Apr 2017 12:34:15 +0000 (12:34 +0000)
committerMartin Probst <martin@probst.io>
Wed, 26 Apr 2017 12:34:15 +0000 (12:34 +0000)
commit19c7de0a2262da2da139c7ddd7978cecdef1ffae
tree89f1a808da50ef412a4c1dbb634a3ea26555e5cf
parente6a770844889432a655eb31897f1e087eee64d9d
clang-format: [JS] prevent wraps before class members.

Summary: In JavaScript/TypeScript, class member definitions that use modifiers can be subject to Automatic Semicolon Insertion (ASI). For example, "class X { get \n foo }" defines a property called "get" and a property called "foo", both with no type annotation. This change prevents wrapping after the modifier keywords (visibility modifiers, static, get and set) to prevent accidental ASI.

Reviewers: djasper, bkramer

Subscribers: klimek, cfe-commits

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

llvm-svn: 301397
clang/lib/Format/FormatToken.h
clang/lib/Format/TokenAnnotator.cpp
clang/unittests/Format/FormatTestJS.cpp