This commit is contained in:
Alexander Arlt 2022-08-16 17:44:52 +02:00
parent 65d09e7995
commit e57c137558
3 changed files with 9 additions and 9 deletions

View File

@ -79,7 +79,7 @@ void Assembly::addAssemblyItemsFromJSON(Json::Value const& _code)
solAssert(m_items.empty(), ""); solAssert(m_items.empty(), "");
solAssert(_code.isArray(), ""); solAssert(_code.isArray(), "");
for (auto const& jsonItem: _code) for (auto const& jsonItem: _code)
m_items.emplace_back(loadItemFromJSON(jsonItem)); m_items.emplace_back(createAssemblyItemFromJSON(jsonItem));
for (auto current = m_items.begin(); current != m_items.end(); ++current) for (auto current = m_items.begin(); current != m_items.end(); ++current)
{ {
@ -96,7 +96,7 @@ void Assembly::addAssemblyItemsFromJSON(Json::Value const& _code)
} }
} }
AssemblyItem Assembly::loadItemFromJSON(Json::Value const& _json) AssemblyItem Assembly::createAssemblyItemFromJSON(Json::Value const& _json)
{ {
std::string name = _json["name"].isString() ? _json["name"].asString() : ""; std::string name = _json["name"].isString() ? _json["name"].asString() : "";
int begin = _json["begin"].isInt() ? _json["begin"].asInt() : -1; int begin = _json["begin"].isInt() ? _json["begin"].asInt() : -1;

View File

@ -168,20 +168,20 @@ public:
bool isCreation() const { return m_creation; } bool isCreation() const { return m_creation; }
/// Set the source list. /// Set the source name list.
void setSources(std::vector<std::shared_ptr<std::string const>> _sources) void setSources(std::vector<std::shared_ptr<std::string const>> _sources)
{ {
m_sources = std::move(_sources); m_sources = std::move(_sources);
} }
/// Set the source list from simple vector<string>. /// Set the source name list from simple vector<string>.
void setSources(std::vector<std::string> const& _sources) void setSources(std::vector<std::string> const& _sources)
{ {
for (auto const& item: _sources) for (auto const& item: _sources)
m_sources.emplace_back(std::make_shared<std::string>(item)); m_sources.emplace_back(std::make_shared<std::string>(item));
} }
/// @returns List of sources. /// @returns List of source names.
std::vector<std::shared_ptr<std::string const>> sources() const& { return m_sources; } std::vector<std::shared_ptr<std::string const>> sources() const& { return m_sources; }
protected: protected:
@ -197,8 +197,8 @@ protected:
/// Creates an AssemblyItem from a given JSON representation. /// Creates an AssemblyItem from a given JSON representation.
/// @param _json JSON representation of an assembly item /// @param _json JSON representation of an assembly item
/// @returns AssemblyItem from a given JSON representation. /// @returns AssemblyItem of _json argument.
AssemblyItem loadItemFromJSON(Json::Value const& _json); AssemblyItem createAssemblyItemFromJSON(Json::Value const& _json);
private: private:
bool m_invalid = false; bool m_invalid = false;

View File

@ -423,7 +423,7 @@ void CompilerStack::importEvmAssemblyJson(std::map<std::string, Json::Value> con
if (m_stackState != Empty) if (m_stackState != Empty)
solThrow(CompilerError, "Must call importEvmAssemblyJson only before the SourcesSet state."); solThrow(CompilerError, "Must call importEvmAssemblyJson only before the SourcesSet state.");
Json::Value const& jsonValue = _sources.begin()->second; Json::Value jsonValue = _sources.begin()->second;
if (jsonValue.isMember("sourceList")) if (jsonValue.isMember("sourceList"))
for (auto const& item: jsonValue["sourceList"]) for (auto const& item: jsonValue["sourceList"])
{ {
@ -432,7 +432,7 @@ void CompilerStack::importEvmAssemblyJson(std::map<std::string, Json::Value> con
m_sources.emplace(std::make_pair(item.asString(), source)); m_sources.emplace(std::make_pair(item.asString(), source));
m_sourceOrder.push_back(&m_sources[item.asString()]); m_sourceOrder.push_back(&m_sources[item.asString()]);
} }
m_evmAssemblyJson[_sources.begin()->first] = jsonValue; m_evmAssemblyJson[_sources.begin()->first] = std::move(jsonValue);
m_importedSources = true; m_importedSources = true;
m_stackState = SourcesSet; m_stackState = SourcesSet;
} }