diff options
author | chriseth <c@ethdev.com> | 2015-08-04 17:06:57 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-08-04 17:06:57 +0800 |
commit | 56d5c3310628a1e90225062f0ed21c8378678d09 (patch) | |
tree | a20fea1c1a6ba249ccb4736c39347e8c0637b919 /Types.cpp | |
parent | 6daa27622a06ec7b8a4d67e4d8a1e2dcaa1be982 (diff) | |
download | dexon-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.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -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()) |