clang-format: [JavaScript] Ignore QT keywords.

llvm-svn: 299204
This commit is contained in:
Daniel Jasper 2017-03-31 12:04:37 +00:00
parent f698a69107
commit 72b3357f2d
2 changed files with 5 additions and 1 deletions

View File

@ -916,7 +916,9 @@ void UnwrappedLineParser::parseStructuralElement() {
return;
}
}
if (FormatTok->isOneOf(Keywords.kw_signals, Keywords.kw_qsignals,
if ((Style.Language == FormatStyle::LK_Cpp ||
Style.Language == FormatStyle::LK_ObjC) &&
FormatTok->isOneOf(Keywords.kw_signals, Keywords.kw_qsignals,
Keywords.kw_slots, Keywords.kw_qslots)) {
nextToken();
if (FormatTok->is(tok::colon)) {

View File

@ -167,6 +167,8 @@ TEST_F(FormatTestJS, ReservedWordsMethods) {
TEST_F(FormatTestJS, CppKeywords) {
// Make sure we don't mess stuff up because of C++ keywords.
verifyFormat("return operator && (aa);");
// .. or QT ones.
verifyFormat("slots: Slot[];");
}
TEST_F(FormatTestJS, ES6DestructuringAssignment) {