Fixed #498 (Tokenizer: simplify 'goto')
This commit is contained in:
parent
89f9645174
commit
f94aab35e7
|
@ -3121,7 +3121,12 @@ void Tokenizer::simplifyGoto()
|
|||
for (Token *tok = _tokens; tok; tok = (tok ? tok->next() : NULL))
|
||||
{
|
||||
if (tok->str() == "{")
|
||||
++indentlevel;
|
||||
{
|
||||
if (beginfunction == 0 && indentlevel == 0 && tok->link())
|
||||
tok = tok->link();
|
||||
else
|
||||
++indentlevel;
|
||||
}
|
||||
|
||||
else if (tok->str() == "}")
|
||||
{
|
||||
|
@ -3144,7 +3149,7 @@ void Tokenizer::simplifyGoto()
|
|||
else if (Token::Match(tok, "goto %var% ;"))
|
||||
gotos.push_back(tok);
|
||||
|
||||
else if (indentlevel == 1 && Token::Match(tok, "%var% :"))
|
||||
else if (indentlevel == 1 && Token::Match(tok->previous(), "[};] %var% :"))
|
||||
{
|
||||
// Is this label at the end..
|
||||
bool end = false;
|
||||
|
|
|
@ -1261,6 +1261,11 @@ private:
|
|||
|
||||
ASSERT_EQUALS(expect, tok(code));
|
||||
}
|
||||
|
||||
{
|
||||
const char code[] = "class NoLabels { bool varOne : 1 ; bool varTwo : 1 ; } ;";
|
||||
ASSERT_EQUALS(code, tok(code));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue