Add type().min/max for enums

This commit is contained in:
Marenz
2021-09-01 15:02:02 +02:00
parent 1e334a8993
commit 2b28f87abf
17 changed files with 85 additions and 25 deletions
+6
View File
@@ -1071,6 +1071,12 @@ public:
/// @returns the value that the string has in the Enum
unsigned int memberValue(ASTString const& _member) const;
size_t numberOfMembers() const;
unsigned int minValue() const { return 0; }
unsigned int maxValue() const
{
solAssert(numberOfMembers() <= 256, "");
return static_cast<unsigned int>(numberOfMembers()) - 1;
}
private:
EnumDefinition const& m_enum;