Update ExpressionCompiler.cpp

This commit is contained in:
RJ 2016-01-10 21:37:47 -06:00
parent 5a3b40f802
commit 72a641fe9f

View File

@ -231,9 +231,7 @@ bool ExpressionCompiler::visit(TupleExpression const& _tuple)
{ {
components[i]->accept(*this); components[i]->accept(*this);
utils().convertType(*components[i]->annotation().type, *arrayType.baseType(), true); utils().convertType(*components[i]->annotation().type, *arrayType.baseType(), true);
cout << components[i]->annotation().type->toString(true) << endl;
components[i]->annotation().type = arrayType.baseType(); //force conversion components[i]->annotation().type = arrayType.baseType(); //force conversion
cout << components[i]->annotation().type->toString(true) << endl;
utils().storeInMemoryDynamic(*components[i]->annotation().type, true); utils().storeInMemoryDynamic(*components[i]->annotation().type, true);
} }
m_context << eth::Instruction::POP; m_context << eth::Instruction::POP;
@ -796,7 +794,6 @@ bool ExpressionCompiler::visit(NewExpression const&)
void ExpressionCompiler::endVisit(MemberAccess const& _memberAccess) void ExpressionCompiler::endVisit(MemberAccess const& _memberAccess)
{ {
CompilerContext::LocationSetter locationSetter(m_context, _memberAccess); CompilerContext::LocationSetter locationSetter(m_context, _memberAccess);
// Check whether the member is a bound function. // Check whether the member is a bound function.
ASTString const& member = _memberAccess.memberName(); ASTString const& member = _memberAccess.memberName();
if (auto funType = dynamic_cast<FunctionType const*>(_memberAccess.annotation().type.get())) if (auto funType = dynamic_cast<FunctionType const*>(_memberAccess.annotation().type.get()))
@ -1145,6 +1142,7 @@ void ExpressionCompiler::endVisit(Literal const& _literal)
{ {
CompilerContext::LocationSetter locationSetter(m_context, _literal); CompilerContext::LocationSetter locationSetter(m_context, _literal);
TypePointer type = _literal.annotation().type; TypePointer type = _literal.annotation().type;
switch (type->category()) switch (type->category())
{ {
case Type::Category::IntegerConstant: case Type::Category::IntegerConstant:
@ -1155,7 +1153,7 @@ void ExpressionCompiler::endVisit(Literal const& _literal)
break; // will be done during conversion break; // will be done during conversion
default: default:
BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Only integer, boolean and string literals implemented for now.")); BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Only integer, boolean and string literals implemented for now."));
} }
} }
void ExpressionCompiler::appendAndOrOperatorCode(BinaryOperation const& _binaryOperation) void ExpressionCompiler::appendAndOrOperatorCode(BinaryOperation const& _binaryOperation)