astyle formatting
[ci skip]
This commit is contained in:
parent
43be20a824
commit
e65a5529ad
@ -266,18 +266,18 @@ bool isOppositeCond(bool isNot, bool cpp, const Token * const cond1, const Token
|
|||||||
if (cond2->str() == "!")
|
if (cond2->str() == "!")
|
||||||
return isOppositeCond(isNot, cpp, cond2, cond1, library, pure);
|
return isOppositeCond(isNot, cpp, cond2, cond1, library, pure);
|
||||||
|
|
||||||
if(!isNot) {
|
if (!isNot) {
|
||||||
if (cond1->str() == "==" && cond2->str() == "==") {
|
if (cond1->str() == "==" && cond2->str() == "==") {
|
||||||
if(isSameExpression(cpp, true, cond1->astOperand1(), cond2->astOperand1(), library, pure))
|
if (isSameExpression(cpp, true, cond1->astOperand1(), cond2->astOperand1(), library, pure))
|
||||||
return isDifferentKnownValues(cond1->astOperand2(), cond2->astOperand2());
|
return isDifferentKnownValues(cond1->astOperand2(), cond2->astOperand2());
|
||||||
if(isSameExpression(cpp, true, cond1->astOperand2(), cond2->astOperand2(), library, pure))
|
if (isSameExpression(cpp, true, cond1->astOperand2(), cond2->astOperand2(), library, pure))
|
||||||
return isDifferentKnownValues(cond1->astOperand1(), cond2->astOperand1());
|
return isDifferentKnownValues(cond1->astOperand1(), cond2->astOperand1());
|
||||||
}
|
}
|
||||||
if(Library::isContainerYield(cond1, Library::Container::EMPTY, "empty") && Library::isContainerYield(cond2->astOperand1(), Library::Container::SIZE, "size")) {
|
if (Library::isContainerYield(cond1, Library::Container::EMPTY, "empty") && Library::isContainerYield(cond2->astOperand1(), Library::Container::SIZE, "size")) {
|
||||||
return !(cond2->str() == "==" && cond2->astOperand2()->getValue(0));
|
return !(cond2->str() == "==" && cond2->astOperand2()->getValue(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Library::isContainerYield(cond2, Library::Container::EMPTY, "empty") && Library::isContainerYield(cond1->astOperand1(), Library::Container::SIZE, "size")) {
|
if (Library::isContainerYield(cond2, Library::Container::EMPTY, "empty") && Library::isContainerYield(cond1->astOperand1(), Library::Container::SIZE, "size")) {
|
||||||
return !(cond1->str() == "==" && cond1->astOperand2()->getValue(0));
|
return !(cond1->str() == "==" && cond1->astOperand2()->getValue(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -923,17 +923,16 @@ const Library::Container* Library::detectContainer(const Token* typeStart, bool
|
|||||||
|
|
||||||
bool Library::isContainerYield(const Token * const cond, Library::Container::Yield y, const std::string& fallback)
|
bool Library::isContainerYield(const Token * const cond, Library::Container::Yield y, const std::string& fallback)
|
||||||
{
|
{
|
||||||
if(!cond)
|
if (!cond)
|
||||||
return false;
|
return false;
|
||||||
if (cond->str() == "(") {
|
if (cond->str() == "(") {
|
||||||
const Token* tok = cond->astOperand1();
|
const Token* tok = cond->astOperand1();
|
||||||
if(tok && tok->str() == ".") {
|
if (tok && tok->str() == ".") {
|
||||||
if(tok->astOperand1() && tok->astOperand1()->valueType()) {
|
if (tok->astOperand1() && tok->astOperand1()->valueType()) {
|
||||||
if(const Library::Container *container = tok->astOperand1()->valueType()->container) {
|
if (const Library::Container *container = tok->astOperand1()->valueType()->container) {
|
||||||
return tok->astOperand2() && y == container->getYield(tok->astOperand2()->str());
|
return tok->astOperand2() && y == container->getYield(tok->astOperand2()->str());
|
||||||
}
|
}
|
||||||
}
|
} else if (!fallback.empty()) {
|
||||||
else if(!fallback.empty()) {
|
|
||||||
return Token::simpleMatch(cond, "( )") && cond->previous()->str() == fallback;
|
return Token::simpleMatch(cond, "( )") && cond->previous()->str() == fallback;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user