| 126 | } |
| 127 | |
| 128 | Object::Structure Object::summarizeStructure() const |
| 129 | { |
| 130 | Structure structure; |
| 131 | |
| 132 | structure.objectPaths = |
| 133 | name.empty() || util::contains(name, '.') ? |
| 134 | std::set<std::string>{} : |
| 135 | std::set<std::string>{name}; |
| 136 | |
| 137 | structure.objectName = name; |
| 138 | |
| 139 | for (std::shared_ptr<ObjectNode> const& subObjectNode: subObjects) |
| 140 | { |
| 141 | yulAssert(!structure.contains(subObjectNode->name)); |
| 142 | if (util::contains(subObjectNode->name, '.')) |
| 143 | continue; |
| 144 | |
| 145 | if (auto const* subObject = dynamic_cast<Object const*>(subObjectNode.get())) |
| 146 | { |
| 147 | structure.objectPaths.insert(subObjectNode->name); |
| 148 | |
| 149 | auto const subObjectStructure = subObject->summarizeStructure(); |
| 150 | |
| 151 | for (auto const& subSubObj: subObjectStructure.objectPaths) |
| 152 | if (subObject->name != subSubObj) |
| 153 | { |
| 154 | yulAssert(!structure.contains(subObject->name + "." + subSubObj)); |
| 155 | structure.objectPaths.insert(subObject->name + "." + subSubObj); |
| 156 | } |
| 157 | for (auto const& subSubObjData: subObjectStructure.dataPaths) |
| 158 | if (subObject->name != subSubObjData) |
| 159 | { |
| 160 | yulAssert(!structure.contains(subObject->name + "." + subSubObjData)); |
| 161 | structure.dataPaths.insert(subObject->name + "." + subSubObjData); |
| 162 | } |
| 163 | } |
| 164 | else |
| 165 | structure.dataPaths.insert(subObjectNode->name); |
| 166 | } |
| 167 | |
| 168 | yulAssert(!structure.contains("")); |
| 169 | return structure; |
| 170 | } |
| 171 | |
| 172 | std::vector<evmasm::SubAssemblyID> Object::pathToSubObject(std::string_view _qualifiedName) const |
| 173 | { |
no test coverage detected