Skip to content

Commit e90de7d

Browse files
cameelr0qs
authored andcommitted
fixup! [libevmasm] Add support to import evm assembly json.
1 parent 74129b3 commit e90de7d

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

libevmasm/Assembly.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -516,11 +516,6 @@ std::pair<std::shared_ptr<Assembly>, std::vector<std::string>> Assembly::fromJSO
516516
for (std::string const& attribute: _json.getMemberNames())
517517
solRequire(validMembers.count(attribute), AssemblyImportException, "Unknown attribute '" + attribute + "'.");
518518

519-
solRequire(_json.isMember(".code"), AssemblyImportException, "Member '.code' is missing.");
520-
solRequire(_json[".code"].isArray(), AssemblyImportException, "Member '.code' is not an array.");
521-
for (Json::Value const& codeItem: _json[".code"])
522-
solRequire(codeItem.isObject(), AssemblyImportException, "The '.code' array contains an item that is not an object.");
523-
524519
if (_level == 0)
525520
{
526521
if (_json.isMember("sourceList"))
@@ -556,7 +551,13 @@ std::pair<std::shared_ptr<Assembly>, std::vector<std::string>> Assembly::fromJSO
556551
else
557552
sourceList = _sourceList;
558553

554+
solRequire(_json.isMember(".code"), AssemblyImportException, "Member '.code' is missing.");
555+
solRequire(_json[".code"].isArray(), AssemblyImportException, "Member '.code' is not an array.");
556+
for (Json::Value const& codeItem: _json[".code"])
557+
solRequire(codeItem.isObject(), AssemblyImportException, "The '.code' array contains an item that is not an object.");
558+
559559
result->importAssemblyItemsFromJSON(_json[".code"], sourceList);
560+
560561
if (_json[".auxdata"])
561562
{
562563
solRequire(_json[".auxdata"].isString(), AssemblyImportException, "Optional member '.auxdata' is not a string.");

0 commit comments

Comments
 (0)