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

Method pathToSubObject

libyul/Object.cpp:172–201  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

170}
171
172std::vector<evmasm::SubAssemblyID> Object::pathToSubObject(std::string_view _qualifiedName) const
173{
174 yulAssert(_qualifiedName != name, "");
175 yulAssert(subIndexByName.count(name) == 0, "");
176
177 if (boost::algorithm::starts_with(_qualifiedName, name + "."))
178 _qualifiedName = _qualifiedName.substr(name.length() + 1);
179 yulAssert(!_qualifiedName.empty(), "");
180
181 std::vector<std::string> subObjectPathComponents;
182 boost::algorithm::split(subObjectPathComponents, _qualifiedName, boost::is_any_of("."));
183
184 std::vector<evmasm::SubAssemblyID> path;
185 Object const* object = this;
186 for (std::string const& currentSubObjectName: subObjectPathComponents)
187 {
188 yulAssert(!currentSubObjectName.empty(), "");
189 auto subIndexIt = object->subIndexByName.find(currentSubObjectName);
190 yulAssert(
191 subIndexIt != object->subIndexByName.end(),
192 "Assembly object <" + std::string(_qualifiedName) + "> not found or does not contain code."
193 );
194 object = dynamic_cast<Object const*>(object->subObjects[subIndexIt->second].get());
195 yulAssert(object, "Assembly object <" + std::string(_qualifiedName) + "> not found or does not contain code.");
196 yulAssert(!object->subId.empty());
197 path.emplace_back(object->subId);
198 }
199
200 return path;
201}
202
203std::shared_ptr<AST const> Object::code() const
204{

Callers 2

datasizeBuiltinFunction · 0.80
dataoffsetBuiltinFunction · 0.80

Calls 6

countMethod · 0.45
lengthMethod · 0.45
emptyMethod · 0.45
findMethod · 0.45
endMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected