forked from OSchip/llvm-project
clang-format: [JS] Supprot "catch" as function name.
Before: someObject.catch (); After: someObject.catch(); llvm-svn: 217158
This commit is contained in:
parent
94e11d02d8
commit
8f2e94c8ab
|
@ -1586,7 +1586,9 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line,
|
||||||
Left.isOneOf(tok::kw_new, tok::kw_delete, tok::semi) ||
|
Left.isOneOf(tok::kw_new, tok::kw_delete, tok::semi) ||
|
||||||
(Style.SpaceBeforeParens != FormatStyle::SBPO_Never &&
|
(Style.SpaceBeforeParens != FormatStyle::SBPO_Never &&
|
||||||
(Left.isOneOf(tok::kw_if, tok::kw_for, tok::kw_while,
|
(Left.isOneOf(tok::kw_if, tok::kw_for, tok::kw_while,
|
||||||
tok::kw_switch, tok::kw_catch, tok::kw_case) ||
|
tok::kw_switch, tok::kw_case) ||
|
||||||
|
(Left.is(tok::kw_catch) &&
|
||||||
|
(!Left.Previous || Left.Previous->isNot(tok::period))) ||
|
||||||
Left.IsForEachMacro)) ||
|
Left.IsForEachMacro)) ||
|
||||||
(Style.SpaceBeforeParens == FormatStyle::SBPO_Always &&
|
(Style.SpaceBeforeParens == FormatStyle::SBPO_Always &&
|
||||||
(Left.is(tok::identifier) || Left.isFunctionLikeKeyword()) &&
|
(Left.is(tok::identifier) || Left.isFunctionLikeKeyword()) &&
|
||||||
|
|
|
@ -254,6 +254,9 @@ TEST_F(FormatTestJS, TryCatch) {
|
||||||
"} finally {\n"
|
"} finally {\n"
|
||||||
" h();\n"
|
" h();\n"
|
||||||
"}");
|
"}");
|
||||||
|
|
||||||
|
// But, of course, "catch" is a perfectly fine function name in JavaScript.
|
||||||
|
verifyFormat("someObject.catch();");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(FormatTestJS, StringLiteralConcatenation) {
|
TEST_F(FormatTestJS, StringLiteralConcatenation) {
|
||||||
|
|
Loading…
Reference in New Issue