Skip to content

Commit e20c206

Browse files
authored
Merge pull request #15696 from ethereum/fix-yul-cfg-json
Fix subobjects placement in json exporter
2 parents 7e07007 + 9e9c29a commit e20c206

File tree

4 files changed

+3497
-3496
lines changed

4 files changed

+3497
-3496
lines changed

libyul/YulStack.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ Json YulStack::cfgJson() const
409409
subObjectsJson[subObject->name] = exportCFGFromObject(*subObject);
410410
subObjectsJson["type"] = "subObject";
411411
if (!subObject->subObjects.empty())
412-
subObjectsJson["subObjects"] = exportCFGFromSubObjects(subObject->subObjects);
412+
subObjectsJson[subObject->name]["subObjects"] = exportCFGFromSubObjects(subObject->subObjects);
413413
}
414414
return subObjectsJson;
415415
};
@@ -418,7 +418,8 @@ Json YulStack::cfgJson() const
418418
Json jsonObject = Json::object();
419419
jsonObject[object.name] = exportCFGFromObject(object);
420420
jsonObject["type"] = "Object";
421-
jsonObject["subObjects"] = exportCFGFromSubObjects(object.subObjects);
421+
if (!object.subObjects.empty())
422+
jsonObject[object.name]["subObjects"] = exportCFGFromSubObjects(object.subObjects);
422423
return jsonObject;
423424
}
424425

0 commit comments

Comments
 (0)