Implement struct encoder.

This commit is contained in:
chriseth
2017-09-16 12:31:12 +01:00
committed by Alex Beregszaszi
parent 6385641f6e
commit 70d70e7816
7 changed files with 177 additions and 52 deletions
+9 -1
View File
@@ -1735,7 +1735,15 @@ unsigned StructType::calldataEncodedSize(bool _padded) const
bool StructType::isDynamicallyEncoded() const
{
solAssert(false, "Structs are not yet supported in the ABI.");
solAssert(!recursive(), "");
for (auto t: memoryMemberTypes())
{
solAssert(t, "Parameter should have external type.");
t = t->interfaceType(false);
if (t->isDynamicallyEncoded())
return true;
}
return false;
}
u256 StructType::memorySize() const
+1 -1
View File
@@ -745,7 +745,7 @@ public:
virtual MemberList::MemberMap nativeMembers(ContractDefinition const* _currentScope) const override;
virtual TypePointer encodingType() const override
{
return location() == DataLocation::Storage ? std::make_shared<IntegerType>(256) : TypePointer();
return location() == DataLocation::Storage ? std::make_shared<IntegerType>(256) : shared_from_this();
}
virtual TypePointer interfaceType(bool _inLibrary) const override;