mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
State variables.
This commit is contained in:
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user