]> granicus.if.org Git - clang/commit
clang-format: Refactor indentation behavior for multiple nested blocks.
authorDaniel Jasper <djasper@google.com>
Tue, 3 Jun 2014 12:02:45 +0000 (12:02 +0000)
committerDaniel Jasper <djasper@google.com>
Tue, 3 Jun 2014 12:02:45 +0000 (12:02 +0000)
commite167891bd8ce378c40f9e78051b5ffeb9dec6284
treefa25524650e68cb8b2cfbe78b83d47af97831470
parenta51e4bfa5b6b5535901075e3dbcdb944c543f5ca
clang-format: Refactor indentation behavior for multiple nested blocks.

This fixes a few oddities when formatting multiple nested JavaScript
blocks, e.g.:

Before:
  promise.then(
      function success() {
        doFoo();
        doBar();
      },
      [], function error() {
        doFoo();
        doBaz();
      });
  promise.then([],
               function success() {
                 doFoo();
                 doBar();
               },
               function error() {
    doFoo();
    doBaz();
  });

After:
  promise.then(
      function success() {
        doFoo();
        doBar();
      },
      [],
      function error() {
        doFoo();
        doBaz();
      });
  promise.then([],
               function success() {
                 doFoo();
                 doBar();
               },
               function error() {
                 doFoo();
                 doBaz();
               });

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@210097 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Format/ContinuationIndenter.cpp
lib/Format/ContinuationIndenter.h
lib/Format/FormatToken.h
lib/Format/TokenAnnotator.cpp
unittests/Format/FormatTestJS.cpp