summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format
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
commit78214397a37539174ea0b984a0b2b8ba3d85c32e (patch)
treeb65534f4cdf298ca3ea2c323e3c94c2e07ec44bd /clang/lib/Format
parent993a906af3893bd88d5f9b175223cca73c4531fa (diff)
downloadbcm5719-llvm-78214397a37539174ea0b984a0b2b8ba3d85c32e.tar.gz
bcm5719-llvm-78214397a37539174ea0b984a0b2b8ba3d85c32e.zip
clang-format: [JS] Support for EC6 arrow functions.
Before: var b = a.map((x) = > x + 1); After: var b = a.map((x) => x + 1); llvm-svn: 209112
Diffstat (limited to 'clang/lib/Format')
-rw-r--r--clang/lib/Format/Format.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index dea2386e0ac..ae8c75ff6dc 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/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;
}
}
OpenPOWER on IntegriCloud