State variables.

This commit is contained in:
Christian
2014-11-07 20:02:57 +01:00
parent 4c8e670530
commit 64a4d77c8b
8 changed files with 213 additions and 86 deletions
+16
View File
@@ -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())