MCPcopy Create free account
hub / github.com/argotorg/solidity / summarizeStructure

Method summarizeStructure

libyul/Object.cpp:128–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

126}
127
128Object::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
172std::vector<evmasm::SubAssemblyID> Object::pathToSubObject(std::string_view _qualifiedName) const
173{

Callers 5

CompilabilityCheckerMethod · 0.80
analyzeParsedMethod · 0.80
runMethod · 0.80
runMethod · 0.80

Calls 5

containsFunction · 0.85
insertMethod · 0.80
emptyMethod · 0.45
containsMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected