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
|
||||
{
|
||||
size_t elements = m_enum.members().size();
|
||||
size_t elements = numberOfMembers();
|
||||
if (elements <= 1)
|
||||
return 1;
|
||||
else
|
||||
@ -1578,6 +1578,11 @@ string EnumType::canonicalName(bool) const
|
||||
return m_enum.annotation().canonicalName;
|
||||
}
|
||||
|
||||
size_t EnumType::numberOfMembers() const
|
||||
{
|
||||
return m_enum.members().size();
|
||||
};
|
||||
|
||||
bool EnumType::isExplicitlyConvertibleTo(Type const& _convertTo) const
|
||||
{
|
||||
return _convertTo.category() == category() || _convertTo.category() == Category::Integer;
|
||||
|
@ -738,6 +738,7 @@ public:
|
||||
EnumDefinition const& enumDefinition() const { return m_enum; }
|
||||
/// @returns the value that the string has in the Enum
|
||||
unsigned int memberValue(ASTString const& _member) const;
|
||||
size_t numberOfMembers() const;
|
||||
|
||||
private:
|
||||
EnumDefinition const& m_enum;
|
||||
|
Loading…
Reference in New Issue
Block a user