Fixed bug in Token::findClosingBracket() and broken unit test (#7277)
This commit is contained in:
parent
cc8c498ebb
commit
b801386ac8
|
@ -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)
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue