2014-12-08 12:33:13 +00:00
|
|
|
/*
|
|
|
|
This file is part of cpp-ethereum.
|
|
|
|
|
|
|
|
cpp-ethereum is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
cpp-ethereum is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* @author Christian <c@ethdev.com>
|
|
|
|
* @date 2014
|
|
|
|
* Implementation of the accept functions of AST nodes, included by AST.cpp to not clutter that
|
|
|
|
* file with these mechanical implementations.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2015-10-20 22:21:52 +00:00
|
|
|
#include <libsolidity/ast/AST.h>
|
|
|
|
#include <libsolidity/ast/ASTVisitor.h>
|
2014-12-08 12:33:13 +00:00
|
|
|
|
|
|
|
namespace dev
|
|
|
|
{
|
|
|
|
namespace solidity
|
|
|
|
{
|
|
|
|
|
|
|
|
void SourceUnit::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
listAccept(m_nodes, _visitor);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SourceUnit::accept(ASTConstVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
listAccept(m_nodes, _visitor);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ImportDirective::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
|
|
|
_visitor.visit(*this);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ImportDirective::accept(ASTConstVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
_visitor.visit(*this);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ContractDefinition::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
{
|
2015-01-19 20:05:47 +00:00
|
|
|
listAccept(m_baseContracts, _visitor);
|
2014-12-08 12:33:13 +00:00
|
|
|
listAccept(m_definedStructs, _visitor);
|
2015-02-11 20:40:47 +00:00
|
|
|
listAccept(m_definedEnums, _visitor);
|
2014-12-08 12:33:13 +00:00
|
|
|
listAccept(m_stateVariables, _visitor);
|
2015-01-29 13:35:28 +00:00
|
|
|
listAccept(m_events, _visitor);
|
2015-01-21 10:16:18 +00:00
|
|
|
listAccept(m_functionModifiers, _visitor);
|
2015-01-29 13:35:28 +00:00
|
|
|
listAccept(m_definedFunctions, _visitor);
|
2014-12-08 12:33:13 +00:00
|
|
|
}
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ContractDefinition::accept(ASTConstVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
{
|
2015-01-19 20:05:47 +00:00
|
|
|
listAccept(m_baseContracts, _visitor);
|
2014-12-08 12:33:13 +00:00
|
|
|
listAccept(m_definedStructs, _visitor);
|
2015-02-11 20:40:47 +00:00
|
|
|
listAccept(m_definedEnums, _visitor);
|
2014-12-08 12:33:13 +00:00
|
|
|
listAccept(m_stateVariables, _visitor);
|
2015-01-29 13:35:28 +00:00
|
|
|
listAccept(m_events, _visitor);
|
2015-01-21 10:16:18 +00:00
|
|
|
listAccept(m_functionModifiers, _visitor);
|
2015-01-29 13:35:28 +00:00
|
|
|
listAccept(m_definedFunctions, _visitor);
|
2014-12-08 12:33:13 +00:00
|
|
|
}
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2015-01-19 20:05:47 +00:00
|
|
|
void InheritanceSpecifier::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
{
|
|
|
|
m_baseName->accept(_visitor);
|
|
|
|
listAccept(m_arguments, _visitor);
|
|
|
|
}
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void InheritanceSpecifier::accept(ASTConstVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
{
|
|
|
|
m_baseName->accept(_visitor);
|
|
|
|
listAccept(m_arguments, _visitor);
|
|
|
|
}
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2015-02-10 12:40:21 +00:00
|
|
|
void EnumDefinition::accept(ASTVisitor& _visitor)
|
2014-12-08 12:33:13 +00:00
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
listAccept(m_members, _visitor);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2015-02-10 12:40:21 +00:00
|
|
|
void EnumDefinition::accept(ASTConstVisitor& _visitor) const
|
2015-02-09 17:08:56 +00:00
|
|
|
{
|
2015-02-10 12:40:21 +00:00
|
|
|
if (_visitor.visit(*this))
|
|
|
|
listAccept(m_members, _visitor);
|
2015-02-09 17:08:56 +00:00
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2015-02-13 16:34:46 +00:00
|
|
|
void EnumValue::accept(ASTVisitor& _visitor)
|
2015-02-10 12:40:21 +00:00
|
|
|
{
|
|
|
|
_visitor.visit(*this);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2015-02-13 16:34:46 +00:00
|
|
|
void EnumValue::accept(ASTConstVisitor& _visitor) const
|
2015-02-10 12:40:21 +00:00
|
|
|
{
|
|
|
|
_visitor.visit(*this);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void StructDefinition::accept(ASTVisitor& _visitor)
|
2015-02-09 17:08:56 +00:00
|
|
|
{
|
2015-02-10 12:40:21 +00:00
|
|
|
if (_visitor.visit(*this))
|
|
|
|
listAccept(m_members, _visitor);
|
2015-02-09 17:08:56 +00:00
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-12-08 12:33:13 +00:00
|
|
|
void StructDefinition::accept(ASTConstVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
listAccept(m_members, _visitor);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ParameterList::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
listAccept(m_parameters, _visitor);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ParameterList::accept(ASTConstVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
listAccept(m_parameters, _visitor);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void FunctionDefinition::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
{
|
|
|
|
m_parameters->accept(_visitor);
|
|
|
|
if (m_returnParameters)
|
|
|
|
m_returnParameters->accept(_visitor);
|
2015-01-22 00:02:38 +00:00
|
|
|
listAccept(m_functionModifiers, _visitor);
|
2015-03-20 16:50:26 +00:00
|
|
|
if (m_body)
|
|
|
|
m_body->accept(_visitor);
|
2014-12-08 12:33:13 +00:00
|
|
|
}
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void FunctionDefinition::accept(ASTConstVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
{
|
|
|
|
m_parameters->accept(_visitor);
|
|
|
|
if (m_returnParameters)
|
|
|
|
m_returnParameters->accept(_visitor);
|
2015-01-22 00:02:38 +00:00
|
|
|
listAccept(m_functionModifiers, _visitor);
|
2015-03-20 16:50:26 +00:00
|
|
|
if (m_body)
|
|
|
|
m_body->accept(_visitor);
|
2014-12-08 12:33:13 +00:00
|
|
|
}
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void VariableDeclaration::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
2015-02-20 11:27:39 +00:00
|
|
|
{
|
2014-12-08 12:33:13 +00:00
|
|
|
if (m_typeName)
|
|
|
|
m_typeName->accept(_visitor);
|
2015-02-20 11:27:39 +00:00
|
|
|
if (m_value)
|
|
|
|
m_value->accept(_visitor);
|
|
|
|
}
|
2014-12-08 12:33:13 +00:00
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void VariableDeclaration::accept(ASTConstVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
2015-02-20 11:27:39 +00:00
|
|
|
{
|
2014-12-08 12:33:13 +00:00
|
|
|
if (m_typeName)
|
|
|
|
m_typeName->accept(_visitor);
|
2015-02-20 11:27:39 +00:00
|
|
|
if (m_value)
|
|
|
|
m_value->accept(_visitor);
|
|
|
|
}
|
2015-02-20 22:04:32 +00:00
|
|
|
_visitor.endVisit(*this);
|
2014-12-08 12:33:13 +00:00
|
|
|
}
|
|
|
|
|
2015-01-21 10:16:18 +00:00
|
|
|
void ModifierDefinition::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
{
|
|
|
|
m_parameters->accept(_visitor);
|
|
|
|
m_body->accept(_visitor);
|
|
|
|
}
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ModifierDefinition::accept(ASTConstVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
{
|
|
|
|
m_parameters->accept(_visitor);
|
|
|
|
m_body->accept(_visitor);
|
|
|
|
}
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2015-01-22 00:02:38 +00:00
|
|
|
void ModifierInvocation::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
{
|
|
|
|
m_modifierName->accept(_visitor);
|
|
|
|
listAccept(m_arguments, _visitor);
|
|
|
|
}
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ModifierInvocation::accept(ASTConstVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
{
|
|
|
|
m_modifierName->accept(_visitor);
|
|
|
|
listAccept(m_arguments, _visitor);
|
|
|
|
}
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2015-01-29 13:35:28 +00:00
|
|
|
void EventDefinition::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
m_parameters->accept(_visitor);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void EventDefinition::accept(ASTConstVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
m_parameters->accept(_visitor);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-12-08 12:33:13 +00:00
|
|
|
void TypeName::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
|
|
|
_visitor.visit(*this);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void TypeName::accept(ASTConstVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
_visitor.visit(*this);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ElementaryTypeName::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
|
|
|
_visitor.visit(*this);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ElementaryTypeName::accept(ASTConstVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
_visitor.visit(*this);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void UserDefinedTypeName::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
|
|
|
_visitor.visit(*this);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void UserDefinedTypeName::accept(ASTConstVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
_visitor.visit(*this);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Mapping::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
{
|
|
|
|
m_keyType->accept(_visitor);
|
|
|
|
m_valueType->accept(_visitor);
|
|
|
|
}
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Mapping::accept(ASTConstVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
{
|
|
|
|
m_keyType->accept(_visitor);
|
|
|
|
m_valueType->accept(_visitor);
|
|
|
|
}
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2015-02-20 14:52:30 +00:00
|
|
|
void ArrayTypeName::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
{
|
|
|
|
m_baseType->accept(_visitor);
|
|
|
|
if (m_length)
|
|
|
|
m_length->accept(_visitor);
|
|
|
|
}
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ArrayTypeName::accept(ASTConstVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
{
|
|
|
|
m_baseType->accept(_visitor);
|
|
|
|
if (m_length)
|
|
|
|
m_length->accept(_visitor);
|
|
|
|
}
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-12-08 12:33:13 +00:00
|
|
|
void Block::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
listAccept(m_statements, _visitor);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Block::accept(ASTConstVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
listAccept(m_statements, _visitor);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2015-01-21 10:16:18 +00:00
|
|
|
void PlaceholderStatement::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
|
|
|
_visitor.visit(*this);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void PlaceholderStatement::accept(ASTConstVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
_visitor.visit(*this);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-12-08 12:33:13 +00:00
|
|
|
void IfStatement::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
{
|
|
|
|
m_condition->accept(_visitor);
|
|
|
|
m_trueBody->accept(_visitor);
|
|
|
|
if (m_falseBody)
|
|
|
|
m_falseBody->accept(_visitor);
|
|
|
|
}
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void IfStatement::accept(ASTConstVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
{
|
|
|
|
m_condition->accept(_visitor);
|
|
|
|
m_trueBody->accept(_visitor);
|
|
|
|
if (m_falseBody)
|
|
|
|
m_falseBody->accept(_visitor);
|
|
|
|
}
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void WhileStatement::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
{
|
|
|
|
m_condition->accept(_visitor);
|
|
|
|
m_body->accept(_visitor);
|
|
|
|
}
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void WhileStatement::accept(ASTConstVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
{
|
|
|
|
m_condition->accept(_visitor);
|
|
|
|
m_body->accept(_visitor);
|
|
|
|
}
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-12-15 16:45:18 +00:00
|
|
|
void ForStatement::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
{
|
2014-12-16 08:51:51 +00:00
|
|
|
if (m_initExpression)
|
|
|
|
m_initExpression->accept(_visitor);
|
|
|
|
if (m_condExpression)
|
|
|
|
m_condExpression->accept(_visitor);
|
|
|
|
if (m_loopExpression)
|
|
|
|
m_loopExpression->accept(_visitor);
|
2014-12-15 16:45:18 +00:00
|
|
|
m_body->accept(_visitor);
|
|
|
|
}
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ForStatement::accept(ASTConstVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
{
|
2014-12-16 08:51:51 +00:00
|
|
|
if (m_initExpression)
|
|
|
|
m_initExpression->accept(_visitor);
|
|
|
|
if (m_condExpression)
|
|
|
|
m_condExpression->accept(_visitor);
|
|
|
|
if (m_loopExpression)
|
|
|
|
m_loopExpression->accept(_visitor);
|
2014-12-15 16:45:18 +00:00
|
|
|
m_body->accept(_visitor);
|
|
|
|
}
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-12-08 12:33:13 +00:00
|
|
|
void Continue::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
|
|
|
_visitor.visit(*this);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Continue::accept(ASTConstVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
_visitor.visit(*this);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Break::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
|
|
|
_visitor.visit(*this);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Break::accept(ASTConstVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
_visitor.visit(*this);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Return::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
if (m_expression)
|
|
|
|
m_expression->accept(_visitor);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Return::accept(ASTConstVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
if (m_expression)
|
|
|
|
m_expression->accept(_visitor);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2015-09-15 14:33:14 +00:00
|
|
|
void Throw::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
2015-09-16 11:24:58 +00:00
|
|
|
_visitor.visit(*this);
|
2015-09-15 14:33:14 +00:00
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Throw::accept(ASTConstVisitor& _visitor) const
|
|
|
|
{
|
2015-09-16 11:24:58 +00:00
|
|
|
_visitor.visit(*this);
|
2015-09-15 14:33:14 +00:00
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-12-08 12:33:13 +00:00
|
|
|
void ExpressionStatement::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
if (m_expression)
|
|
|
|
m_expression->accept(_visitor);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ExpressionStatement::accept(ASTConstVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
if (m_expression)
|
|
|
|
m_expression->accept(_visitor);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2015-02-17 15:21:38 +00:00
|
|
|
void VariableDeclarationStatement::accept(ASTVisitor& _visitor)
|
2014-12-08 12:33:13 +00:00
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
2015-10-08 16:01:12 +00:00
|
|
|
{
|
|
|
|
for (ASTPointer<VariableDeclaration> const& var: m_variables)
|
|
|
|
if (var)
|
|
|
|
var->accept(_visitor);
|
|
|
|
if (m_initialValue)
|
|
|
|
m_initialValue->accept(_visitor);
|
|
|
|
}
|
2014-12-08 12:33:13 +00:00
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2015-02-17 15:21:38 +00:00
|
|
|
void VariableDeclarationStatement::accept(ASTConstVisitor& _visitor) const
|
2014-12-08 12:33:13 +00:00
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
2015-10-08 16:01:12 +00:00
|
|
|
{
|
|
|
|
for (ASTPointer<VariableDeclaration> const& var: m_variables)
|
|
|
|
if (var)
|
|
|
|
var->accept(_visitor);
|
|
|
|
if (m_initialValue)
|
|
|
|
m_initialValue->accept(_visitor);
|
|
|
|
}
|
2014-12-08 12:33:13 +00:00
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Assignment::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
{
|
|
|
|
m_leftHandSide->accept(_visitor);
|
|
|
|
m_rightHandSide->accept(_visitor);
|
|
|
|
}
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Assignment::accept(ASTConstVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
{
|
|
|
|
m_leftHandSide->accept(_visitor);
|
|
|
|
m_rightHandSide->accept(_visitor);
|
|
|
|
}
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2015-10-12 21:02:35 +00:00
|
|
|
void TupleExpression::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
for (auto const& component: m_components)
|
|
|
|
if (component)
|
|
|
|
component->accept(_visitor);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void TupleExpression::accept(ASTConstVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
for (auto const& component: m_components)
|
|
|
|
if (component)
|
|
|
|
component->accept(_visitor);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-12-08 12:33:13 +00:00
|
|
|
void UnaryOperation::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
m_subExpression->accept(_visitor);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void UnaryOperation::accept(ASTConstVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
m_subExpression->accept(_visitor);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void BinaryOperation::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
{
|
|
|
|
m_left->accept(_visitor);
|
|
|
|
m_right->accept(_visitor);
|
|
|
|
}
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void BinaryOperation::accept(ASTConstVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
{
|
|
|
|
m_left->accept(_visitor);
|
|
|
|
m_right->accept(_visitor);
|
|
|
|
}
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void FunctionCall::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
{
|
|
|
|
m_expression->accept(_visitor);
|
|
|
|
listAccept(m_arguments, _visitor);
|
|
|
|
}
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void FunctionCall::accept(ASTConstVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
{
|
|
|
|
m_expression->accept(_visitor);
|
|
|
|
listAccept(m_arguments, _visitor);
|
|
|
|
}
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-12-12 15:49:26 +00:00
|
|
|
void NewExpression::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
2015-11-16 23:06:57 +00:00
|
|
|
m_typeName->accept(_visitor);
|
2014-12-12 15:49:26 +00:00
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void NewExpression::accept(ASTConstVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
2015-11-16 23:06:57 +00:00
|
|
|
m_typeName->accept(_visitor);
|
2014-12-12 15:49:26 +00:00
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-12-08 12:33:13 +00:00
|
|
|
void MemberAccess::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
m_expression->accept(_visitor);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MemberAccess::accept(ASTConstVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
m_expression->accept(_visitor);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void IndexAccess::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
{
|
|
|
|
m_base->accept(_visitor);
|
2015-02-21 17:25:08 +00:00
|
|
|
if (m_index)
|
|
|
|
m_index->accept(_visitor);
|
2014-12-08 12:33:13 +00:00
|
|
|
}
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void IndexAccess::accept(ASTConstVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
{
|
|
|
|
m_base->accept(_visitor);
|
2015-02-21 17:25:08 +00:00
|
|
|
if (m_index)
|
|
|
|
m_index->accept(_visitor);
|
2014-12-08 12:33:13 +00:00
|
|
|
}
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Identifier::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
|
|
|
_visitor.visit(*this);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Identifier::accept(ASTConstVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
_visitor.visit(*this);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ElementaryTypeNameExpression::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
|
|
|
_visitor.visit(*this);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ElementaryTypeNameExpression::accept(ASTConstVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
_visitor.visit(*this);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Literal::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
|
|
|
_visitor.visit(*this);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Literal::accept(ASTConstVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
_visitor.visit(*this);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|