diff options
Diffstat (limited to 'libsolidity/ast')
-rw-r--r-- | libsolidity/ast/Types.cpp | 4 | ||||
-rw-r--r-- | libsolidity/ast/Types.h | 5 |
2 files changed, 5 insertions, 4 deletions
diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index 0253e843..cb97eae8 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -781,7 +781,7 @@ bool ArrayType::operator==(Type const& _other) const unsigned ArrayType::calldataEncodedSize(bool _padded) const { if (isDynamicallySized()) - return 0; + return 32; bigint size = bigint(length()) * (isByteArray() ? 1 : baseType()->calldataEncodedSize(_padded)); size = ((size + 31) / 32) * 32; solAssert(size <= numeric_limits<unsigned>::max(), "Array size does not fit unsigned."); @@ -1698,7 +1698,7 @@ FunctionTypePointer FunctionType::asMemberFunction(bool _inLibrary) const TypePointers returnParameterTypes; vector<string> returnParameterNames; for (size_t i = 0; i < m_returnParameterTypes.size(); ++i) - if (m_returnParameterTypes[i]->calldataEncodedSize() > 0) + if (!m_returnParameterTypes[i]->isDynamicallySized()) { returnParameterTypes.push_back(m_returnParameterTypes[i]); returnParameterNames.push_back(m_returnParameterNames[i]); diff --git a/libsolidity/ast/Types.h b/libsolidity/ast/Types.h index 59c84b7a..f5aefa25 100644 --- a/libsolidity/ast/Types.h +++ b/libsolidity/ast/Types.h @@ -175,8 +175,9 @@ public: virtual bool operator==(Type const& _other) const { return category() == _other.category(); } virtual bool operator!=(Type const& _other) const { return !this->operator ==(_other); } - /// @returns number of bytes used by this type when encoded for CALL, or 0 if the encoding - /// is not a simple big-endian encoding or the type cannot be stored in calldata. + /// @returns number of bytes used by this type when encoded for CALL. If it is a dynamic type, + /// returns the size of the pointer (usually 32). Returns 0 if the type cannot be encoded + /// in calldata. /// If @a _padded then it is assumed that each element is padded to a multiple of 32 bytes. virtual unsigned calldataEncodedSize(bool _padded) const { (void)_padded; return 0; } /// @returns the size of this data type in bytes when stored in memory. For memory-reference |