aboutsummaryrefslogtreecommitdiffstats
path: root/Types.cpp
diff options
context:
space:
mode:
authorChristian <c@ethdev.com>2014-11-07 09:06:37 +0800
committerChristian <c@ethdev.com>2014-11-08 03:02:57 +0800
commit64a4d77c8b8c559c6e9aad712f7288e4f107e946 (patch)
tree59a8bef45a09ac9b1682bf213886f713a12468c4 /Types.cpp
parent4c8e670530675c7b7774b0d5355ee9aadd92f3a2 (diff)
downloaddexon-solidity-64a4d77c8b8c559c6e9aad712f7288e4f107e946.tar.gz
dexon-solidity-64a4d77c8b8c559c6e9aad712f7288e4f107e946.tar.zst
dexon-solidity-64a4d77c8b8c559c6e9aad712f7288e4f107e946.zip
State variables.
Diffstat (limited to 'Types.cpp')
-rw-r--r--Types.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/Types.cpp b/Types.cpp
index 4431a32f..d861980d 100644
--- a/Types.cpp
+++ b/Types.cpp
@@ -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())