Tokenizer: Fixed bad simplifyComma for code 'return a ? b = c , d : e ;'
This commit is contained in:
parent
1d78d74175
commit
6146c8f5bb
|
@ -8564,7 +8564,7 @@ void Tokenizer::simplifyComma()
|
||||||
|
|
||||||
// find "; return" pattern before comma
|
// find "; return" pattern before comma
|
||||||
for (Token *tok2 = tok->previous(); tok2; tok2 = tok2->previous()) {
|
for (Token *tok2 = tok->previous(); tok2; tok2 = tok2->previous()) {
|
||||||
if (Token::Match(tok2, "[;{}]")) {
|
if (Token::Match(tok2, "[;{}?]")) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
} else if (tok2->str() == ")" || tok2->str() == "]" ||
|
} else if (tok2->str() == ")" || tok2->str() == "]" ||
|
||||||
|
|
|
@ -2899,6 +2899,11 @@ private:
|
||||||
ASSERT_EQUALS(code, tok(code));
|
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"
|
const char code[] = "void f()\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
|
Loading…
Reference in New Issue