mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Disallow structs in events without ABIEncoderV2
This commit is contained in:
@@ -864,6 +864,7 @@ void TypeChecker::visitManually(
|
||||
|
||||
bool TypeChecker::visit(EventDefinition const& _eventDef)
|
||||
{
|
||||
solAssert(_eventDef.visibility() > Declaration::Visibility::Internal, "");
|
||||
unsigned numIndexed = 0;
|
||||
for (ASTPointer<VariableDeclaration> const& var: _eventDef.parameters())
|
||||
{
|
||||
@@ -873,6 +874,15 @@ bool TypeChecker::visit(EventDefinition const& _eventDef)
|
||||
m_errorReporter.typeError(var->location(), "Type is required to live outside storage.");
|
||||
if (!type(*var)->interfaceType(false))
|
||||
m_errorReporter.typeError(var->location(), "Internal or recursive type is not allowed as event parameter type.");
|
||||
if (
|
||||
!_eventDef.sourceUnit().annotation().experimentalFeatures.count(ExperimentalFeature::ABIEncoderV2) &&
|
||||
!typeSupportedByOldABIEncoder(*type(*var))
|
||||
)
|
||||
m_errorReporter.typeError(
|
||||
var->location(),
|
||||
"This type is only supported in the new experimental ABI encoder. "
|
||||
"Use \"pragma experimental ABIEncoderV2;\" to enable the feature."
|
||||
);
|
||||
}
|
||||
if (_eventDef.isAnonymous() && numIndexed > 4)
|
||||
m_errorReporter.typeError(_eventDef.location(), "More than 4 indexed arguments for anonymous event.");
|
||||
|
||||
Reference in New Issue
Block a user