Improve exception information in Yul function datasize(name) and dataoffset(name).

Makes sure we properly throw a detailed exception instead of an out_of_range from std::map.
This commit is contained in:
Christian Parpart 2019-03-19 17:08:38 +01:00
parent c7824932a4
commit 7f7f44dd63

View File

@ -56,7 +56,10 @@ EVMDialect::EVMDialect(AsmFlavour _flavour, bool _objectAccess, langutil::EVMVer
if (m_currentObject->name == dataName)
_assembly.appendAssemblySize();
else
{
yulAssert(m_subIDs.count(dataName) != 0, "Could not find assembly object <" + dataName.str() + ">.");
_assembly.appendDataSize(m_subIDs.at(dataName));
}
});
addFunction("dataoffset", 1, 1, true, true, [this](
FunctionCall const& _call,
@ -70,7 +73,10 @@ EVMDialect::EVMDialect(AsmFlavour _flavour, bool _objectAccess, langutil::EVMVer
if (m_currentObject->name == dataName)
_assembly.appendConstant(0);
else
{
yulAssert(m_subIDs.count(dataName) != 0, "Could not find assembly object <" + dataName.str() + ">.");
_assembly.appendDataOffset(m_subIDs.at(dataName));
}
});
addFunction("datacopy", 3, 0, false, false, [](
FunctionCall const&,