MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / isContainerYield

Method isContainerYield

lib/library.cpp:1463–1480  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1461}
1462
1463bool Library::isContainerYield(const Token * const cond, Library::Container::Yield y, const std::string& fallback)
1464{
1465 if (!cond)
1466 return false;
1467 if (cond->str() == "(") {
1468 const Token* tok = cond->astOperand1();
1469 if (tok && tok->str() == ".") {
1470 if (tok->astOperand1() && tok->astOperand1()->valueType()) {
1471 if (const Library::Container *container = tok->astOperand1()->valueType()->container) {
1472 return tok->astOperand2() && y == container->getYield(tok->astOperand2()->str());
1473 }
1474 } else if (!fallback.empty()) {
1475 return Token::simpleMatch(cond, "( )") && cond->strAt(-1) == fallback;
1476 }
1477 }
1478 }
1479 return false;
1480}
1481
1482Library::Container::Yield Library::getContainerYield(const Token* const cond)
1483{

Callers

nothing calls this directly

Calls 6

astOperand1Method · 0.80
astOperand2Method · 0.80
getYieldMethod · 0.80
simpleMatchFunction · 0.70
strMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected