]> granicus.if.org Git - clang/commit
clang-format: [JS] support fields with case/switch/default labels.
authorMartin Probst <martin@probst.io>
Fri, 4 Aug 2017 17:07:15 +0000 (17:07 +0000)
committerMartin Probst <martin@probst.io>
Fri, 4 Aug 2017 17:07:15 +0000 (17:07 +0000)
commit7777ca006af0f49507cd2d005c957f5fff3a96df
treee97302f9f4eff429a62dffcb8dd9559aa2ad7bdd
parent5e564d35f9ad9f2027b6303aa4e97e11d457bcbe
clang-format: [JS] support fields with case/switch/default labels.

Summary:
`case:` and `default:` would normally parse as labels for a `switch` block.
However in TypeScript, they can be used in field declarations, e.g.:

    interface I {
      case: string;
    }

This change special cases parsing them in declaration lines to avoid wrapping
them.

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@310070 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Format/UnwrappedLineParser.cpp
unittests/Format/FormatTestJS.cpp