Skip to content

Commit ee60806

Browse files
committed
fixup! [libevmasm] Add support to import evm assembly json.
1 parent 1040070 commit ee60806

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

libevmasm/Assembly.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -510,25 +510,25 @@ Json::Value Assembly::assemblyJSON(std::map<std::string, unsigned> const& _sourc
510510

511511
std::pair<std::shared_ptr<Assembly>, std::vector<std::string>> Assembly::fromJSON(Json::Value const& _json, std::vector<std::string> const& _sourceList, size_t _level)
512512
{
513-
std::shared_ptr<Assembly> result = std::make_shared<Assembly>(langutil::EVMVersion(), _level == 0, "");
513+
auto result = std::make_shared<Assembly>(langutil::EVMVersion(), _level == 0, "");
514514
if (_json.isNull())
515515
return std::make_pair(result, std::vector<std::string>());
516516

517517
solRequire(_json.isObject(), AssemblyImportException, "Supplied JSON is not an object.");
518518
static std::set<std::string> const validMembers{".code", ".data", ".auxdata", "sourceList"};
519-
for (auto const& attribute: _json.getMemberNames())
519+
for (std::string const& attribute: _json.getMemberNames())
520520
solRequire(validMembers.count(attribute), AssemblyImportException, "Unknown attribute '" + attribute + "'.");
521521
solRequire(_json.isMember(".code"), AssemblyImportException, "Member '.code' does not exist.");
522522
solRequire(_json[".code"].isArray(), AssemblyImportException, "Member '.code' is not an array.");
523-
for (auto const& codeItem: _json[".code"])
523+
for (Json::Value const& codeItem: _json[".code"])
524524
solRequire(codeItem.isObject(), AssemblyImportException, "Item of '.code' array is not an object.");
525525

526526
if (_level == 0)
527527
{
528528
if (_json.isMember("sourceList"))
529529
{
530530
solRequire(_json["sourceList"].isArray(), AssemblyImportException, "Optional member 'sourceList' is not an array.");
531-
for (auto const& sourceListItem: _json["sourceList"])
531+
for (Json::Value const& sourceListItem: _json["sourceList"])
532532
solRequire(sourceListItem.isString(), AssemblyImportException, "Item of 'sourceList' array is not of type string.");
533533
}
534534
} else
@@ -542,7 +542,7 @@ std::pair<std::shared_ptr<Assembly>, std::vector<std::string>> Assembly::fromJSO
542542
if (_json.isMember("sourceList"))
543543
{
544544
solAssert(_level == 0);
545-
for (auto const& it: _json["sourceList"])
545+
for (Json::Value const& it: _json["sourceList"])
546546
{
547547
solRequire(
548548
std::find(sourceList.begin(), sourceList.end(), it.asString()) == sourceList.end(),
@@ -605,7 +605,7 @@ std::pair<std::shared_ptr<Assembly>, std::vector<std::string>> Assembly::fromJSO
605605
void Assembly::updatePaths(std::vector<Assembly*> const& _parents, std::vector<size_t> const& _absolutePathFromRoot)
606606
{
607607
size_t subId = 0;
608-
for (auto& assembly: this->m_subs)
608+
for (std::shared_ptr<Assembly> assembly: this->m_subs)
609609
{
610610
std::vector<Assembly*> parents{_parents};
611611
parents.push_back(this);
@@ -614,7 +614,7 @@ void Assembly::updatePaths(std::vector<Assembly*> const& _parents, std::vector<s
614614
absolutePathFromRoot.emplace_back(subId);
615615

616616
int pindex = 0;
617-
for (auto& parent: parents)
617+
for (Assembly* parent: parents)
618618
{
619619
if (pindex == 0)
620620
parent->encodeSubPath(absolutePathFromRoot);

0 commit comments

Comments
 (0)