Skip to content

Commit f808b53

Browse files
committed
fixup! [libevmasm] Add support to import evm assembly json.
1 parent 4359e33 commit f808b53

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
@@ -520,11 +520,6 @@ std::pair<std::shared_ptr<Assembly>, std::vector<std::string>> Assembly::fromJSO
520520
for (std::string const& attribute: _json.getMemberNames())
521521
solRequire(validMembers.count(attribute), AssemblyImportException, "Unknown attribute '" + attribute + "'.");
522522

523-
solRequire(_json.isMember(".code"), AssemblyImportException, "Member '.code' is missing.");
524-
solRequire(_json[".code"].isArray(), AssemblyImportException, "Member '.code' is not an array.");
525-
for (Json::Value const& codeItem: _json[".code"])
526-
solRequire(codeItem.isObject(), AssemblyImportException, "The '.code' array contains an item that is not an object.");
527-
528523
if (_level == 0)
529524
{
530525
if (_json.isMember("sourceList"))
@@ -559,7 +554,13 @@ std::pair<std::shared_ptr<Assembly>, std::vector<std::string>> Assembly::fromJSO
559554
else
560555
sourceList = _sourceList;
561556

557+
solRequire(_json.isMember(".code"), AssemblyImportException, "Member '.code' is missing.");
558+
solRequire(_json[".code"].isArray(), AssemblyImportException, "Member '.code' is not an array.");
559+
for (Json::Value const& codeItem: _json[".code"])
560+
solRequire(codeItem.isObject(), AssemblyImportException, "The '.code' array contains an item that is not an object.");
561+
562562
result->importAssemblyItemsFromJSON(_json[".code"], sourceList);
563+
563564
if (_json[".auxdata"])
564565
{
565566
solRequire(_json[".auxdata"].isString(), AssemblyImportException, "Optional member '.auxdata' is not a string.");

0 commit comments

Comments
 (0)