changed the position of 'anonymous' keyword: event <name>() anonymous.

- style changes
This commit is contained in:
Liana Husikyan 2015-03-17 10:48:46 +01:00
parent 2986ecbd75
commit 5a5577f5a5
3 changed files with 18 additions and 13 deletions

17
AST.h
View File

@ -553,12 +553,17 @@ private:
class EventDefinition: public Declaration, public VariableScope, public Documented
{
public:
EventDefinition(SourceLocation const& _location,
ASTPointer<ASTString> const& _name,
ASTPointer<ASTString> const& _documentation,
ASTPointer<ParameterList> const& _parameters,
bool _anonymous = false):
Declaration(_location, _name), Documented(_documentation), m_parameters(_parameters) , m_anonymous(_anonymous){}
EventDefinition(
SourceLocation const& _location,
ASTPointer<ASTString> const& _name,
ASTPointer<ASTString> const& _documentation,
ASTPointer<ParameterList> const& _parameters,
bool _anonymous = false
):
Declaration(_location, _name),
Documented(_documentation),
m_parameters(_parameters),
m_anonymous(_anonymous){}
virtual void accept(ASTVisitor& _visitor) override;
virtual void accept(ASTConstVisitor& _visitor) const override;

View File

@ -547,7 +547,7 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall)
m_context << u256(h256::Arith(dev::sha3(function.getCanonicalSignature(event.getName()))));
++numIndexed;
}
solAssert(numIndexed <= 4 - (event.IsAnonymous() ? 1 : 0), "Too many indexed arguments.");
solAssert(numIndexed <= 4, "Too many indexed arguments.");
// Copy all non-indexed arguments to memory (data)
m_context << u256(0);
for (unsigned arg = 0; arg < arguments.size(); ++arg)

View File

@ -388,18 +388,18 @@ ASTPointer<EventDefinition> Parser::parseEventDefinition()
docstring = make_shared<ASTString>(m_scanner->getCurrentCommentLiteral());
expectToken(Token::Event);
bool anonymous = false;
if (m_scanner->getCurrentToken() == Token::Anonymous)
{
anonymous = true;
m_scanner->next();
}
ASTPointer<ASTString> name(expectIdentifierToken());
ASTPointer<ParameterList> parameters;
if (m_scanner->getCurrentToken() == Token::LParen)
parameters = parseParameterList(true, true);
else
parameters = createEmptyParameterList();
bool anonymous = false;
if (m_scanner->getCurrentToken() == Token::Anonymous)
{
anonymous = true;
m_scanner->next();
}
nodeFactory.markEndPosition();
expectToken(Token::Semicolon);
return nodeFactory.createNode<EventDefinition>(name, docstring, parameters, anonymous);