diff options
author | Christian <c@ethdev.com> | 2015-03-03 18:28:56 +0800 |
---|---|---|
committer | Christian <c@ethdev.com> | 2015-03-03 19:58:48 +0800 |
commit | 7112696993c84a889c8d654c03c5285e40e6e637 (patch) | |
tree | d6a3f875be4e31131c73049289581f389f50a1e0 /Types.cpp | |
parent | 7f37659a28253f48dc128998017f9ca9a3351506 (diff) | |
download | dexon-solidity-7112696993c84a889c8d654c03c5285e40e6e637.tar.gz dexon-solidity-7112696993c84a889c8d654c03c5285e40e6e637.tar.zst dexon-solidity-7112696993c84a889c8d654c03c5285e40e6e637.zip |
Fixed arrays in ABI.
Diffstat (limited to 'Types.cpp')
-rw-r--r-- | Types.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -570,6 +570,15 @@ bool ArrayType::operator==(Type const& _other) const return isDynamicallySized() || getLength() == other.getLength(); } +unsigned ArrayType::getCalldataEncodedSize() const +{ + if (isDynamicallySized()) + return 0; + bigint size = bigint(getLength()) * (isByteArray() ? 1 : getBaseType()->getCalldataEncodedSize()); + solAssert(size <= numeric_limits<unsigned>::max(), "Array size does not fit unsigned."); + return unsigned(size); +} + u256 ArrayType::getStorageSize() const { if (isDynamicallySized()) @@ -586,8 +595,8 @@ u256 ArrayType::getStorageSize() const unsigned ArrayType::getSizeOnStack() const { if (m_location == Location::CallData) - // offset, length (stack top) - return 2; + // offset [length] (stack top) + return 1 + (isDynamicallySized() ? 1 : 0); else // offset return 1; |