summaryrefslogtreecommitdiff
path: root/lib/Format/Format.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2014-05-19 07:27:02 +0000
committerDaniel Jasper <djasper@google.com>2014-05-19 07:27:02 +0000
commitf805b0c2ed55d573afb7c0ca8705ad74fe5fc3fd (patch)
tree8bc50747a08b35ad7c8f3bd40ab88dfc1f807e72 /lib/Format/Format.cpp
parentcea7244f3d6e9ac7fb25d3f4b02316b48670ca04 (diff)
downloadclang-f805b0c2ed55d573afb7c0ca8705ad74fe5fc3fd.tar.gz
clang-f805b0c2ed55d573afb7c0ca8705ad74fe5fc3fd.tar.bz2
clang-f805b0c2ed55d573afb7c0ca8705ad74fe5fc3fd.tar.xz
clang-format: [JS] Support for EC6 arrow functions.
Before: var b = a.map((x) = > x + 1); After: var b = a.map((x) => x + 1); git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@209112 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/Format.cpp')
-rw-r--r--lib/Format/Format.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp
index dea2386e0a..ae8c75ff6d 100644
--- a/lib/Format/Format.cpp
+++ b/lib/Format/Format.cpp
@@ -1244,6 +1244,7 @@ private:
static tok::TokenKind JSNotIdentity[] = { tok::exclaimequal, tok::equal };
static tok::TokenKind JSShiftEqual[] = { tok::greater, tok::greater,
tok::greaterequal };
+ static tok::TokenKind JSRightArrow[] = { tok::equal, tok::greater };
// FIXME: We probably need to change token type to mimic operator with the
// correct priority.
if (tryMergeTokens(JSIdentity))
@@ -1252,6 +1253,8 @@ private:
return;
if (tryMergeTokens(JSShiftEqual))
return;
+ if (tryMergeTokens(JSRightArrow))
+ return;
}
}