Tokenizer: Refactoring garbage check
This commit is contained in:
parent
4d18d3948f
commit
21a35de0d2
|
@ -8350,12 +8350,14 @@ const Token * Tokenizer::findGarbageCode() const
|
||||||
if (Token::simpleMatch(tok->linkAt(1), ") {")) {
|
if (Token::simpleMatch(tok->linkAt(1), ") {")) {
|
||||||
tok = tok->linkAt(1)->linkAt(1);
|
tok = tok->linkAt(1)->linkAt(1);
|
||||||
} else {
|
} else {
|
||||||
while (tok->str() != ";" && tok->str() != "{") {
|
const Token *switchToken = tok;
|
||||||
if (tok->next() == nullptr) {
|
tok = tok->linkAt(1);
|
||||||
return tok;
|
while (tok && !Token::Match(tok, "[;{}]"))
|
||||||
}
|
|
||||||
tok = tok->next();
|
tok = tok->next();
|
||||||
}
|
if (!tok)
|
||||||
|
return switchToken;
|
||||||
|
if (tok->str() != ";")
|
||||||
|
return tok;
|
||||||
}
|
}
|
||||||
} else if (tok->str() == "(") {
|
} else if (tok->str() == "(") {
|
||||||
tok = tok->link();
|
tok = tok->link();
|
||||||
|
|
Loading…
Reference in New Issue