aboutsummaryrefslogtreecommitdiffstats
path: root/Types.cpp
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-08-04 17:06:57 +0800
committerchriseth <c@ethdev.com>2015-08-04 17:06:57 +0800
commit56d5c3310628a1e90225062f0ed21c8378678d09 (patch)
treea20fea1c1a6ba249ccb4736c39347e8c0637b919 /Types.cpp
parent6daa27622a06ec7b8a4d67e4d8a1e2dcaa1be982 (diff)
downloaddexon-solidity-56d5c3310628a1e90225062f0ed21c8378678d09.tar.gz
dexon-solidity-56d5c3310628a1e90225062f0ed21c8378678d09.tar.zst
dexon-solidity-56d5c3310628a1e90225062f0ed21c8378678d09.zip
Allow explicit conversions bytes <-> string.
Diffstat (limited to 'Types.cpp')
-rw-r--r--Types.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/Types.cpp b/Types.cpp
index 89ff2134..744362fb 100644
--- a/Types.cpp
+++ b/Types.cpp
@@ -789,6 +789,21 @@ bool ArrayType::isImplicitlyConvertibleTo(const Type& _convertTo) const
}
}
+bool ArrayType::isExplicitlyConvertibleTo(const Type& _convertTo) const
+{
+ if (isImplicitlyConvertibleTo(_convertTo))
+ return true;
+ // allow conversion bytes <-> string
+ if (_convertTo.getCategory() != getCategory())
+ return false;
+ auto& convertTo = dynamic_cast<ArrayType const&>(_convertTo);
+ if (convertTo.location() != location())
+ return false;
+ if (!isByteArray() || !convertTo.isByteArray())
+ return false;
+ return true;
+}
+
bool ArrayType::operator==(Type const& _other) const
{
if (_other.getCategory() != getCategory())