diff options
| author | Daniel Jasper <djasper@google.com> | 2016-03-17 12:17:59 +0000 |
|---|---|---|
| committer | Daniel Jasper <djasper@google.com> | 2016-03-17 12:17:59 +0000 |
| commit | a4607e1b88b5c6b862f495206cbd224ef3f42dff (patch) | |
| tree | 70fcc484a75e4695981bb9e623633454039a3502 /clang/lib | |
| parent | 710f8493c898a31a36237353b37e39ea9f6a9777 (diff) | |
| download | bcm5719-llvm-a4607e1b88b5c6b862f495206cbd224ef3f42dff.tar.gz bcm5719-llvm-a4607e1b88b5c6b862f495206cbd224ef3f42dff.zip | |
clang-format: [JS] Fix incorrect spacing around contextual keywords.
Before:
x.of ();
After:
x.of();
llvm-svn: 263710
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/Format/TokenAnnotator.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index f7cfe9fa583..96b1df82e56 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -2038,8 +2038,11 @@ 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.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)) |

