diff --git a/libsolidity/AST.h b/libsolidity/AST.h index 113daf72e..a3adca79c 100755 --- a/libsolidity/AST.h +++ b/libsolidity/AST.h @@ -471,7 +471,7 @@ private: /** * Definition of a (loggable) event. */ -class EventDefinition: public Declaration, public Documented +class EventDefinition: public Declaration, public VariableScope, public Documented { public: EventDefinition(Location const& _location, diff --git a/libsolidity/NameAndTypeResolver.cpp b/libsolidity/NameAndTypeResolver.cpp index 75df637c4..7dc42bc62 100644 --- a/libsolidity/NameAndTypeResolver.cpp +++ b/libsolidity/NameAndTypeResolver.cpp @@ -263,10 +263,15 @@ bool DeclarationRegistrationHelper::visit(VariableDeclaration& _declaration) bool DeclarationRegistrationHelper::visit(EventDefinition& _event) { - registerDeclaration(_event, false); + registerDeclaration(_event, true); return true; } +void DeclarationRegistrationHelper::endVisit(EventDefinition&) +{ + closeCurrentScope(); +} + void DeclarationRegistrationHelper::enterNewSubScope(Declaration const& _declaration) { map::iterator iter; diff --git a/libsolidity/NameAndTypeResolver.h b/libsolidity/NameAndTypeResolver.h index 4555491f4..4b7ce6e7d 100644 --- a/libsolidity/NameAndTypeResolver.h +++ b/libsolidity/NameAndTypeResolver.h @@ -94,17 +94,18 @@ public: DeclarationRegistrationHelper(std::map& _scopes, ASTNode& _astRoot); private: - bool visit(ContractDefinition& _contract); - void endVisit(ContractDefinition& _contract); - bool visit(StructDefinition& _struct); - void endVisit(StructDefinition& _struct); - bool visit(FunctionDefinition& _function); - void endVisit(FunctionDefinition& _function); - bool visit(ModifierDefinition& _modifier); - void endVisit(ModifierDefinition& _modifier); - void endVisit(VariableDefinition& _variableDefinition); - bool visit(VariableDeclaration& _declaration); - bool visit(EventDefinition& _event); + bool visit(ContractDefinition& _contract) override; + void endVisit(ContractDefinition& _contract) override; + bool visit(StructDefinition& _struct) override; + void endVisit(StructDefinition& _struct) override; + bool visit(FunctionDefinition& _function) override; + void endVisit(FunctionDefinition& _function) override; + bool visit(ModifierDefinition& _modifier) override; + void endVisit(ModifierDefinition& _modifier) override; + void endVisit(VariableDefinition& _variableDefinition) override; + bool visit(VariableDeclaration& _declaration) override; + bool visit(EventDefinition& _event) override; + void endVisit(EventDefinition& _event) override; void enterNewSubScope(Declaration const& _declaration); void closeCurrentScope(); diff --git a/test/SolidityNameAndTypeResolution.cpp b/test/SolidityNameAndTypeResolution.cpp index 13d3a5d2e..b9a7140f7 100644 --- a/test/SolidityNameAndTypeResolution.cpp +++ b/test/SolidityNameAndTypeResolution.cpp @@ -770,6 +770,15 @@ BOOST_AUTO_TEST_CASE(event_inheritance) BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text)); } +BOOST_AUTO_TEST_CASE(multiple_events_argument_clash) +{ + char const* text = R"( + contract c { + event e1(uint a, uint e1, uint e2); + event e2(uint a, uint e1, uint e2); + })"; + BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text)); +} BOOST_AUTO_TEST_SUITE_END()