Update ExpressionCompiler.cpp

This commit is contained in:
RJ 2016-01-10 21:49:36 -06:00
parent 72a641fe9f
commit c78b9c5737

View File

@ -186,6 +186,7 @@ bool ExpressionCompiler::visit(Assignment const& _assignment)
_assignment.leftHandSide().annotation().type _assignment.leftHandSide().annotation().type
); );
utils().convertType(*_assignment.rightHandSide().annotation().type, *type); utils().convertType(*_assignment.rightHandSide().annotation().type, *type);
_assignment.leftHandSide().accept(*this); _assignment.leftHandSide().accept(*this);
solAssert(!!m_currentLValue, "LValue not retrieved."); solAssert(!!m_currentLValue, "LValue not retrieved.");
@ -219,23 +220,24 @@ bool ExpressionCompiler::visit(Assignment const& _assignment)
bool ExpressionCompiler::visit(TupleExpression const& _tuple) bool ExpressionCompiler::visit(TupleExpression const& _tuple)
{ {
if (_tuple.isInlineArray()) if (_tuple.isInlineArray())
{ {
ArrayType const& arrayType = dynamic_cast<ArrayType const&>(*_tuple.annotation().type); ArrayType const& arrayType = dynamic_cast<ArrayType const&>(*_tuple.annotation().type);
auto components = _tuple.components(); auto components = _tuple.components();
m_context << max(u256(32u), arrayType.memorySize()); m_context << max(u256(32u), arrayType.memorySize());
utils().allocateMemory(); utils().allocateMemory();
m_context << eth::Instruction::DUP1; m_context << eth::Instruction::DUP1;
for (unsigned i = 0; i < components.size(); ++i) for (unsigned i = 0; i < components.size(); ++i)
{ {
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);
components[i]->annotation().type = arrayType.baseType(); //force conversion components[i]->annotation().type = arrayType.baseType(); //force conversion
utils().storeInMemoryDynamic(*components[i]->annotation().type, true); utils().storeInMemoryDynamic(*components[i]->annotation().type, true);
} }
m_context << eth::Instruction::POP;
} m_context << eth::Instruction::POP;
}
else else
{ {
vector<unique_ptr<LValue>> lvalues; vector<unique_ptr<LValue>> lvalues;