mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Fix: No parameters for event.
This commit is contained in:
parent
06e846b45c
commit
ab9dec320a
23
Parser.cpp
23
Parser.cpp
@ -222,12 +222,7 @@ ASTPointer<FunctionDefinition> Parser::parseFunctionDefinition(bool _isPublic, A
|
||||
returnParameters = parseParameterList(permitEmptyParameterList);
|
||||
}
|
||||
else
|
||||
{
|
||||
// create an empty parameter list at a zero-length location
|
||||
ASTNodeFactory nodeFactory(*this);
|
||||
nodeFactory.setLocationEmpty();
|
||||
returnParameters = nodeFactory.createNode<ParameterList>(vector<ASTPointer<VariableDeclaration>>());
|
||||
}
|
||||
returnParameters = createEmptyParameterList();
|
||||
ASTPointer<Block> block = parseBlock();
|
||||
nodeFactory.setEndPositionFromNode(block);
|
||||
bool const c_isConstructor = (_contractName && *name == *_contractName);
|
||||
@ -285,12 +280,7 @@ ASTPointer<ModifierDefinition> Parser::parseModifierDefinition()
|
||||
if (m_scanner->getCurrentToken() == Token::LPAREN)
|
||||
parameters = parseParameterList();
|
||||
else
|
||||
{
|
||||
// create an empty parameter list at a zero-length location
|
||||
ASTNodeFactory nodeFactory(*this);
|
||||
nodeFactory.setLocationEmpty();
|
||||
parameters = nodeFactory.createNode<ParameterList>(vector<ASTPointer<VariableDeclaration>>());
|
||||
}
|
||||
parameters = createEmptyParameterList();
|
||||
ASTPointer<Block> block = parseBlock();
|
||||
nodeFactory.setEndPositionFromNode(block);
|
||||
return nodeFactory.createNode<ModifierDefinition>(name, docstring, parameters, block);
|
||||
@ -308,6 +298,8 @@ ASTPointer<EventDefinition> Parser::parseEventDefinition()
|
||||
ASTPointer<ParameterList> parameters;
|
||||
if (m_scanner->getCurrentToken() == Token::LPAREN)
|
||||
parameters = parseParameterList(true, true);
|
||||
else
|
||||
parameters = createEmptyParameterList();
|
||||
nodeFactory.markEndPosition();
|
||||
expectToken(Token::SEMICOLON);
|
||||
return nodeFactory.createNode<EventDefinition>(name, docstring, parameters);
|
||||
@ -771,6 +763,13 @@ ASTPointer<ASTString> Parser::getLiteralAndAdvance()
|
||||
return identifier;
|
||||
}
|
||||
|
||||
ASTPointer<ParameterList> Parser::createEmptyParameterList()
|
||||
{
|
||||
ASTNodeFactory nodeFactory(*this);
|
||||
nodeFactory.setLocationEmpty();
|
||||
return nodeFactory.createNode<ParameterList>(vector<ASTPointer<VariableDeclaration>>());
|
||||
}
|
||||
|
||||
ParserError Parser::createParserError(string const& _description) const
|
||||
{
|
||||
return ParserError() << errinfo_sourceLocation(Location(getPosition(), getPosition(), getSourceName()))
|
||||
|
3
Parser.h
3
Parser.h
@ -97,6 +97,9 @@ private:
|
||||
ASTPointer<ASTString> getLiteralAndAdvance();
|
||||
///@}
|
||||
|
||||
/// Creates an empty ParameterList at the current location (used if parameters can be omitted).
|
||||
ASTPointer<ParameterList> createEmptyParameterList();
|
||||
|
||||
/// Creates a @ref ParserError exception and annotates it with the current position and the
|
||||
/// given @a _description.
|
||||
ParserError createParserError(std::string const& _description) const;
|
||||
|
Loading…
Reference in New Issue
Block a user