ast: clarify the code somewhat
This commit is contained in:
parent
bce99a9e2f
commit
d5af34331b
|
@ -1066,12 +1066,16 @@ void Token::astFunctionCall()
|
|||
|
||||
void Token::astHandleParentheses()
|
||||
{
|
||||
// Assumptions:
|
||||
// * code is valid
|
||||
// * _str is one of: ( ) ]
|
||||
|
||||
Token *innerTop;
|
||||
if (_str != "(")
|
||||
if (Token::Match(this, ")|]"))
|
||||
innerTop = _previous;
|
||||
else if (_next && _next->_str == ")")
|
||||
return;
|
||||
else
|
||||
else // _str = "("
|
||||
innerTop = _next;
|
||||
while (innerTop->_astParent)
|
||||
innerTop = innerTop->_astParent;
|
||||
|
|
|
@ -412,7 +412,7 @@ void TokenList::createAst()
|
|||
|
||||
// parentheses..
|
||||
for (Token *tok = _front; tok; tok = tok->next()) {
|
||||
if (tok->str() == "(" || tok->str() == ")" || tok->str() == "]") {
|
||||
if (Token::Match(tok, "(|)|]")) {
|
||||
tok->astHandleParentheses();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue