Remove m_code from IRValue

Only one place to append to m_code avoids confusion and bugs
This commit is contained in:
Mathias Baumann
2019-05-14 11:15:04 +02:00
committed by chriseth
parent 1d75770700
commit f5980f08cc
3 changed files with 16 additions and 27 deletions
@@ -131,7 +131,7 @@ bool IRGeneratorForStatements::visit(Assignment const& _assignment)
_assignment.leftHandSide().accept(*this);
solAssert(!!m_currentLValue, "LValue not retrieved.");
m_currentLValue->storeValue(intermediateValue, *intermediateType);
m_code << m_currentLValue->storeValue(intermediateValue, *intermediateType);
m_currentLValue.reset();
defineExpression(_assignment) << intermediateValue << "\n";
@@ -672,7 +672,6 @@ void IRGeneratorForStatements::endVisit(IndexAccess const& _indexAccess)
templ("key", ", " + m_context.variable(*_indexAccess.indexExpression()));
m_code << templ.render();
setLValue(_indexAccess, make_unique<IRStorageItem>(
m_code,
m_context,
slot,
0,
@@ -728,9 +727,9 @@ void IRGeneratorForStatements::endVisit(Identifier const& _identifier)
solUnimplementedAssert(!varDecl->isConstant(), "");
unique_ptr<IRLValue> lvalue;
if (m_context.isLocalVariable(*varDecl))
lvalue = make_unique<IRLocalVariable>(m_code, m_context, *varDecl);
lvalue = make_unique<IRLocalVariable>(m_context, *varDecl);
else if (m_context.isStateVariable(*varDecl))
lvalue = make_unique<IRStorageItem>(m_code, m_context, *varDecl);
lvalue = make_unique<IRStorageItem>(m_context, *varDecl);
else
solAssert(false, "Invalid variable kind.");