mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
FunctionType operator== boolean refactor
This commit is contained in:
parent
1b32cdcf21
commit
ad7a63f890
@ -2236,27 +2236,22 @@ bool FunctionType::operator==(Type const& _other) const
|
||||
{
|
||||
if (_other.category() != category())
|
||||
return false;
|
||||
|
||||
FunctionType const& other = dynamic_cast<FunctionType const&>(_other);
|
||||
|
||||
if (m_kind != other.m_kind)
|
||||
if (
|
||||
m_kind != other.m_kind ||
|
||||
m_isConstant != other.isConstant() ||
|
||||
m_isPayable != other.isPayable() ||
|
||||
m_parameterTypes.size() != other.m_parameterTypes.size() ||
|
||||
m_returnParameterTypes.size() != other.m_returnParameterTypes.size()
|
||||
)
|
||||
return false;
|
||||
|
||||
if (m_isConstant != other.isConstant())
|
||||
return false;
|
||||
|
||||
if (m_isPayable != other.isPayable())
|
||||
return false;
|
||||
|
||||
if (m_parameterTypes.size() != other.m_parameterTypes.size() ||
|
||||
m_returnParameterTypes.size() != other.m_returnParameterTypes.size())
|
||||
return false;
|
||||
auto typeCompare = [](TypePointer const& _a, TypePointer const& _b) -> bool { return *_a == *_b; };
|
||||
|
||||
if (!equal(m_parameterTypes.cbegin(), m_parameterTypes.cend(),
|
||||
other.m_parameterTypes.cbegin(), typeCompare))
|
||||
return false;
|
||||
if (!equal(m_returnParameterTypes.cbegin(), m_returnParameterTypes.cend(),
|
||||
other.m_returnParameterTypes.cbegin(), typeCompare))
|
||||
if (
|
||||
!equal(m_parameterTypes.cbegin(), m_parameterTypes.cend(), other.m_parameterTypes.cbegin(), typeCompare) ||
|
||||
!equal(m_returnParameterTypes.cbegin(), m_returnParameterTypes.cend(), other.m_returnParameterTypes.cbegin(), typeCompare)
|
||||
)
|
||||
return false;
|
||||
//@todo this is ugly, but cannot be prevented right now
|
||||
if (m_gasSet != other.m_gasSet || m_valueSet != other.m_valueSet)
|
||||
|
Loading…
Reference in New Issue
Block a user