summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format
diff options
context:
space:
mode:
authorMartin Probst <martin@probst.io>2016-08-22 14:23:30 +0000
committerMartin Probst <martin@probst.io>2016-08-22 14:23:30 +0000
commited87d788d610063e7c6e74a12565001ce77a0d73 (patch)
treeafa195e548a9a8efb992fb0583b860671adadf72 /clang/lib/Format
parent13fa33012b93c2c824ddf864c70ebff41a378a6d (diff)
downloadbcm5719-llvm-ed87d788d610063e7c6e74a12565001ce77a0d73.tar.gz
bcm5719-llvm-ed87d788d610063e7c6e74a12565001ce77a0d73.zip
clang-format: [JS] supports casts to types starting with punctuation ("{[(").
Before: x as{x: number} After: x as {x: number} Reviewers: djasper Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D23761 llvm-svn: 279436
Diffstat (limited to 'clang/lib/Format')
-rw-r--r--clang/lib/Format/TokenAnnotator.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index 05996112df5..081ea98d9cc 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -2121,6 +2121,9 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line,
Keywords.kw_of, tok::kw_const) &&
(!Left.Previous || !Left.Previous->is(tok::period)))
return true;
+ if (Left.is(Keywords.kw_as) &&
+ Right.isOneOf(tok::l_square, tok::l_brace, tok::l_paren))
+ return true;
if (Left.is(tok::kw_default) && Left.Previous &&
Left.Previous->is(tok::kw_export))
return true;
OpenPOWER on IntegriCloud