Support explicit conversion of external function type to address

This commit is contained in:
Alex Beregszaszi
2017-02-01 12:23:47 +00:00
parent c1a675da4f
commit 767ec1d670
4 changed files with 25 additions and 1 deletions
+11
View File
@@ -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)
+1
View File
@@ -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;