clang-format: [JS] no whitespace between typeof operator and l_paren.

llvm-svn: 309713
This commit is contained in:
Martin Probst 2017-08-01 17:42:16 +00:00
parent cde9815dc2
commit 9926abb91f
3 changed files with 5 additions and 2 deletions

View File

@ -644,6 +644,7 @@ struct AdditionalKeywords {
kw_readonly = &IdentTable.get("readonly");
kw_set = &IdentTable.get("set");
kw_type = &IdentTable.get("type");
kw_typeof = &IdentTable.get("typeof");
kw_var = &IdentTable.get("var");
kw_yield = &IdentTable.get("yield");
@ -680,7 +681,7 @@ struct AdditionalKeywords {
JsExtraKeywords = std::unordered_set<IdentifierInfo *>(
{kw_as, kw_async, kw_await, kw_declare, kw_finally, kw_from,
kw_function, kw_get, kw_import, kw_is, kw_let, kw_module, kw_readonly,
kw_set, kw_type, kw_var, kw_yield,
kw_set, kw_type, kw_typeof, kw_var, kw_yield,
// Keywords from the Java section.
kw_abstract, kw_extends, kw_implements, kw_instanceof, kw_interface});
}
@ -714,6 +715,7 @@ struct AdditionalKeywords {
IdentifierInfo *kw_readonly;
IdentifierInfo *kw_set;
IdentifierInfo *kw_type;
IdentifierInfo *kw_typeof;
IdentifierInfo *kw_var;
IdentifierInfo *kw_yield;

View File

@ -2353,7 +2353,7 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line,
Left.Tok.getIdentifierInfo())
return false;
if (Right.is(tok::l_paren) &&
Left.isOneOf(tok::kw_throw, Keywords.kw_await, tok::kw_void))
Left.isOneOf(tok::kw_throw, Keywords.kw_await, Keywords.kw_typeof, tok::kw_void))
return true;
if ((Left.isOneOf(Keywords.kw_let, Keywords.kw_var, Keywords.kw_in,
tok::kw_const) ||

View File

@ -263,6 +263,7 @@ TEST_F(FormatTestJS, ReservedWordsParenthesized) {
// All of these are statements using the keyword, not function calls.
verifyFormat("throw (x + y);\n"
"await (await x).y;\n"
"typeof (x) === 'string';\n"
"void (0);\n"
"delete (x.y);\n"
"return (x);\n");