aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/ast
diff options
context:
space:
mode:
Diffstat (limited to 'libsolidity/ast')
-rw-r--r--libsolidity/ast/Types.cpp11
-rw-r--r--libsolidity/ast/Types.h1
2 files changed, 12 insertions, 0 deletions
diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp
index dbabc8db..4a64b4c8 100644
--- a/libsolidity/ast/Types.cpp
+++ b/libsolidity/ast/Types.cpp
@@ -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)
diff --git a/libsolidity/ast/Types.h b/libsolidity/ast/Types.h
index a5147f17..3917dca2 100644
--- a/libsolidity/ast/Types.h
+++ b/libsolidity/ast/Types.h
@@ -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;