| 723 | } |
| 724 | |
| 725 | void OverrideChecker::checkAmbiguousOverrides(ContractDefinition const& _contract) const |
| 726 | { |
| 727 | { |
| 728 | // Fetch inherited functions and sort them by signature. |
| 729 | // We get at least one function per signature and direct base contract, which is |
| 730 | // enough because we re-construct the inheritance graph later. |
| 731 | OverrideProxyBySignatureMultiSet nonOverriddenFunctions = inheritedFunctions(_contract); |
| 732 | |
| 733 | // Remove all functions that match the signature of a function in the current contract. |
| 734 | for (FunctionDefinition const* f: _contract.definedFunctions()) |
| 735 | nonOverriddenFunctions.erase(OverrideProxy{f}); |
| 736 | for (VariableDeclaration const* v: _contract.stateVariables()) |
| 737 | if (v->isPublic()) |
| 738 | nonOverriddenFunctions.erase(OverrideProxy{v}); |
| 739 | |
| 740 | // Walk through the set of functions signature by signature. |
| 741 | for (auto it = nonOverriddenFunctions.cbegin(); it != nonOverriddenFunctions.cend();) |
| 742 | { |
| 743 | std::set<OverrideProxy> baseFunctions; |
| 744 | for (auto nextSignature = nonOverriddenFunctions.upper_bound(*it); it != nextSignature; ++it) |
| 745 | baseFunctions.insert(*it); |
| 746 | |
| 747 | checkAmbiguousOverridesInternal(std::move(baseFunctions), _contract.location()); |
| 748 | } |
| 749 | } |
| 750 | |
| 751 | { |
| 752 | OverrideProxyBySignatureMultiSet modifiers = inheritedModifiers(_contract); |
| 753 | for (ModifierDefinition const* mod: _contract.functionModifiers()) |
| 754 | modifiers.erase(OverrideProxy{mod}); |
| 755 | |
| 756 | for (auto it = modifiers.cbegin(); it != modifiers.cend();) |
| 757 | { |
| 758 | std::set<OverrideProxy> baseModifiers; |
| 759 | for (auto next = modifiers.upper_bound(*it); it != next; ++it) |
| 760 | baseModifiers.insert(*it); |
| 761 | |
| 762 | checkAmbiguousOverridesInternal(std::move(baseModifiers), _contract.location()); |
| 763 | } |
| 764 | |
| 765 | } |
| 766 | } |
| 767 | |
| 768 | void OverrideChecker::checkAmbiguousOverridesInternal(std::set<OverrideProxy> _baseCallables, SourceLocation const& _location) const |
| 769 | { |
nothing calls this directly
no test coverage detected