diff options
author | Christian <c@ethdev.com> | 2014-11-07 09:06:37 +0800 |
---|---|---|
committer | Christian <c@ethdev.com> | 2014-11-08 03:02:57 +0800 |
commit | 64a4d77c8b8c559c6e9aad712f7288e4f107e946 (patch) | |
tree | 59a8bef45a09ac9b1682bf213886f713a12468c4 /Types.cpp | |
parent | 4c8e670530675c7b7774b0d5355ee9aadd92f3a2 (diff) | |
download | dexon-solidity-64a4d77c8b8c559c6e9aad712f7288e4f107e946.tar.gz dexon-solidity-64a4d77c8b8c559c6e9aad712f7288e4f107e946.tar.zst dexon-solidity-64a4d77c8b8c559c6e9aad712f7288e4f107e946.zip |
State variables.
Diffstat (limited to 'Types.cpp')
-rw-r--r-- | Types.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -207,6 +207,14 @@ bool ContractType::operator==(Type const& _other) const return other.m_contract == m_contract; } +u256 ContractType::getStorageSize() const +{ + u256 size = 0; + for (ASTPointer<VariableDeclaration> const& variable: m_contract.getStateVariables()) + size += variable->getType()->getStorageSize(); + return max<u256>(1, size); +} + bool StructType::operator==(Type const& _other) const { if (_other.getCategory() != getCategory()) @@ -215,6 +223,14 @@ bool StructType::operator==(Type const& _other) const return other.m_struct == m_struct; } +u256 StructType::getStorageSize() const +{ + u256 size = 0; + for (ASTPointer<VariableDeclaration> const& variable: m_struct.getMembers()) + size += variable->getType()->getStorageSize(); + return max<u256>(1, size); +} + bool FunctionType::operator==(Type const& _other) const { if (_other.getCategory() != getCategory()) |