aboutsummaryrefslogtreecommitdiffstats
path: root/Types.cpp
diff options
context:
space:
mode:
authorChristian <c@ethdev.com>2015-03-03 18:28:56 +0800
committerChristian <c@ethdev.com>2015-03-03 19:58:48 +0800
commit7112696993c84a889c8d654c03c5285e40e6e637 (patch)
treed6a3f875be4e31131c73049289581f389f50a1e0 /Types.cpp
parent7f37659a28253f48dc128998017f9ca9a3351506 (diff)
downloaddexon-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.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/Types.cpp b/Types.cpp
index 22d612cd..96feefff 100644
--- a/Types.cpp
+++ b/Types.cpp
@@ -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;