aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/ast
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2017-08-24 21:20:49 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-09-16 19:31:12 +0800
commit70d70e78160069d28a6b4931c995d0b24c2b09d5 (patch)
tree010da58b648001b2d16848de6658c7d33e4cef62 /libsolidity/ast
parent6385641f6e461a1964da793956fbe0ef8cddadd3 (diff)
downloaddexon-solidity-70d70e78160069d28a6b4931c995d0b24c2b09d5.tar
dexon-solidity-70d70e78160069d28a6b4931c995d0b24c2b09d5.tar.gz
dexon-solidity-70d70e78160069d28a6b4931c995d0b24c2b09d5.tar.bz2
dexon-solidity-70d70e78160069d28a6b4931c995d0b24c2b09d5.tar.lz
dexon-solidity-70d70e78160069d28a6b4931c995d0b24c2b09d5.tar.xz
dexon-solidity-70d70e78160069d28a6b4931c995d0b24c2b09d5.tar.zst
dexon-solidity-70d70e78160069d28a6b4931c995d0b24c2b09d5.zip
Implement struct encoder.
Diffstat (limited to 'libsolidity/ast')
-rw-r--r--libsolidity/ast/Types.cpp10
-rw-r--r--libsolidity/ast/Types.h2
2 files changed, 10 insertions, 2 deletions
diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp
index 14b30df8..c7843b90 100644
--- a/libsolidity/ast/Types.cpp
+++ b/libsolidity/ast/Types.cpp
@@ -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
diff --git a/libsolidity/ast/Types.h b/libsolidity/ast/Types.h
index dd50c573..cb439693 100644
--- a/libsolidity/ast/Types.h
+++ b/libsolidity/ast/Types.h
@@ -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;