[Sol->Yul] Check lvalue kind is stack in case of calldata.

This commit is contained in:
Djordje Mijovic 2021-02-08 13:27:51 +01:00
parent 706f5d9874
commit e53feaedc4

View File

@ -2918,7 +2918,11 @@ void IRGeneratorForStatements::setLValue(Expression const& _expression, IRLValue
solAssert(!m_currentLValue, "");
if (_expression.annotation().willBeWrittenTo)
{
m_currentLValue.emplace(std::move(_lvalue));
if (_lvalue.type.dataStoredIn(DataLocation::CallData))
solAssert(holds_alternative<IRLValue::Stack>(_lvalue.kind), "");
}
else
// Only define the expression, if it will not be written to.
define(_expression, readFromLValue(_lvalue));