mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #2724 from ethereum/function-type-payable
Check for payable when comparing function types
This commit is contained in:
commit
c84de7fa63
@ -2220,6 +2220,8 @@ string FunctionType::identifier() const
|
|||||||
}
|
}
|
||||||
if (isConstant())
|
if (isConstant())
|
||||||
id += "_constant";
|
id += "_constant";
|
||||||
|
if (isPayable())
|
||||||
|
id += "_payable";
|
||||||
id += identifierList(m_parameterTypes) + "returns" + identifierList(m_returnParameterTypes);
|
id += identifierList(m_parameterTypes) + "returns" + identifierList(m_returnParameterTypes);
|
||||||
if (m_gasSet)
|
if (m_gasSet)
|
||||||
id += "gas";
|
id += "gas";
|
||||||
@ -2234,23 +2236,22 @@ bool FunctionType::operator==(Type const& _other) const
|
|||||||
{
|
{
|
||||||
if (_other.category() != category())
|
if (_other.category() != category())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
FunctionType const& other = dynamic_cast<FunctionType const&>(_other);
|
FunctionType const& other = dynamic_cast<FunctionType const&>(_other);
|
||||||
|
if (
|
||||||
if (m_kind != other.m_kind)
|
m_kind != other.m_kind ||
|
||||||
return false;
|
m_isConstant != other.isConstant() ||
|
||||||
if (m_isConstant != other.isConstant())
|
m_isPayable != other.isPayable() ||
|
||||||
|
m_parameterTypes.size() != other.m_parameterTypes.size() ||
|
||||||
|
m_returnParameterTypes.size() != other.m_returnParameterTypes.size()
|
||||||
|
)
|
||||||
return false;
|
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; };
|
auto typeCompare = [](TypePointer const& _a, TypePointer const& _b) -> bool { return *_a == *_b; };
|
||||||
|
if (
|
||||||
if (!equal(m_parameterTypes.cbegin(), m_parameterTypes.cend(),
|
!equal(m_parameterTypes.cbegin(), m_parameterTypes.cend(), other.m_parameterTypes.cbegin(), typeCompare) ||
|
||||||
other.m_parameterTypes.cbegin(), typeCompare))
|
!equal(m_returnParameterTypes.cbegin(), m_returnParameterTypes.cend(), other.m_returnParameterTypes.cbegin(), typeCompare)
|
||||||
return false;
|
)
|
||||||
if (!equal(m_returnParameterTypes.cbegin(), m_returnParameterTypes.cend(),
|
|
||||||
other.m_returnParameterTypes.cbegin(), typeCompare))
|
|
||||||
return false;
|
return false;
|
||||||
//@todo this is ugly, but cannot be prevented right now
|
//@todo this is ugly, but cannot be prevented right now
|
||||||
if (m_gasSet != other.m_gasSet || m_valueSet != other.m_valueSet)
|
if (m_gasSet != other.m_gasSet || m_valueSet != other.m_valueSet)
|
||||||
@ -2399,10 +2400,15 @@ FunctionTypePointer FunctionType::interfaceFunctionType() const
|
|||||||
return FunctionTypePointer();
|
return FunctionTypePointer();
|
||||||
|
|
||||||
return make_shared<FunctionType>(
|
return make_shared<FunctionType>(
|
||||||
paramTypes, retParamTypes,
|
paramTypes,
|
||||||
m_parameterNames, m_returnParameterNames,
|
retParamTypes,
|
||||||
m_kind, m_arbitraryParameters,
|
m_parameterNames,
|
||||||
m_declaration, m_isConstant, m_isPayable
|
m_returnParameterNames,
|
||||||
|
m_kind,
|
||||||
|
m_arbitraryParameters,
|
||||||
|
m_declaration,
|
||||||
|
m_isConstant,
|
||||||
|
m_isPayable
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user