summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2015-06-02 22:06:07 +0000
committerDaniel Jasper <djasper@google.com>2015-06-02 22:06:07 +0000
commite497beddb5ec4375df48fe144c700219a2fd3aae (patch)
tree9c1f8ae69c13245d400b7d9feb4aa4f470d697d2 /clang/lib/Format
parentb1f5879f3a0d034b01f934df004e39cf58ab6cc9 (diff)
downloadbcm5719-llvm-e497beddb5ec4375df48fe144c700219a2fd3aae.tar.gz
bcm5719-llvm-e497beddb5ec4375df48fe144c700219a2fd3aae.zip
clang-format: [JS] Always add space after fat arrow.
Before: return () =>[]; After: return () => []; llvm-svn: 238875
Diffstat (limited to 'clang/lib/Format')
-rw-r--r--clang/lib/Format/TokenAnnotator.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index 0ee5a7cc4ef..3c1c9a1defd 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -1878,7 +1878,7 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line,
Left.isOneOf(Keywords.kw_returns, Keywords.kw_option))
return true;
} else if (Style.Language == FormatStyle::LK_JavaScript) {
- if (Left.is(Keywords.kw_var))
+ if (Left.isOneOf(Keywords.kw_var, TT_JsFatArrow))
return true;
if (Right.isOneOf(TT_JsTypeColon, TT_JsTypeOptionalQuestion))
return false;
@@ -1958,10 +1958,9 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line,
return Style.SpaceAfterCStyleCast ||
Right.isOneOf(TT_BinaryOperator, TT_SelectorName);
- if (Left.is(tok::greater) && Right.is(tok::greater)) {
+ if (Left.is(tok::greater) && Right.is(tok::greater))
return Right.is(TT_TemplateCloser) && Left.is(TT_TemplateCloser) &&
(Style.Standard != FormatStyle::LS_Cpp11 || Style.SpacesInAngles);
- }
if (Right.isOneOf(tok::arrow, tok::period, tok::arrowstar, tok::periodstar) ||
Left.isOneOf(tok::arrow, tok::period, tok::arrowstar, tok::periodstar))
return false;
OpenPOWER on IntegriCloud