Fixed bug in Token::findClosingBracket() and broken unit test (#7277)

This commit is contained in:
PKEuS 2016-02-04 10:00:54 +01:00
parent cc8c498ebb
commit b801386ac8
2 changed files with 5 additions and 3 deletions

View File

@ -818,9 +818,11 @@ const Token * Token::findClosingBracket() const
closing = closing->link(); closing = closing->link();
if (!closing) if (!closing)
return nullptr; // #6803 return nullptr; // #6803
} else if (Token::Match(closing, "}|]|)|;")) } else if (Token::Match(closing, "}|]|)|;")) {
if (depth > 0)
return nullptr;
break; break;
else if (closing->str() == "<") } else if (closing->str() == "<")
++depth; ++depth;
else if (closing->str() == ">") { else if (closing->str() == ">") {
if (--depth == 0) if (--depth == 0)

View File

@ -927,7 +927,7 @@ private:
ASSERT(t != nullptr && t->str() == ">"); ASSERT(t != nullptr && t->str() == ">");
t = var.tokens()->tokAt(4)->findClosingBracket(); t = var.tokens()->tokAt(4)->findClosingBracket();
ASSERT(t != nullptr && t->str() == ")"); ASSERT(t == nullptr);
} }
}; };