Tokenizer: Fixed bad simplifyComma for code 'return a ? b = c , d : e ;'

This commit is contained in:
Daniel Marjamäki 2014-04-18 13:38:48 +02:00
parent 1d78d74175
commit 6146c8f5bb
2 changed files with 6 additions and 1 deletions

View File

@ -8564,7 +8564,7 @@ void Tokenizer::simplifyComma()
// find "; return" pattern before comma
for (Token *tok2 = tok->previous(); tok2; tok2 = tok2->previous()) {
if (Token::Match(tok2, "[;{}]")) {
if (Token::Match(tok2, "[;{}?]")) {
break;
} else if (tok2->str() == ")" || tok2->str() == "]" ||

View File

@ -2899,6 +2899,11 @@ private:
ASSERT_EQUALS(code, tok(code));
}
{
const char code[] = "; return a ? b = c , d : e ;"; // do nothing
ASSERT_EQUALS(code, tok(code));
}
{
const char code[] = "void f()\n"
"{\n"