summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/TokenAnnotator.cpp
diff options
context:
space:
mode:
authorMartin Probst <martin@probst.io>2017-08-01 15:46:10 +0000
committerMartin Probst <martin@probst.io>2017-08-01 15:46:10 +0000
commitcb870c57b334236dc7b0822c7366a735ac3c1880 (patch)
tree115eb9d34489b7f703a28821722c86ae8545a1d8 /clang/lib/Format/TokenAnnotator.cpp
parent7ebbe655edd411bd79a726251ec23d9477ccb64c (diff)
downloadbcm5719-llvm-cb870c57b334236dc7b0822c7366a735ac3c1880.tar.gz
bcm5719-llvm-cb870c57b334236dc7b0822c7366a735ac3c1880.zip
clang-format: [JS] handle object types in extends positions.
Summary: clang-format would previously drop the whitespace after `extends` in code such as: class Foo extends {} {} Where the first set of curly braces is an inline object literal type. Reviewers: djasper Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D36131 llvm-svn: 309695
Diffstat (limited to 'clang/lib/Format/TokenAnnotator.cpp')
-rw-r--r--clang/lib/Format/TokenAnnotator.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index b2ffbbb1678..318bb259509 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -2341,7 +2341,8 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line,
Left.isOneOf(Keywords.kw_function, Keywords.kw_yield))
return false;
if (Right.isOneOf(tok::l_brace, tok::l_square) &&
- Left.isOneOf(Keywords.kw_function, Keywords.kw_yield))
+ Left.isOneOf(Keywords.kw_function, Keywords.kw_yield,
+ Keywords.kw_extends, Keywords.kw_implements))
return true;
// JS methods can use some keywords as names (e.g. `delete()`).
if (Right.is(tok::l_paren) && Line.MustBeDeclaration &&
OpenPOWER on IntegriCloud