mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
ast: add EnumType::numberOfMembers()
This commit is contained in:
parent
7820f80192
commit
e6098f0039
@ -1561,7 +1561,7 @@ bool EnumType::operator==(Type const& _other) const
|
|||||||
|
|
||||||
unsigned EnumType::storageBytes() const
|
unsigned EnumType::storageBytes() const
|
||||||
{
|
{
|
||||||
size_t elements = m_enum.members().size();
|
size_t elements = numberOfMembers();
|
||||||
if (elements <= 1)
|
if (elements <= 1)
|
||||||
return 1;
|
return 1;
|
||||||
else
|
else
|
||||||
@ -1578,6 +1578,11 @@ string EnumType::canonicalName(bool) const
|
|||||||
return m_enum.annotation().canonicalName;
|
return m_enum.annotation().canonicalName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t EnumType::numberOfMembers() const
|
||||||
|
{
|
||||||
|
return m_enum.members().size();
|
||||||
|
};
|
||||||
|
|
||||||
bool EnumType::isExplicitlyConvertibleTo(Type const& _convertTo) const
|
bool EnumType::isExplicitlyConvertibleTo(Type const& _convertTo) const
|
||||||
{
|
{
|
||||||
return _convertTo.category() == category() || _convertTo.category() == Category::Integer;
|
return _convertTo.category() == category() || _convertTo.category() == Category::Integer;
|
||||||
|
@ -738,6 +738,7 @@ public:
|
|||||||
EnumDefinition const& enumDefinition() const { return m_enum; }
|
EnumDefinition const& enumDefinition() const { return m_enum; }
|
||||||
/// @returns the value that the string has in the Enum
|
/// @returns the value that the string has in the Enum
|
||||||
unsigned int memberValue(ASTString const& _member) const;
|
unsigned int memberValue(ASTString const& _member) const;
|
||||||
|
size_t numberOfMembers() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
EnumDefinition const& m_enum;
|
EnumDefinition const& m_enum;
|
||||||
|
Loading…
Reference in New Issue
Block a user