[clang-format][NFC] Move static variable in scope
Let only the JS/TS users pay for the initialistation.
Differential Revision: https://reviews.llvm.org/D115068
GitOrigin-RevId: 8d1c85454daa40bd663d0ef4e8262fe6fc0f21ad
diff --git a/lib/Format/ContinuationIndenter.cpp b/lib/Format/ContinuationIndenter.cpp
index 5073f51..cbb8d50 100644
--- a/lib/Format/ContinuationIndenter.cpp
+++ b/lib/Format/ContinuationIndenter.cpp
@@ -493,14 +493,14 @@
return true;
}
- // Break after the closing parenthesis of TypeScript decorators before
- // functions, getters and setters.
- static const llvm::StringSet<> BreakBeforeDecoratedTokens = {"get", "set",
- "function"};
if (Style.Language == FormatStyle::LK_JavaScript &&
- BreakBeforeDecoratedTokens.contains(Current.TokenText) &&
Previous.is(tok::r_paren) && Previous.is(TT_JavaAnnotation)) {
- return true;
+ // Break after the closing parenthesis of TypeScript decorators before
+ // functions, getters and setters.
+ static const llvm::StringSet<> BreakBeforeDecoratedTokens = {"get", "set",
+ "function"};
+ if (BreakBeforeDecoratedTokens.contains(Current.TokenText))
+ return true;
}
// If the return type spans multiple lines, wrap before the function name.