Remove unnecessary checks in modifier resolve function

This commit is contained in:
Marenz 2021-12-28 18:29:20 +01:00
parent b28cd00aa0
commit b95db2db5e

View File

@ -511,23 +511,20 @@ ModifierDefinition const& ModifierDefinition::resolveVirtual(
ContractDefinition const* _searchStart ContractDefinition const* _searchStart
) const ) const
{ {
// Super is not possible with modifiers
solAssert(_searchStart == nullptr, "Used super in connection with modifiers."); solAssert(_searchStart == nullptr, "Used super in connection with modifiers.");
// If we are not doing super-lookup and the modifier is not virtual, we can stop here. // The modifier is not virtual, we can stop here.
if (_searchStart == nullptr && !virtualSemantics()) if (!virtualSemantics())
return *this; return *this;
solAssert(!dynamic_cast<ContractDefinition const&>(*scope()).isLibrary(), ""); solAssert(!dynamic_cast<ContractDefinition const&>(*scope()).isLibrary(), "");
for (ContractDefinition const* c: _mostDerivedContract.annotation().linearizedBaseContracts) for (ContractDefinition const* c: _mostDerivedContract.annotation().linearizedBaseContracts)
{
if (_searchStart != nullptr && c != _searchStart)
continue;
_searchStart = nullptr;
for (ModifierDefinition const* modifier: c->functionModifiers()) for (ModifierDefinition const* modifier: c->functionModifiers())
if (modifier->name() == name()) if (modifier->name() == name())
return *modifier; return *modifier;
}
solAssert(false, "Virtual modifier " + name() + " not found."); solAssert(false, "Virtual modifier " + name() + " not found.");
return *this; // not reached return *this; // not reached
} }