ast: add EnumType::numberOfMembers()

This commit is contained in:
Yoichi Hirai
2016-11-11 17:47:48 +01:00
parent 7820f80192
commit e6098f0039
2 changed files with 7 additions and 1 deletions
+6 -1
View File
@@ -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;
+1
View File
@@ -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;