diff options
| -rw-r--r-- | clang/lib/Format/TokenAnnotator.cpp | 2 | ||||
| -rw-r--r-- | clang/unittests/Format/FormatTestJS.cpp | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index 129fe844904..1a3faad6e28 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -2160,7 +2160,7 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line, Keywords.kw_of, tok::kw_const) && (!Left.Previous || !Left.Previous->is(tok::period))) return true; - if (Left.is(tok::kw_for) && Left.Previous && + if (Left.isOneOf(tok::kw_for, Keywords.kw_as) && Left.Previous && Left.Previous->is(tok::period) && Right.is(tok::l_paren)) return false; if (Left.is(Keywords.kw_as) && diff --git a/clang/unittests/Format/FormatTestJS.cpp b/clang/unittests/Format/FormatTestJS.cpp index 846abaffebf..f4b50591aae 100644 --- a/clang/unittests/Format/FormatTestJS.cpp +++ b/clang/unittests/Format/FormatTestJS.cpp @@ -136,6 +136,7 @@ TEST_F(FormatTestJS, ReservedWords) { verifyFormat("x.let() = 1;"); verifyFormat("x.var() = 1;"); verifyFormat("x.for() = 1;"); + verifyFormat("x.as() = 1;"); verifyFormat("x = {\n" " a: 12,\n" " interface: 1,\n" |

