Skip to content

Commit 520098e

Browse files
cameelr0qs
authored andcommitted
fixup! [libevmasm] Add support to import evm assembly json.
1 parent 08e8ee6 commit 520098e

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

libevmasm/Assembly.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ void Assembly::importAssemblyItemsFromJSON(Json::Value const& _code, std::vector
8181
solRequire(_code.isArray(), AssemblyImportException, "Supplied JSON is not an array.");
8282
for (auto current = std::begin(_code); current != std::end(_code); ++current)
8383
{
84-
auto const& item = m_items.emplace_back(createAssemblyItemFromJSON(*current, _sourceList));
84+
AssemblyItem const& item = m_items.emplace_back(createAssemblyItemFromJSON(*current, _sourceList));
8585
if (item == Instruction::JUMPDEST)
8686
solThrow(AssemblyImportException, "JUMPDEST instruction without a tag");
8787
else if (item.type() == AssemblyItemType::Tag)
@@ -97,7 +97,7 @@ AssemblyItem Assembly::createAssemblyItemFromJSON(Json::Value const& _json, std:
9797
{
9898
solRequire(_json.isObject(), AssemblyImportException, "Supplied JSON is not an object.");
9999
static std::set<std::string> const validMembers{"name", "begin", "end", "source", "value", "modifierDepth", "jumpType"};
100-
for (auto const& member: _json.getMemberNames())
100+
for (std::string const& member: _json.getMemberNames())
101101
solRequire(
102102
validMembers.count(member),
103103
AssemblyImportException,
@@ -512,19 +512,19 @@ std::pair<std::shared_ptr<Assembly>, std::vector<std::string>> Assembly::fromJSO
512512
{
513513
solRequire(_json.isObject(), AssemblyImportException, "Supplied JSON is not an object.");
514514
static std::set<std::string> const validMembers{".code", ".data", ".auxdata", "sourceList"};
515-
for (auto const& attribute: _json.getMemberNames())
515+
for (std::string const& attribute: _json.getMemberNames())
516516
solRequire(validMembers.count(attribute), AssemblyImportException, "Unknown attribute '" + attribute + "'.");
517517
solRequire(_json.isMember(".code"), AssemblyImportException, "Member '.code' does not exist.");
518518
solRequire(_json[".code"].isArray(), AssemblyImportException, "Member '.code' is not an array.");
519-
for (auto const& codeItem: _json[".code"])
519+
for (Json::Value const& codeItem: _json[".code"])
520520
solRequire(codeItem.isObject(), AssemblyImportException, "Item of '.code' array is not an object.");
521521

522522
if (_level == 0)
523523
{
524524
if (_json.isMember("sourceList"))
525525
{
526526
solRequire(_json["sourceList"].isArray(), AssemblyImportException, "Optional member 'sourceList' is not an array.");
527-
for (auto const& sourceListItem: _json["sourceList"])
527+
for (Json::Value const& sourceListItem: _json["sourceList"])
528528
solRequire(sourceListItem.isString(), AssemblyImportException, "Item of 'sourceList' array is not of type string.");
529529
}
530530
} else
@@ -539,7 +539,7 @@ std::pair<std::shared_ptr<Assembly>, std::vector<std::string>> Assembly::fromJSO
539539
if (_json.isMember("sourceList"))
540540
{
541541
solAssert(_level == 0);
542-
for (auto const& it: _json["sourceList"])
542+
for (Json::Value const& it: _json["sourceList"])
543543
{
544544
solRequire(
545545
std::find(sourceList.begin(), sourceList.end(), it.asString()) == sourceList.end(),
@@ -602,7 +602,7 @@ std::pair<std::shared_ptr<Assembly>, std::vector<std::string>> Assembly::fromJSO
602602
void Assembly::updatePaths(std::vector<Assembly*> const& _parents, std::vector<size_t> const& _absolutePathFromRoot)
603603
{
604604
size_t subId = 0;
605-
for (auto& assembly: this->m_subs)
605+
for (std::shared_ptr<Assembly> assembly: this->m_subs)
606606
{
607607
std::vector<Assembly*> parents{_parents};
608608
parents.push_back(this);
@@ -611,7 +611,7 @@ void Assembly::updatePaths(std::vector<Assembly*> const& _parents, std::vector<s
611611
absolutePathFromRoot.emplace_back(subId);
612612

613613
int pindex = 0;
614-
for (auto& parent: parents)
614+
for (Assembly* parent: parents)
615615
{
616616
if (pindex == 0)
617617
parent->encodeSubPath(absolutePathFromRoot);

0 commit comments

Comments
 (0)