diff options
author | chriseth <chris@ethereum.org> | 2018-08-06 17:44:05 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-06 17:44:05 +0800 |
commit | 3576980710e019165db272afb4fc5e80f8bd5bff (patch) | |
tree | 00c5362dfc08cca1b11ce7073030e5c3cfcffdb4 /libsolidity/analysis | |
parent | 30f981fc2ca00765bdf6be55f1b634937847ab92 (diff) | |
parent | 20c6cea7bb803a5217f6b96062c7bce150ba2b73 (diff) | |
download | dexon-solidity-3576980710e019165db272afb4fc5e80f8bd5bff.tar.gz dexon-solidity-3576980710e019165db272afb4fc5e80f8bd5bff.tar.zst dexon-solidity-3576980710e019165db272afb4fc5e80f8bd5bff.zip |
Merge pull request #4644 from ethereum/event_struct_error
Disallow structs in events without ABIEncoderV2
Diffstat (limited to 'libsolidity/analysis')
-rw-r--r-- | libsolidity/analysis/TypeChecker.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 47df10b2..af4d44a6 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -817,6 +817,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()) { @@ -826,6 +827,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."); |