mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Support explicit conversion of external function type to address
This commit is contained in:
@@ -2158,6 +2158,17 @@ bool FunctionType::operator==(Type const& _other) const
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FunctionType::isExplicitlyConvertibleTo(Type const& _convertTo) const
|
||||
{
|
||||
if (m_location == Location::External && _convertTo.category() == Category::Integer)
|
||||
{
|
||||
IntegerType const& convertTo = dynamic_cast<IntegerType const&>(_convertTo);
|
||||
if (convertTo.isAddress())
|
||||
return true;
|
||||
}
|
||||
return _convertTo.category() == category();
|
||||
}
|
||||
|
||||
TypePointer FunctionType::unaryOperatorResult(Token::Value _operator) const
|
||||
{
|
||||
if (_operator == Token::Value::Delete)
|
||||
|
||||
@@ -922,6 +922,7 @@ public:
|
||||
|
||||
virtual std::string identifier() const override;
|
||||
virtual bool operator==(Type const& _other) const override;
|
||||
virtual bool isExplicitlyConvertibleTo(Type const& _convertTo) const override;
|
||||
virtual TypePointer unaryOperatorResult(Token::Value _operator) const override;
|
||||
virtual std::string canonicalName(bool /*_addDataLocation*/) const override;
|
||||
virtual std::string toString(bool _short) const override;
|
||||
|
||||
Reference in New Issue
Block a user