fix a problem with Qt slots immediately followed by signals

This commit is contained in:
Robert Reif 2011-09-16 16:59:43 -04:00
parent 2670525b4f
commit cce4303f28
2 changed files with 19 additions and 0 deletions

View File

@ -10357,6 +10357,7 @@ void Tokenizer::simplifyQtSignalsSlots()
tok2->str(tok2->str() + ":"); tok2->str(tok2->str() + ":");
tok2->deleteNext(); tok2->deleteNext();
tok2->deleteNext(); tok2->deleteNext();
tok2 = tok2->previous();
} }
else if (Token::Match(tok2->next(), "signals|Q_SIGNALS :")) else if (Token::Match(tok2->next(), "signals|Q_SIGNALS :"))
{ {

View File

@ -5646,6 +5646,24 @@ private:
"}"; "}";
ASSERT_EQUALS(result2, tokenizeAndStringify(code2,false)); ASSERT_EQUALS(result2, tokenizeAndStringify(code2,false));
const char code3[] = "class MyObject : public QObject {"
" MyObject() {}"
" ~MyObject() {}"
" public slots:"
" signals:"
" void test() {}"
"};";
const char result3 [] = "class MyObject : public QObject { "
"MyObject ( ) { } "
"~ MyObject ( ) { } "
"public: "
"protected: "
"void test ( ) { } "
"} ;";
ASSERT_EQUALS(result3, tokenizeAndStringify(code3,false));
ASSERT_EQUALS("", errout.str());
} }
void sql() void sql()