mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Return a type error when an enum has more than 256 members
This commit is contained in:
@@ -62,6 +62,18 @@ bool DeclarationTypeChecker::visit(ElementaryTypeName const& _typeName)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool DeclarationTypeChecker::visit(EnumDefinition const& _enum)
|
||||
{
|
||||
if (_enum.members().size() > 256)
|
||||
m_errorReporter.declarationError(
|
||||
1611_error,
|
||||
_enum.location(),
|
||||
"Enum with more than 256 members is not allowed."
|
||||
);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DeclarationTypeChecker::visit(StructDefinition const& _struct)
|
||||
{
|
||||
if (_struct.annotation().recursive.has_value())
|
||||
|
||||
@@ -59,6 +59,7 @@ private:
|
||||
void endVisit(Mapping const& _mapping) override;
|
||||
void endVisit(ArrayTypeName const& _typeName) override;
|
||||
void endVisit(VariableDeclaration const& _variable) override;
|
||||
bool visit(EnumDefinition const& _enum) override;
|
||||
bool visit(StructDefinition const& _struct) override;
|
||||
bool visit(UsingForDirective const& _usingForDirective) override;
|
||||
bool visit(InheritanceSpecifier const& _inheritanceSpecifier) override;
|
||||
|
||||
Reference in New Issue
Block a user