clang-format: [JS] Fix incorrect spacing around contextual keywords.
Before:
x.of ();
After:
x.of();
llvm-svn: 263710
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index f7cfe9f..96b1df8 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -2038,8 +2038,11 @@
Left.isOneOf(Keywords.kw_returns, Keywords.kw_option))
return true;
} else if (Style.Language == FormatStyle::LK_JavaScript) {
- if (Left.isOneOf(Keywords.kw_let, Keywords.kw_var, TT_JsFatArrow,
- Keywords.kw_in, Keywords.kw_of))
+ if (Left.is(TT_JsFatArrow))
+ return true;
+ if (Left.isOneOf(Keywords.kw_let, Keywords.kw_var, Keywords.kw_in,
+ Keywords.kw_of) &&
+ (!Left.Previous || !Left.Previous->is(tok::period)))
return true;
if (Left.is(tok::kw_default) && Left.Previous &&
Left.Previous->is(tok::kw_export))