clang-format: [JS] whitespace required between ! and as.

Summary:
Before:
    x!as string
After:
    x! as string

Reviewers: djasper

Subscribers: klimek, cfe-commits

Differential Revision: https://reviews.llvm.org/D24272

llvm-svn: 280731
This commit is contained in:
Martin Probst 2016-09-06 18:55:34 +00:00
parent 56ff7aaacb
commit 34ecf42bff
2 changed files with 3 additions and 0 deletions

View File

@ -2158,6 +2158,8 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line,
tok::r_square, tok::r_brace) ||
Left.Tok.isLiteral()))
return false;
if (Left.is(tok::exclaim) && Right.is(Keywords.kw_as))
return true; // "x! as string"
} else if (Style.Language == FormatStyle::LK_Java) {
if (Left.is(tok::r_square) && Right.is(tok::l_brace))
return true;

View File

@ -1236,6 +1236,7 @@ TEST_F(FormatTestJS, CastSyntax) {
verifyFormat("x = x as [a, b];");
verifyFormat("x = x as {a: string};");
verifyFormat("x = x as (string);");
verifyFormat("x = x! as (string);");
}
TEST_F(FormatTestJS, TypeArguments) {