From 78214397a37539174ea0b984a0b2b8ba3d85c32e Mon Sep 17 00:00:00 2001 From: Daniel Jasper Date: Mon, 19 May 2014 07:27:02 +0000 Subject: 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 --- clang/lib/Format/Format.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'clang/lib/Format') 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; } } -- cgit v1.2.3