[libsolidity] srcmap sourceList handling corrections.

This commit is contained in:
Alexander Arlt 2021-11-09 18:02:51 -05:00
parent 8608bc3b8c
commit c822263646
2 changed files with 7 additions and 10 deletions

View File

@ -523,14 +523,6 @@ bool Assembly::loadFromAssemblyJSON(Json::Value const& _json)
if (!_json[".code"].isArray())
return false;
bool result{true};
if (_json.isMember("sourceList"))
{
vector<string> sourceList;
for (auto const& it: _json["sourceList"])
sourceList.emplace_back(it.asString());
this->setSources(sourceList);
}
addAssemblyItemsFromJSON(_json[".code"]);
if (_json[".auxdata"].isString())
this->m_auxiliaryData = fromHex(_json[".auxdata"].asString());

View File

@ -398,7 +398,6 @@ void CompilerStack::importEvmAssemblyJson(map<string, Json::Value> const& _sourc
Json::Value jsonValue = _sources.begin()->second;
if (jsonValue.isMember("sourceList"))
{
for (auto const& item: jsonValue["sourceList"])
{
Source source;
@ -406,7 +405,6 @@ void CompilerStack::importEvmAssemblyJson(map<string, Json::Value> const& _sourc
m_sources.emplace(std::make_pair(item.asString(), source));
m_sourceOrder.push_back(&m_sources[item.asString()]);
}
}
m_evmAssemblyJson[_sources.begin()->first] = jsonValue;
m_importedSources = true;
m_stackState = SourcesSet;
@ -687,12 +685,19 @@ bool CompilerStack::compile(State _stopAfter)
optimiserSettings.runJumpdestRemover = m_optimiserSettings.runJumpdestRemover;
optimiserSettings.runPeephole = m_optimiserSettings.runPeephole;
vector<string> sourceList;
if (m_evmAssemblyJson[evmAssemblyJsonSource].isMember("sourceList"))
for (auto const& it: m_evmAssemblyJson[evmAssemblyJsonSource]["sourceList"])
sourceList.emplace_back(it.asString());
m_contracts[evmAssemblyJsonSource].evmAssembly = make_shared<evmasm::Assembly>(evmAssemblyJsonSource);
m_contracts[evmAssemblyJsonSource].evmAssembly->setSources(sourceList);
m_contracts[evmAssemblyJsonSource].evmAssembly->loadFromAssemblyJSON(m_evmAssemblyJson[evmAssemblyJsonSource]);
m_contracts[evmAssemblyJsonSource].evmAssembly->optimise(optimiserSettings);
m_contracts[evmAssemblyJsonSource].object = m_contracts[evmAssemblyJsonSource].evmAssembly->assemble();
m_contracts[evmAssemblyJsonSource].evmRuntimeAssembly = make_shared<evmasm::Assembly>(evmAssemblyJsonSource);
m_contracts[evmAssemblyJsonSource].evmRuntimeAssembly->setSources(sourceList);
m_contracts[evmAssemblyJsonSource].evmRuntimeAssembly->loadFromAssemblyJSON(m_evmAssemblyJson[evmAssemblyJsonSource][".data"]["0"]);
m_contracts[evmAssemblyJsonSource].evmRuntimeAssembly->optimise(optimiserSettings);
m_contracts[evmAssemblyJsonSource].runtimeObject = m_contracts[evmAssemblyJsonSource].evmRuntimeAssembly->assemble();