2014-10-07 16:25:04 +00:00
|
|
|
/*
|
2014-10-16 12:08:54 +00:00
|
|
|
This file is part of cpp-ethereum.
|
2014-10-07 16:25:04 +00:00
|
|
|
|
2014-10-16 12:08:54 +00:00
|
|
|
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.
|
2014-10-07 16:25:04 +00:00
|
|
|
|
2014-10-16 12:08:54 +00:00
|
|
|
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.
|
2014-10-07 16:25:04 +00:00
|
|
|
|
2014-10-16 12:08:54 +00:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
2014-10-07 16:25:04 +00:00
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* @author Christian <c@ethdev.com>
|
|
|
|
* @date 2014
|
|
|
|
* Solidity abstract syntax tree.
|
|
|
|
*/
|
|
|
|
|
2014-10-13 16:22:15 +00:00
|
|
|
#include <algorithm>
|
|
|
|
|
2014-10-07 16:25:04 +00:00
|
|
|
#include <libsolidity/AST.h>
|
2014-10-10 14:37:54 +00:00
|
|
|
#include <libsolidity/ASTVisitor.h>
|
2014-10-15 12:45:51 +00:00
|
|
|
#include <libsolidity/Exceptions.h>
|
2014-10-10 14:37:54 +00:00
|
|
|
|
2014-10-24 17:06:30 +00:00
|
|
|
using namespace std;
|
|
|
|
|
2014-10-16 12:08:54 +00:00
|
|
|
namespace dev
|
|
|
|
{
|
|
|
|
namespace solidity
|
|
|
|
{
|
2014-10-10 14:37:54 +00:00
|
|
|
|
2014-12-03 06:46:55 +00:00
|
|
|
void SourceUnit::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
listAccept(m_nodes, _visitor);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ImportDirective::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
|
|
|
_visitor.visit(*this);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-10-10 14:37:54 +00:00
|
|
|
void ContractDefinition::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
2014-10-16 12:08:54 +00:00
|
|
|
if (_visitor.visit(*this))
|
|
|
|
{
|
2014-10-10 14:37:54 +00:00
|
|
|
listAccept(m_definedStructs, _visitor);
|
|
|
|
listAccept(m_stateVariables, _visitor);
|
|
|
|
listAccept(m_definedFunctions, _visitor);
|
|
|
|
}
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-12-05 16:29:20 +00:00
|
|
|
void ContractDefinition::accept(ASTVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
{
|
|
|
|
listAccept(m_definedStructs, _visitor);
|
|
|
|
listAccept(m_stateVariables, _visitor);
|
|
|
|
listAccept(m_definedFunctions, _visitor);
|
|
|
|
}
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-10-10 14:37:54 +00:00
|
|
|
void StructDefinition::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
2014-10-16 12:08:54 +00:00
|
|
|
if (_visitor.visit(*this))
|
2014-10-10 14:37:54 +00:00
|
|
|
listAccept(m_members, _visitor);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-12-05 16:29:20 +00:00
|
|
|
void StructDefinition::accept(ASTVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
listAccept(m_members, _visitor);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-11-20 17:33:23 +00:00
|
|
|
void StructDefinition::checkValidityOfMembers()
|
|
|
|
{
|
|
|
|
checkMemberTypes();
|
|
|
|
checkRecursion();
|
|
|
|
}
|
|
|
|
|
2014-10-10 14:37:54 +00:00
|
|
|
void ParameterList::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
2014-10-16 12:08:54 +00:00
|
|
|
if (_visitor.visit(*this))
|
2014-10-10 14:37:54 +00:00
|
|
|
listAccept(m_parameters, _visitor);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-12-05 16:29:20 +00:00
|
|
|
void ParameterList::accept(ASTVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
listAccept(m_parameters, _visitor);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-10-10 14:37:54 +00:00
|
|
|
void FunctionDefinition::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
2014-10-16 12:08:54 +00:00
|
|
|
if (_visitor.visit(*this))
|
|
|
|
{
|
2014-10-10 14:37:54 +00:00
|
|
|
m_parameters->accept(_visitor);
|
|
|
|
if (m_returnParameters)
|
|
|
|
m_returnParameters->accept(_visitor);
|
|
|
|
m_body->accept(_visitor);
|
|
|
|
}
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-12-05 16:29:20 +00:00
|
|
|
void FunctionDefinition::accept(ASTVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
{
|
|
|
|
m_parameters->accept(_visitor);
|
|
|
|
if (m_returnParameters)
|
|
|
|
m_returnParameters->accept(_visitor);
|
|
|
|
m_body->accept(_visitor);
|
|
|
|
}
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-10-10 14:37:54 +00:00
|
|
|
void VariableDeclaration::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
2014-10-16 12:08:54 +00:00
|
|
|
if (_visitor.visit(*this))
|
2014-10-13 16:22:15 +00:00
|
|
|
if (m_typeName)
|
|
|
|
m_typeName->accept(_visitor);
|
2014-10-10 14:37:54 +00:00
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-12-05 16:29:20 +00:00
|
|
|
void VariableDeclaration::accept(ASTVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
if (m_typeName)
|
|
|
|
m_typeName->accept(_visitor);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-10-10 14:37:54 +00:00
|
|
|
void TypeName::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
|
|
|
_visitor.visit(*this);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-12-05 16:29:20 +00:00
|
|
|
void TypeName::accept(ASTVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
_visitor.visit(*this);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-10-10 14:37:54 +00:00
|
|
|
void ElementaryTypeName::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
|
|
|
_visitor.visit(*this);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-12-05 16:29:20 +00:00
|
|
|
void ElementaryTypeName::accept(ASTVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
_visitor.visit(*this);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-10-10 14:37:54 +00:00
|
|
|
void UserDefinedTypeName::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
|
|
|
_visitor.visit(*this);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-12-05 16:29:20 +00:00
|
|
|
void UserDefinedTypeName::accept(ASTVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
_visitor.visit(*this);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-10-10 14:37:54 +00:00
|
|
|
void Mapping::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
2014-10-16 12:08:54 +00:00
|
|
|
if (_visitor.visit(*this))
|
|
|
|
{
|
2014-10-10 14:37:54 +00:00
|
|
|
m_keyType->accept(_visitor);
|
|
|
|
m_valueType->accept(_visitor);
|
|
|
|
}
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-12-05 16:29:20 +00:00
|
|
|
void Mapping::accept(ASTVisitor& _visitor) const
|
2014-10-10 14:37:54 +00:00
|
|
|
{
|
2014-12-05 16:29:20 +00:00
|
|
|
if (_visitor.visit(*this))
|
|
|
|
{
|
|
|
|
m_keyType->accept(_visitor);
|
|
|
|
m_valueType->accept(_visitor);
|
|
|
|
}
|
2014-10-10 14:37:54 +00:00
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Block::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
2014-10-16 12:08:54 +00:00
|
|
|
if (_visitor.visit(*this))
|
2014-10-10 14:37:54 +00:00
|
|
|
listAccept(m_statements, _visitor);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-12-05 16:29:20 +00:00
|
|
|
void Block::accept(ASTVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
listAccept(m_statements, _visitor);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-10-10 14:37:54 +00:00
|
|
|
void IfStatement::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
2014-10-16 12:08:54 +00:00
|
|
|
if (_visitor.visit(*this))
|
|
|
|
{
|
2014-10-10 14:37:54 +00:00
|
|
|
m_condition->accept(_visitor);
|
|
|
|
m_trueBody->accept(_visitor);
|
|
|
|
if (m_falseBody)
|
|
|
|
m_falseBody->accept(_visitor);
|
|
|
|
}
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-12-05 16:29:20 +00:00
|
|
|
void IfStatement::accept(ASTVisitor& _visitor) const
|
2014-10-10 14:37:54 +00:00
|
|
|
{
|
2014-12-05 16:29:20 +00:00
|
|
|
if (_visitor.visit(*this))
|
|
|
|
{
|
|
|
|
m_condition->accept(_visitor);
|
|
|
|
m_trueBody->accept(_visitor);
|
|
|
|
if (m_falseBody)
|
|
|
|
m_falseBody->accept(_visitor);
|
|
|
|
}
|
2014-10-10 14:37:54 +00:00
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void WhileStatement::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
2014-10-16 12:08:54 +00:00
|
|
|
if (_visitor.visit(*this))
|
|
|
|
{
|
2014-10-10 14:37:54 +00:00
|
|
|
m_condition->accept(_visitor);
|
|
|
|
m_body->accept(_visitor);
|
|
|
|
}
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-12-05 16:29:20 +00:00
|
|
|
void WhileStatement::accept(ASTVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
{
|
|
|
|
m_condition->accept(_visitor);
|
|
|
|
m_body->accept(_visitor);
|
|
|
|
}
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-10-10 14:37:54 +00:00
|
|
|
void Continue::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
|
|
|
_visitor.visit(*this);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-12-05 16:29:20 +00:00
|
|
|
void Continue::accept(ASTVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
_visitor.visit(*this);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-10-10 14:37:54 +00:00
|
|
|
void Break::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
|
|
|
_visitor.visit(*this);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-12-05 16:29:20 +00:00
|
|
|
void Break::accept(ASTVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
_visitor.visit(*this);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-10-10 14:37:54 +00:00
|
|
|
void Return::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
2014-10-16 12:08:54 +00:00
|
|
|
if (_visitor.visit(*this))
|
2014-10-10 14:37:54 +00:00
|
|
|
if (m_expression)
|
|
|
|
m_expression->accept(_visitor);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-12-05 16:29:20 +00:00
|
|
|
void Return::accept(ASTVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
if (m_expression)
|
|
|
|
m_expression->accept(_visitor);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-10-30 00:20:32 +00:00
|
|
|
void ExpressionStatement::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
if (m_expression)
|
|
|
|
m_expression->accept(_visitor);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-12-05 16:29:20 +00:00
|
|
|
void ExpressionStatement::accept(ASTVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
if (m_expression)
|
|
|
|
m_expression->accept(_visitor);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-10-10 14:37:54 +00:00
|
|
|
void VariableDefinition::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
2014-10-16 12:08:54 +00:00
|
|
|
if (_visitor.visit(*this))
|
|
|
|
{
|
2014-10-10 14:37:54 +00:00
|
|
|
m_variable->accept(_visitor);
|
|
|
|
if (m_value)
|
|
|
|
m_value->accept(_visitor);
|
|
|
|
}
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-12-05 16:29:20 +00:00
|
|
|
void VariableDefinition::accept(ASTVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
{
|
|
|
|
m_variable->accept(_visitor);
|
|
|
|
if (m_value)
|
|
|
|
m_value->accept(_visitor);
|
|
|
|
}
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-10-10 14:37:54 +00:00
|
|
|
void Assignment::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
2014-10-16 12:08:54 +00:00
|
|
|
if (_visitor.visit(*this))
|
|
|
|
{
|
2014-10-10 14:37:54 +00:00
|
|
|
m_leftHandSide->accept(_visitor);
|
|
|
|
m_rightHandSide->accept(_visitor);
|
|
|
|
}
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-12-05 16:29:20 +00:00
|
|
|
void Assignment::accept(ASTVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
{
|
|
|
|
m_leftHandSide->accept(_visitor);
|
|
|
|
m_rightHandSide->accept(_visitor);
|
|
|
|
}
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-10-10 14:37:54 +00:00
|
|
|
void UnaryOperation::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
2014-10-16 12:08:54 +00:00
|
|
|
if (_visitor.visit(*this))
|
2014-10-10 14:37:54 +00:00
|
|
|
m_subExpression->accept(_visitor);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-12-05 16:29:20 +00:00
|
|
|
void UnaryOperation::accept(ASTVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
m_subExpression->accept(_visitor);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-10-10 14:37:54 +00:00
|
|
|
void BinaryOperation::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
2014-10-16 12:08:54 +00:00
|
|
|
if (_visitor.visit(*this))
|
|
|
|
{
|
2014-10-10 14:37:54 +00:00
|
|
|
m_left->accept(_visitor);
|
|
|
|
m_right->accept(_visitor);
|
|
|
|
}
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-12-05 16:29:20 +00:00
|
|
|
void BinaryOperation::accept(ASTVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
{
|
|
|
|
m_left->accept(_visitor);
|
|
|
|
m_right->accept(_visitor);
|
|
|
|
}
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-10-10 14:37:54 +00:00
|
|
|
void FunctionCall::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
2014-10-16 12:08:54 +00:00
|
|
|
if (_visitor.visit(*this))
|
|
|
|
{
|
2014-10-10 14:37:54 +00:00
|
|
|
m_expression->accept(_visitor);
|
|
|
|
listAccept(m_arguments, _visitor);
|
|
|
|
}
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-12-05 16:29:20 +00:00
|
|
|
void FunctionCall::accept(ASTVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
{
|
|
|
|
m_expression->accept(_visitor);
|
|
|
|
listAccept(m_arguments, _visitor);
|
|
|
|
}
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-10-10 14:37:54 +00:00
|
|
|
void MemberAccess::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
2014-10-16 12:08:54 +00:00
|
|
|
if (_visitor.visit(*this))
|
2014-10-10 14:37:54 +00:00
|
|
|
m_expression->accept(_visitor);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-12-05 16:29:20 +00:00
|
|
|
void MemberAccess::accept(ASTVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
m_expression->accept(_visitor);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-10-10 14:37:54 +00:00
|
|
|
void IndexAccess::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
2014-10-16 12:08:54 +00:00
|
|
|
if (_visitor.visit(*this))
|
|
|
|
{
|
2014-10-10 14:37:54 +00:00
|
|
|
m_base->accept(_visitor);
|
|
|
|
m_index->accept(_visitor);
|
|
|
|
}
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-12-05 16:29:20 +00:00
|
|
|
void IndexAccess::accept(ASTVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
if (_visitor.visit(*this))
|
|
|
|
{
|
|
|
|
m_base->accept(_visitor);
|
|
|
|
m_index->accept(_visitor);
|
|
|
|
}
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-10-10 14:37:54 +00:00
|
|
|
void Identifier::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
|
|
|
_visitor.visit(*this);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-12-05 16:29:20 +00:00
|
|
|
void Identifier::accept(ASTVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
_visitor.visit(*this);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-10-10 14:37:54 +00:00
|
|
|
void ElementaryTypeNameExpression::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
|
|
|
_visitor.visit(*this);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-12-05 16:29:20 +00:00
|
|
|
void ElementaryTypeNameExpression::accept(ASTVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
_visitor.visit(*this);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-10-10 14:37:54 +00:00
|
|
|
void Literal::accept(ASTVisitor& _visitor)
|
|
|
|
{
|
|
|
|
_visitor.visit(*this);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-12-05 16:29:20 +00:00
|
|
|
void Literal::accept(ASTVisitor& _visitor) const
|
|
|
|
{
|
|
|
|
_visitor.visit(*this);
|
|
|
|
_visitor.endVisit(*this);
|
|
|
|
}
|
|
|
|
|
2014-11-20 17:33:23 +00:00
|
|
|
TypeError ASTNode::createTypeError(string const& _description) const
|
2014-10-23 17:22:30 +00:00
|
|
|
{
|
|
|
|
return TypeError() << errinfo_sourceLocation(getLocation()) << errinfo_comment(_description);
|
|
|
|
}
|
|
|
|
|
2014-11-11 16:41:48 +00:00
|
|
|
vector<FunctionDefinition const*> ContractDefinition::getInterfaceFunctions() const
|
|
|
|
{
|
|
|
|
vector<FunctionDefinition const*> exportedFunctions;
|
|
|
|
for (ASTPointer<FunctionDefinition> const& f: m_definedFunctions)
|
|
|
|
if (f->isPublic() && f->getName() != getName())
|
|
|
|
exportedFunctions.push_back(f.get());
|
|
|
|
auto compareNames = [](FunctionDefinition const* _a, FunctionDefinition const* _b)
|
|
|
|
{
|
|
|
|
return _a->getName().compare(_b->getName()) < 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
sort(exportedFunctions.begin(), exportedFunctions.end(), compareNames);
|
|
|
|
return exportedFunctions;
|
|
|
|
}
|
|
|
|
|
2014-12-03 06:46:55 +00:00
|
|
|
void StructDefinition::checkMemberTypes()
|
|
|
|
{
|
|
|
|
for (ASTPointer<VariableDeclaration> const& member: getMembers())
|
|
|
|
if (!member->getType()->canBeStored())
|
|
|
|
BOOST_THROW_EXCEPTION(member->createTypeError("Type cannot be used in struct."));
|
|
|
|
}
|
|
|
|
|
|
|
|
void StructDefinition::checkRecursion()
|
|
|
|
{
|
|
|
|
set<StructDefinition const*> definitionsSeen;
|
|
|
|
vector<StructDefinition const*> queue = {this};
|
|
|
|
while (!queue.empty())
|
|
|
|
{
|
|
|
|
StructDefinition const* def = queue.back();
|
|
|
|
queue.pop_back();
|
|
|
|
if (definitionsSeen.count(def))
|
|
|
|
BOOST_THROW_EXCEPTION(ParserError() << errinfo_sourceLocation(def->getLocation())
|
|
|
|
<< errinfo_comment("Recursive struct definition."));
|
|
|
|
definitionsSeen.insert(def);
|
|
|
|
for (ASTPointer<VariableDeclaration> const& member: def->getMembers())
|
|
|
|
if (member->getType()->getCategory() == Type::Category::STRUCT)
|
|
|
|
{
|
|
|
|
UserDefinedTypeName const& typeName = dynamic_cast<UserDefinedTypeName&>(*member->getTypeName());
|
|
|
|
queue.push_back(&dynamic_cast<StructDefinition const&>(*typeName.getReferencedDeclaration()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-11-10 16:31:09 +00:00
|
|
|
void FunctionDefinition::checkTypeRequirements()
|
|
|
|
{
|
|
|
|
for (ASTPointer<VariableDeclaration> const& var: getParameters() + getReturnParameters())
|
|
|
|
if (!var->getType()->canLiveOutsideStorage())
|
|
|
|
BOOST_THROW_EXCEPTION(var->createTypeError("Type is required to live outside storage."));
|
|
|
|
|
|
|
|
m_body->checkTypeRequirements();
|
|
|
|
}
|
|
|
|
|
2014-10-20 12:00:37 +00:00
|
|
|
void Block::checkTypeRequirements()
|
2014-10-13 16:22:15 +00:00
|
|
|
{
|
2014-10-24 17:06:30 +00:00
|
|
|
for (shared_ptr<Statement> const& statement: m_statements)
|
2014-10-13 16:22:15 +00:00
|
|
|
statement->checkTypeRequirements();
|
|
|
|
}
|
|
|
|
|
2014-10-20 12:00:37 +00:00
|
|
|
void IfStatement::checkTypeRequirements()
|
2014-10-13 16:22:15 +00:00
|
|
|
{
|
2014-10-30 00:20:32 +00:00
|
|
|
m_condition->expectType(BoolType());
|
2014-10-13 16:22:15 +00:00
|
|
|
m_trueBody->checkTypeRequirements();
|
2014-10-16 21:49:45 +00:00
|
|
|
if (m_falseBody)
|
|
|
|
m_falseBody->checkTypeRequirements();
|
2014-10-13 16:22:15 +00:00
|
|
|
}
|
|
|
|
|
2014-10-20 12:00:37 +00:00
|
|
|
void WhileStatement::checkTypeRequirements()
|
2014-10-13 16:22:15 +00:00
|
|
|
{
|
2014-10-30 00:20:32 +00:00
|
|
|
m_condition->expectType(BoolType());
|
2014-10-13 16:22:15 +00:00
|
|
|
m_body->checkTypeRequirements();
|
|
|
|
}
|
|
|
|
|
2014-10-20 12:00:37 +00:00
|
|
|
void Return::checkTypeRequirements()
|
2014-10-13 16:22:15 +00:00
|
|
|
{
|
2014-10-30 00:16:11 +00:00
|
|
|
if (!m_expression)
|
|
|
|
return;
|
2014-11-05 13:20:56 +00:00
|
|
|
if (asserts(m_returnParameters))
|
|
|
|
BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Return parameters not assigned."));
|
2014-10-13 16:22:15 +00:00
|
|
|
if (m_returnParameters->getParameters().size() != 1)
|
2014-10-23 17:22:30 +00:00
|
|
|
BOOST_THROW_EXCEPTION(createTypeError("Different number of arguments in return statement "
|
|
|
|
"than in returns declaration."));
|
2014-10-13 16:22:15 +00:00
|
|
|
// this could later be changed such that the paramaters type is an anonymous struct type,
|
|
|
|
// but for now, we only allow one return parameter
|
2014-10-30 00:20:32 +00:00
|
|
|
m_expression->expectType(*m_returnParameters->getParameters().front()->getType());
|
2014-10-13 16:22:15 +00:00
|
|
|
}
|
|
|
|
|
2014-10-20 12:00:37 +00:00
|
|
|
void VariableDefinition::checkTypeRequirements()
|
2014-10-13 16:22:15 +00:00
|
|
|
{
|
|
|
|
// Variables can be declared without type (with "var"), in which case the first assignment
|
2014-11-10 16:31:09 +00:00
|
|
|
// sets the type.
|
2014-10-13 16:22:15 +00:00
|
|
|
// Note that assignments before the first declaration are legal because of the special scoping
|
|
|
|
// rules inherited from JavaScript.
|
2014-10-16 12:08:54 +00:00
|
|
|
if (m_value)
|
|
|
|
{
|
|
|
|
if (m_variable->getType())
|
2014-10-30 00:20:32 +00:00
|
|
|
m_value->expectType(*m_variable->getType());
|
2014-10-16 12:08:54 +00:00
|
|
|
else
|
2014-10-20 12:00:37 +00:00
|
|
|
{
|
2014-10-13 16:22:15 +00:00
|
|
|
// no type declared and no previous assignment, infer the type
|
2014-10-20 12:00:37 +00:00
|
|
|
m_value->checkTypeRequirements();
|
|
|
|
m_variable->setType(m_value->getType());
|
|
|
|
}
|
2014-10-13 16:22:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-10-20 12:00:37 +00:00
|
|
|
void Assignment::checkTypeRequirements()
|
2014-10-13 16:22:15 +00:00
|
|
|
{
|
2014-10-20 12:00:37 +00:00
|
|
|
m_leftHandSide->checkTypeRequirements();
|
2014-11-10 16:31:09 +00:00
|
|
|
m_leftHandSide->requireLValue();
|
2014-12-01 16:32:10 +00:00
|
|
|
//@todo later, assignments to structs might be possible, but not to mappings
|
|
|
|
if (!m_leftHandSide->getType()->isValueType() && !m_leftHandSide->isLocalLValue())
|
|
|
|
BOOST_THROW_EXCEPTION(createTypeError("Assignment to non-local non-value lvalue."));
|
2014-10-30 00:20:32 +00:00
|
|
|
m_rightHandSide->expectType(*m_leftHandSide->getType());
|
2014-10-13 16:22:15 +00:00
|
|
|
m_type = m_leftHandSide->getType();
|
2014-10-16 12:08:54 +00:00
|
|
|
if (m_assigmentOperator != Token::ASSIGN)
|
2014-10-20 10:41:56 +00:00
|
|
|
// compound assignment
|
2014-10-13 16:22:15 +00:00
|
|
|
if (!m_type->acceptsBinaryOperator(Token::AssignmentToBinaryOp(m_assigmentOperator)))
|
2014-10-23 17:22:30 +00:00
|
|
|
BOOST_THROW_EXCEPTION(createTypeError("Operator not compatible with type."));
|
2014-10-13 16:22:15 +00:00
|
|
|
}
|
|
|
|
|
2014-10-30 00:20:32 +00:00
|
|
|
void ExpressionStatement::checkTypeRequirements()
|
|
|
|
{
|
|
|
|
m_expression->checkTypeRequirements();
|
|
|
|
}
|
|
|
|
|
2014-11-05 14:04:33 +00:00
|
|
|
void Expression::expectType(Type const& _expectedType)
|
2014-10-30 00:20:32 +00:00
|
|
|
{
|
|
|
|
checkTypeRequirements();
|
2014-11-06 21:04:10 +00:00
|
|
|
Type const& type = *getType();
|
2014-11-04 14:29:08 +00:00
|
|
|
if (!type.isImplicitlyConvertibleTo(_expectedType))
|
|
|
|
BOOST_THROW_EXCEPTION(createTypeError("Type " + type.toString() +
|
|
|
|
" not implicitly convertible to expected type "
|
|
|
|
+ _expectedType.toString() + "."));
|
2014-10-30 00:20:32 +00:00
|
|
|
}
|
|
|
|
|
2014-11-10 16:31:09 +00:00
|
|
|
void Expression::requireLValue()
|
|
|
|
{
|
2014-12-01 16:32:10 +00:00
|
|
|
if (!isLValue())
|
2014-11-10 16:31:09 +00:00
|
|
|
BOOST_THROW_EXCEPTION(createTypeError("Expression has to be an lvalue."));
|
|
|
|
m_lvalueRequested = true;
|
|
|
|
}
|
|
|
|
|
2014-10-20 12:00:37 +00:00
|
|
|
void UnaryOperation::checkTypeRequirements()
|
2014-10-13 16:22:15 +00:00
|
|
|
{
|
2014-10-25 14:52:22 +00:00
|
|
|
// INC, DEC, ADD, SUB, NOT, BIT_NOT, DELETE
|
2014-10-20 12:00:37 +00:00
|
|
|
m_subExpression->checkTypeRequirements();
|
2014-10-25 14:52:22 +00:00
|
|
|
if (m_operator == Token::Value::INC || m_operator == Token::Value::DEC || m_operator == Token::Value::DELETE)
|
2014-11-10 16:31:09 +00:00
|
|
|
m_subExpression->requireLValue();
|
2014-10-20 12:00:37 +00:00
|
|
|
m_type = m_subExpression->getType();
|
2014-10-20 10:41:56 +00:00
|
|
|
if (!m_type->acceptsUnaryOperator(m_operator))
|
2014-10-23 17:22:30 +00:00
|
|
|
BOOST_THROW_EXCEPTION(createTypeError("Unary operator not compatible with type."));
|
2014-10-13 16:22:15 +00:00
|
|
|
}
|
|
|
|
|
2014-10-20 12:00:37 +00:00
|
|
|
void BinaryOperation::checkTypeRequirements()
|
2014-10-13 16:22:15 +00:00
|
|
|
{
|
|
|
|
m_left->checkTypeRequirements();
|
2014-11-05 22:35:00 +00:00
|
|
|
m_right->checkTypeRequirements();
|
2014-10-13 16:22:15 +00:00
|
|
|
if (m_right->getType()->isImplicitlyConvertibleTo(*m_left->getType()))
|
|
|
|
m_commonType = m_left->getType();
|
|
|
|
else if (m_left->getType()->isImplicitlyConvertibleTo(*m_right->getType()))
|
|
|
|
m_commonType = m_right->getType();
|
|
|
|
else
|
2014-11-04 14:29:08 +00:00
|
|
|
BOOST_THROW_EXCEPTION(createTypeError("No common type found in binary operation: " +
|
|
|
|
m_left->getType()->toString() + " vs. " +
|
|
|
|
m_right->getType()->toString()));
|
2014-10-16 12:08:54 +00:00
|
|
|
if (Token::isCompareOp(m_operator))
|
2014-10-24 17:06:30 +00:00
|
|
|
m_type = make_shared<BoolType>();
|
2014-10-16 12:08:54 +00:00
|
|
|
else
|
|
|
|
{
|
2014-10-13 16:22:15 +00:00
|
|
|
m_type = m_commonType;
|
2014-10-15 13:54:41 +00:00
|
|
|
if (!m_commonType->acceptsBinaryOperator(m_operator))
|
2014-11-04 14:29:08 +00:00
|
|
|
BOOST_THROW_EXCEPTION(createTypeError("Operator " + string(Token::toString(m_operator)) +
|
|
|
|
" not compatible with type " +
|
|
|
|
m_commonType->toString()));
|
2014-10-13 16:22:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-10-20 12:00:37 +00:00
|
|
|
void FunctionCall::checkTypeRequirements()
|
2014-10-13 16:22:15 +00:00
|
|
|
{
|
|
|
|
m_expression->checkTypeRequirements();
|
2014-10-20 12:00:37 +00:00
|
|
|
for (ASTPointer<Expression> const& argument: m_arguments)
|
2014-10-13 16:22:15 +00:00
|
|
|
argument->checkTypeRequirements();
|
2014-10-20 10:41:56 +00:00
|
|
|
|
|
|
|
Type const* expressionType = m_expression->getType().get();
|
|
|
|
if (isTypeConversion())
|
2014-10-16 12:08:54 +00:00
|
|
|
{
|
2014-11-05 13:20:56 +00:00
|
|
|
TypeType const& type = dynamic_cast<TypeType const&>(*expressionType);
|
2014-10-13 16:22:15 +00:00
|
|
|
//@todo for structs, we have to check the number of arguments to be equal to the
|
|
|
|
// number of non-mapping members
|
|
|
|
if (m_arguments.size() != 1)
|
2014-10-23 17:22:30 +00:00
|
|
|
BOOST_THROW_EXCEPTION(createTypeError("More than one argument for "
|
2014-10-16 15:56:10 +00:00
|
|
|
"explicit type conersion."));
|
2014-11-05 13:20:56 +00:00
|
|
|
if (!m_arguments.front()->getType()->isExplicitlyConvertibleTo(*type.getActualType()))
|
2014-10-23 17:22:30 +00:00
|
|
|
BOOST_THROW_EXCEPTION(createTypeError("Explicit type conversion not allowed."));
|
2014-11-05 13:20:56 +00:00
|
|
|
m_type = type.getActualType();
|
2014-10-16 12:08:54 +00:00
|
|
|
}
|
2014-10-20 10:41:56 +00:00
|
|
|
else
|
2014-10-16 12:08:54 +00:00
|
|
|
{
|
2014-10-13 16:22:15 +00:00
|
|
|
//@todo would be nice to create a struct type from the arguments
|
|
|
|
// and then ask if that is implicitly convertible to the struct represented by the
|
|
|
|
// function parameters
|
2014-11-25 13:43:23 +00:00
|
|
|
FunctionType const& functionType = dynamic_cast<FunctionType const&>(*expressionType);
|
|
|
|
TypePointers const& parameterTypes = functionType.getParameterTypes();
|
|
|
|
if (parameterTypes.size() != m_arguments.size())
|
2014-10-23 17:22:30 +00:00
|
|
|
BOOST_THROW_EXCEPTION(createTypeError("Wrong argument count for function call."));
|
2014-10-16 12:08:54 +00:00
|
|
|
for (size_t i = 0; i < m_arguments.size(); ++i)
|
2014-11-25 13:43:23 +00:00
|
|
|
if (!m_arguments[i]->getType()->isImplicitlyConvertibleTo(*parameterTypes[i]))
|
2014-10-23 17:22:30 +00:00
|
|
|
BOOST_THROW_EXCEPTION(createTypeError("Invalid type for argument in function call."));
|
2014-10-13 16:22:15 +00:00
|
|
|
// @todo actually the return type should be an anonymous struct,
|
|
|
|
// but we change it to the type of the first return value until we have structs
|
2014-11-25 13:43:23 +00:00
|
|
|
if (functionType.getReturnParameterTypes().empty())
|
2014-10-24 17:06:30 +00:00
|
|
|
m_type = make_shared<VoidType>();
|
2014-10-13 16:22:15 +00:00
|
|
|
else
|
2014-11-25 13:43:23 +00:00
|
|
|
m_type = functionType.getReturnParameterTypes().front();
|
2014-10-16 12:08:54 +00:00
|
|
|
}
|
2014-10-20 10:41:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool FunctionCall::isTypeConversion() const
|
|
|
|
{
|
|
|
|
return m_expression->getType()->getCategory() == Type::Category::TYPE;
|
2014-10-13 16:22:15 +00:00
|
|
|
}
|
|
|
|
|
2014-10-20 12:00:37 +00:00
|
|
|
void MemberAccess::checkTypeRequirements()
|
2014-10-13 16:22:15 +00:00
|
|
|
{
|
2014-11-13 00:12:57 +00:00
|
|
|
m_expression->checkTypeRequirements();
|
2014-11-20 09:19:43 +00:00
|
|
|
Type const& type = *m_expression->getType();
|
|
|
|
m_type = type.getMemberType(*m_memberName);
|
|
|
|
if (!m_type)
|
2014-11-13 00:12:57 +00:00
|
|
|
BOOST_THROW_EXCEPTION(createTypeError("Member \"" + *m_memberName + "\" not found in " + type.toString()));
|
2014-12-01 16:32:10 +00:00
|
|
|
//@todo later, this will not always be STORAGE
|
|
|
|
m_lvalue = type.getCategory() == Type::Category::STRUCT ? LValueType::STORAGE : LValueType::NONE;
|
2014-10-13 16:22:15 +00:00
|
|
|
}
|
|
|
|
|
2014-10-20 12:00:37 +00:00
|
|
|
void IndexAccess::checkTypeRequirements()
|
2014-10-13 16:22:15 +00:00
|
|
|
{
|
2014-11-10 16:31:09 +00:00
|
|
|
m_base->checkTypeRequirements();
|
|
|
|
if (m_base->getType()->getCategory() != Type::Category::MAPPING)
|
|
|
|
BOOST_THROW_EXCEPTION(m_base->createTypeError("Indexed expression has to be a mapping (is " +
|
|
|
|
m_base->getType()->toString() + ")"));
|
|
|
|
MappingType const& type = dynamic_cast<MappingType const&>(*m_base->getType());
|
|
|
|
m_index->expectType(*type.getKeyType());
|
|
|
|
m_type = type.getValueType();
|
2014-12-01 16:32:10 +00:00
|
|
|
m_lvalue = LValueType::STORAGE;
|
2014-10-13 16:22:15 +00:00
|
|
|
}
|
|
|
|
|
2014-10-20 12:00:37 +00:00
|
|
|
void Identifier::checkTypeRequirements()
|
2014-10-13 16:22:15 +00:00
|
|
|
{
|
2014-11-05 13:20:56 +00:00
|
|
|
if (asserts(m_referencedDeclaration))
|
|
|
|
BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Identifier not resolved."));
|
|
|
|
|
2014-10-13 16:22:15 +00:00
|
|
|
VariableDeclaration* variable = dynamic_cast<VariableDeclaration*>(m_referencedDeclaration);
|
2014-10-24 14:43:11 +00:00
|
|
|
if (variable)
|
2014-10-16 12:08:54 +00:00
|
|
|
{
|
2014-10-20 12:00:37 +00:00
|
|
|
if (!variable->getType())
|
2014-10-25 14:52:22 +00:00
|
|
|
BOOST_THROW_EXCEPTION(createTypeError("Variable referenced before type could be determined."));
|
2014-10-13 16:22:15 +00:00
|
|
|
m_type = variable->getType();
|
2014-12-01 16:32:10 +00:00
|
|
|
m_lvalue = variable->isLocalVariable() ? LValueType::LOCAL : LValueType::STORAGE;
|
2014-10-20 12:00:37 +00:00
|
|
|
return;
|
2014-10-13 16:22:15 +00:00
|
|
|
}
|
|
|
|
//@todo can we unify these with TypeName::toType()?
|
|
|
|
StructDefinition* structDef = dynamic_cast<StructDefinition*>(m_referencedDeclaration);
|
2014-10-24 14:43:11 +00:00
|
|
|
if (structDef)
|
2014-10-16 12:08:54 +00:00
|
|
|
{
|
2014-10-13 16:22:15 +00:00
|
|
|
// note that we do not have a struct type here
|
2014-10-24 17:06:30 +00:00
|
|
|
m_type = make_shared<TypeType>(make_shared<StructType>(*structDef));
|
2014-10-20 12:00:37 +00:00
|
|
|
return;
|
2014-10-13 16:22:15 +00:00
|
|
|
}
|
|
|
|
FunctionDefinition* functionDef = dynamic_cast<FunctionDefinition*>(m_referencedDeclaration);
|
2014-10-24 14:43:11 +00:00
|
|
|
if (functionDef)
|
2014-10-16 12:08:54 +00:00
|
|
|
{
|
2014-10-13 16:22:15 +00:00
|
|
|
// a function reference is not a TypeType, because calling a TypeType converts to the type.
|
|
|
|
// Calling a function (e.g. function(12), otherContract.function(34)) does not do a type
|
|
|
|
// conversion.
|
2014-10-24 17:06:30 +00:00
|
|
|
m_type = make_shared<FunctionType>(*functionDef);
|
2014-10-20 12:00:37 +00:00
|
|
|
return;
|
2014-10-13 16:22:15 +00:00
|
|
|
}
|
|
|
|
ContractDefinition* contractDef = dynamic_cast<ContractDefinition*>(m_referencedDeclaration);
|
2014-10-24 14:43:11 +00:00
|
|
|
if (contractDef)
|
2014-10-16 12:08:54 +00:00
|
|
|
{
|
2014-10-24 17:06:30 +00:00
|
|
|
m_type = make_shared<TypeType>(make_shared<ContractType>(*contractDef));
|
2014-10-20 12:00:37 +00:00
|
|
|
return;
|
2014-10-13 16:22:15 +00:00
|
|
|
}
|
2014-11-21 18:14:56 +00:00
|
|
|
MagicVariableDeclaration* magicVariable = dynamic_cast<MagicVariableDeclaration*>(m_referencedDeclaration);
|
|
|
|
if (magicVariable)
|
|
|
|
{
|
|
|
|
m_type = magicVariable->getType();
|
|
|
|
return;
|
|
|
|
}
|
2014-11-05 13:20:56 +00:00
|
|
|
BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Declaration reference of unknown/forbidden type."));
|
2014-10-13 16:22:15 +00:00
|
|
|
}
|
|
|
|
|
2014-10-20 12:00:37 +00:00
|
|
|
void ElementaryTypeNameExpression::checkTypeRequirements()
|
2014-10-13 16:22:15 +00:00
|
|
|
{
|
2014-10-24 17:06:30 +00:00
|
|
|
m_type = make_shared<TypeType>(Type::fromElementaryTypeName(m_typeToken));
|
2014-10-13 16:22:15 +00:00
|
|
|
}
|
|
|
|
|
2014-10-20 12:00:37 +00:00
|
|
|
void Literal::checkTypeRequirements()
|
2014-10-13 16:22:15 +00:00
|
|
|
{
|
|
|
|
m_type = Type::forLiteral(*this);
|
2014-11-04 12:24:35 +00:00
|
|
|
if (!m_type)
|
|
|
|
BOOST_THROW_EXCEPTION(createTypeError("Literal value too large."));
|
2014-10-13 16:22:15 +00:00
|
|
|
}
|
|
|
|
|
2014-10-16 12:08:54 +00:00
|
|
|
}
|
|
|
|
}
|