mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Move implementations of ::accept out of AST.cpp.
This commit is contained in:
parent
a15b03e991
commit
e8b18e95ce
459
AST.cpp
459
AST.cpp
@ -25,6 +25,7 @@
|
|||||||
#include <libsolidity/AST.h>
|
#include <libsolidity/AST.h>
|
||||||
#include <libsolidity/ASTVisitor.h>
|
#include <libsolidity/ASTVisitor.h>
|
||||||
#include <libsolidity/Exceptions.h>
|
#include <libsolidity/Exceptions.h>
|
||||||
|
#include <libsolidity/AST_accept.h>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@ -33,464 +34,6 @@ namespace dev
|
|||||||
namespace solidity
|
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))
|
|
||||||
{
|
|
||||||
listAccept(m_definedStructs, _visitor);
|
|
||||||
listAccept(m_stateVariables, _visitor);
|
|
||||||
listAccept(m_definedFunctions, _visitor);
|
|
||||||
}
|
|
||||||
_visitor.endVisit(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ContractDefinition::accept(ASTConstVisitor& _visitor) const
|
|
||||||
{
|
|
||||||
if (_visitor.visit(*this))
|
|
||||||
{
|
|
||||||
listAccept(m_definedStructs, _visitor);
|
|
||||||
listAccept(m_stateVariables, _visitor);
|
|
||||||
listAccept(m_definedFunctions, _visitor);
|
|
||||||
}
|
|
||||||
_visitor.endVisit(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
void StructDefinition::accept(ASTVisitor& _visitor)
|
|
||||||
{
|
|
||||||
if (_visitor.visit(*this))
|
|
||||||
listAccept(m_members, _visitor);
|
|
||||||
_visitor.endVisit(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
void StructDefinition::accept(ASTConstVisitor& _visitor) const
|
|
||||||
{
|
|
||||||
if (_visitor.visit(*this))
|
|
||||||
listAccept(m_members, _visitor);
|
|
||||||
_visitor.endVisit(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
void StructDefinition::checkValidityOfMembers() const
|
|
||||||
{
|
|
||||||
checkMemberTypes();
|
|
||||||
checkRecursion();
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
m_body->accept(_visitor);
|
|
||||||
}
|
|
||||||
_visitor.endVisit(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
void FunctionDefinition::accept(ASTConstVisitor& _visitor) const
|
|
||||||
{
|
|
||||||
if (_visitor.visit(*this))
|
|
||||||
{
|
|
||||||
m_parameters->accept(_visitor);
|
|
||||||
if (m_returnParameters)
|
|
||||||
m_returnParameters->accept(_visitor);
|
|
||||||
m_body->accept(_visitor);
|
|
||||||
}
|
|
||||||
_visitor.endVisit(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
void VariableDeclaration::accept(ASTVisitor& _visitor)
|
|
||||||
{
|
|
||||||
if (_visitor.visit(*this))
|
|
||||||
if (m_typeName)
|
|
||||||
m_typeName->accept(_visitor);
|
|
||||||
_visitor.endVisit(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
void VariableDeclaration::accept(ASTConstVisitor& _visitor) const
|
|
||||||
{
|
|
||||||
if (_visitor.visit(*this))
|
|
||||||
if (m_typeName)
|
|
||||||
m_typeName->accept(_visitor);
|
|
||||||
_visitor.endVisit(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
void VariableDefinition::accept(ASTVisitor& _visitor)
|
|
||||||
{
|
|
||||||
if (_visitor.visit(*this))
|
|
||||||
{
|
|
||||||
m_variable->accept(_visitor);
|
|
||||||
if (m_value)
|
|
||||||
m_value->accept(_visitor);
|
|
||||||
}
|
|
||||||
_visitor.endVisit(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
void VariableDefinition::accept(ASTConstVisitor& _visitor) const
|
|
||||||
{
|
|
||||||
if (_visitor.visit(*this))
|
|
||||||
{
|
|
||||||
m_variable->accept(_visitor);
|
|
||||||
if (m_value)
|
|
||||||
m_value->accept(_visitor);
|
|
||||||
}
|
|
||||||
_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);
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
m_index->accept(_visitor);
|
|
||||||
}
|
|
||||||
_visitor.endVisit(*this);
|
|
||||||
}
|
|
||||||
|
|
||||||
void IndexAccess::accept(ASTConstVisitor& _visitor) const
|
|
||||||
{
|
|
||||||
if (_visitor.visit(*this))
|
|
||||||
{
|
|
||||||
m_base->accept(_visitor);
|
|
||||||
m_index->accept(_visitor);
|
|
||||||
}
|
|
||||||
_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);
|
|
||||||
}
|
|
||||||
|
|
||||||
TypeError ASTNode::createTypeError(string const& _description) const
|
TypeError ASTNode::createTypeError(string const& _description) const
|
||||||
{
|
{
|
||||||
return TypeError() << errinfo_sourceLocation(getLocation()) << errinfo_comment(_description);
|
return TypeError() << errinfo_sourceLocation(getLocation()) << errinfo_comment(_description);
|
||||||
|
493
AST_accept.h
Normal file
493
AST_accept.h
Normal file
@ -0,0 +1,493 @@
|
|||||||
|
/*
|
||||||
|
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
|
||||||
|
|
||||||
|
#include <libsolidity/AST.h>
|
||||||
|
#include <libsolidity/ASTVisitor.h>
|
||||||
|
|
||||||
|
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))
|
||||||
|
{
|
||||||
|
listAccept(m_definedStructs, _visitor);
|
||||||
|
listAccept(m_stateVariables, _visitor);
|
||||||
|
listAccept(m_definedFunctions, _visitor);
|
||||||
|
}
|
||||||
|
_visitor.endVisit(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ContractDefinition::accept(ASTConstVisitor& _visitor) const
|
||||||
|
{
|
||||||
|
if (_visitor.visit(*this))
|
||||||
|
{
|
||||||
|
listAccept(m_definedStructs, _visitor);
|
||||||
|
listAccept(m_stateVariables, _visitor);
|
||||||
|
listAccept(m_definedFunctions, _visitor);
|
||||||
|
}
|
||||||
|
_visitor.endVisit(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void StructDefinition::accept(ASTVisitor& _visitor)
|
||||||
|
{
|
||||||
|
if (_visitor.visit(*this))
|
||||||
|
listAccept(m_members, _visitor);
|
||||||
|
_visitor.endVisit(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void StructDefinition::accept(ASTConstVisitor& _visitor) const
|
||||||
|
{
|
||||||
|
if (_visitor.visit(*this))
|
||||||
|
listAccept(m_members, _visitor);
|
||||||
|
_visitor.endVisit(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void StructDefinition::checkValidityOfMembers() const
|
||||||
|
{
|
||||||
|
checkMemberTypes();
|
||||||
|
checkRecursion();
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
m_body->accept(_visitor);
|
||||||
|
}
|
||||||
|
_visitor.endVisit(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FunctionDefinition::accept(ASTConstVisitor& _visitor) const
|
||||||
|
{
|
||||||
|
if (_visitor.visit(*this))
|
||||||
|
{
|
||||||
|
m_parameters->accept(_visitor);
|
||||||
|
if (m_returnParameters)
|
||||||
|
m_returnParameters->accept(_visitor);
|
||||||
|
m_body->accept(_visitor);
|
||||||
|
}
|
||||||
|
_visitor.endVisit(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void VariableDeclaration::accept(ASTVisitor& _visitor)
|
||||||
|
{
|
||||||
|
if (_visitor.visit(*this))
|
||||||
|
if (m_typeName)
|
||||||
|
m_typeName->accept(_visitor);
|
||||||
|
_visitor.endVisit(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void VariableDeclaration::accept(ASTConstVisitor& _visitor) const
|
||||||
|
{
|
||||||
|
if (_visitor.visit(*this))
|
||||||
|
if (m_typeName)
|
||||||
|
m_typeName->accept(_visitor);
|
||||||
|
_visitor.endVisit(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
void VariableDefinition::accept(ASTVisitor& _visitor)
|
||||||
|
{
|
||||||
|
if (_visitor.visit(*this))
|
||||||
|
{
|
||||||
|
m_variable->accept(_visitor);
|
||||||
|
if (m_value)
|
||||||
|
m_value->accept(_visitor);
|
||||||
|
}
|
||||||
|
_visitor.endVisit(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void VariableDefinition::accept(ASTConstVisitor& _visitor) const
|
||||||
|
{
|
||||||
|
if (_visitor.visit(*this))
|
||||||
|
{
|
||||||
|
m_variable->accept(_visitor);
|
||||||
|
if (m_value)
|
||||||
|
m_value->accept(_visitor);
|
||||||
|
}
|
||||||
|
_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);
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
m_index->accept(_visitor);
|
||||||
|
}
|
||||||
|
_visitor.endVisit(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IndexAccess::accept(ASTConstVisitor& _visitor) const
|
||||||
|
{
|
||||||
|
if (_visitor.visit(*this))
|
||||||
|
{
|
||||||
|
m_base->accept(_visitor);
|
||||||
|
m_index->accept(_visitor);
|
||||||
|
}
|
||||||
|
_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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user