aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/analysis/TypeChecker.cpp
diff options
context:
space:
mode:
authorLeonardo Alt <leo@ethereum.org>2018-08-02 01:01:50 +0800
committerLeonardo Alt <leo@ethereum.org>2018-08-03 19:41:27 +0800
commit20c6cea7bb803a5217f6b96062c7bce150ba2b73 (patch)
tree4e1dcf9400c354b05aaffdc42daf4bfcd988c7fc /libsolidity/analysis/TypeChecker.cpp
parentda6cefd475210a9bcae0aad80c03f3679ae00f56 (diff)
downloaddexon-solidity-20c6cea7bb803a5217f6b96062c7bce150ba2b73.tar
dexon-solidity-20c6cea7bb803a5217f6b96062c7bce150ba2b73.tar.gz
dexon-solidity-20c6cea7bb803a5217f6b96062c7bce150ba2b73.tar.bz2
dexon-solidity-20c6cea7bb803a5217f6b96062c7bce150ba2b73.tar.lz
dexon-solidity-20c6cea7bb803a5217f6b96062c7bce150ba2b73.tar.xz
dexon-solidity-20c6cea7bb803a5217f6b96062c7bce150ba2b73.tar.zst
dexon-solidity-20c6cea7bb803a5217f6b96062c7bce150ba2b73.zip
Disallow structs in events without ABIEncoderV2
Diffstat (limited to 'libsolidity/analysis/TypeChecker.cpp')
-rw-r--r--libsolidity/analysis/TypeChecker.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp
index 8c84e4dc..d5028f3b 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.");