mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Update ExpressionCompiler.cpp
This commit is contained in:
parent
df9dfa8fef
commit
e18eaa4615
@ -186,7 +186,6 @@ 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.");
|
||||||
|
|
||||||
@ -218,6 +217,28 @@ bool ExpressionCompiler::visit(Assignment const& _assignment)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool ExpressionCompiler::visit(TupleExpression const& _tuple)
|
bool ExpressionCompiler::visit(TupleExpression const& _tuple)
|
||||||
|
{
|
||||||
|
if (_tuple.isInlineArray())
|
||||||
|
{
|
||||||
|
ArrayType const& arrayType = dynamic_cast<ArrayType const&>(*_tuple.annotation().type);
|
||||||
|
auto components = _tuple.components();
|
||||||
|
|
||||||
|
m_context << max(u256(32u), arrayType.memorySize());
|
||||||
|
utils().allocateMemory();
|
||||||
|
m_context << eth::Instruction::DUP1;
|
||||||
|
|
||||||
|
for (unsigned i = 0; i < components.size(); ++i)
|
||||||
|
{
|
||||||
|
components[i]->accept(*this);
|
||||||
|
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
|
||||||
|
cout << components[i]->annotation().type->toString(true) << endl;
|
||||||
|
utils().storeInMemoryDynamic(*components[i]->annotation().type, true);
|
||||||
|
}
|
||||||
|
m_context << eth::Instruction::POP;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
vector<unique_ptr<LValue>> lvalues;
|
vector<unique_ptr<LValue>> lvalues;
|
||||||
for (auto const& component: _tuple.components())
|
for (auto const& component: _tuple.components())
|
||||||
@ -239,6 +260,7 @@ bool ExpressionCompiler::visit(TupleExpression const& _tuple)
|
|||||||
else
|
else
|
||||||
m_currentLValue.reset(new TupleObject(m_context, move(lvalues)));
|
m_currentLValue.reset(new TupleObject(m_context, move(lvalues)));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user