summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorMartin Probst <martin@probst.io>2018-05-22 10:39:07 +0000
committerMartin Probst <martin@probst.io>2018-05-22 10:39:07 +0000
commit7ebad4ea81f7481521c01488734fc4962d380d78 (patch)
treed7c7b24c54b542b6526525b530de93b1c78d88d4 /clang/lib
parent2cfcc01b22f292efc42803d888a12ec356505d6f (diff)
downloadbcm5719-llvm-7ebad4ea81f7481521c01488734fc4962d380d78.tar.gz
bcm5719-llvm-7ebad4ea81f7481521c01488734fc4962d380d78.zip
clang-format: [JS] do not wrap before any `is`.
Summary: `is` type annotations can occur at any nesting level. For example: function x() { return function y(): a is B { ... }; } Breaking before the `is` above breaks TypeScript parsing the code. This change prevents the wrap. Reviewers: krasimir Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D47193 llvm-svn: 332968
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Format/TokenAnnotator.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index 2fe1e24709c..56f1841222c 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -2958,7 +2958,7 @@ bool TokenAnnotator::canBreakBefore(const AnnotatedLine &Line,
return false;
if (Left.is(TT_JsTypeColon))
return true;
- if (Right.NestingLevel == 0 && Right.is(Keywords.kw_is))
+ if (Right.is(Keywords.kw_is))
return false;
if (Left.is(Keywords.kw_in))
return Style.BreakBeforeBinaryOperators == FormatStyle::BOS_None;
OpenPOWER on IntegriCloud