| 392 | |
| 393 | |
| 394 | const Symbol* SymbolRuleSet::findDuplicateSymbolPattern() const |
| 395 | { |
| 396 | for (auto const& item : *this) |
| 397 | { |
| 398 | if (item.query.getOperator() != ObjectQuery::OperatorSymbol) |
| 399 | continue; |
| 400 | |
| 401 | auto has_conflict = [&item](const auto& other)->bool { |
| 402 | return &other != &item |
| 403 | && other.type != SymbolRule::NoAssignment |
| 404 | && item.query == other.query |
| 405 | && item.symbol != other.symbol; |
| 406 | }; |
| 407 | using std::begin; using std::end; |
| 408 | if (std::any_of(begin(*this), end(*this), has_conflict)) |
| 409 | { |
| 410 | return item.symbol; |
| 411 | } |
| 412 | } |
| 413 | return nullptr; |
| 414 | } |
| 415 | |
| 416 | |
| 417 |
no test coverage detected