mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Pass YulString instead of std::string to Object::subObjectAt
This commit is contained in:
parent
84d3af4a29
commit
b5d4e1d685
@ -190,7 +190,7 @@ std::vector<size_t> Object::pathToSubObject(YulString _qualifiedName) const
|
||||
return path;
|
||||
}
|
||||
|
||||
Object const* Object::subObjectAt(std::string const& _qualifiedName)
|
||||
Object const* Object::subObjectAt(YulString _qualifiedName)
|
||||
{
|
||||
if (_qualifiedName.empty())
|
||||
return nullptr;
|
||||
@ -198,14 +198,14 @@ Object const* Object::subObjectAt(std::string const& _qualifiedName)
|
||||
// If there is no `.` in the given `_qualifiedName`, the target
|
||||
// object name is considered to be the `_qualifiedName`, otherwise,
|
||||
// the target object name is the last element in the path given by `_qualifiedName`.
|
||||
std::string targetObjectName = _qualifiedName;
|
||||
size_t targetObjectPos = _qualifiedName.find_last_of(".");
|
||||
YulString targetObjectName = _qualifiedName;
|
||||
size_t targetObjectPos = _qualifiedName.str().find_last_of(".");
|
||||
if (targetObjectPos != std::string::npos)
|
||||
targetObjectName = _qualifiedName.substr(targetObjectPos + 1);
|
||||
targetObjectName = YulString(_qualifiedName.str().substr(targetObjectPos + 1));
|
||||
|
||||
Object const* foundObject = nullptr;
|
||||
this->visitPath(YulString(_qualifiedName), [&](Object const* _subObject) -> bool {
|
||||
if (targetObjectName != _subObject->name.str())
|
||||
this->visitPath(_qualifiedName, [&](Object const* _subObject) -> bool {
|
||||
if (targetObjectName != _subObject->name)
|
||||
return false;
|
||||
foundObject = _subObject;
|
||||
return true;
|
||||
|
@ -119,7 +119,7 @@ public:
|
||||
|
||||
/// Searches for a subobject at @param _qualifiedName within the current object.
|
||||
/// @returns a pointer to the subobject or a nullptr if it was not found.
|
||||
Object const* subObjectAt(std::string const& _qualifiedName);
|
||||
Object const* subObjectAt(YulString _qualifiedName);
|
||||
|
||||
/// Visits all subobjects in the path given by the @a _qualifiedName
|
||||
/// of the current object applying the function @a _visitor.
|
||||
|
@ -253,7 +253,7 @@ public:
|
||||
{
|
||||
if (!m_inputIsCodeBlock)
|
||||
{
|
||||
Object const* subObject = m_object->subObjectAt(_objectPath);
|
||||
Object const* subObject = m_object->subObjectAt(YulString(_objectPath));
|
||||
|
||||
if (subObject == nullptr)
|
||||
solThrow(Exception, "Assembly object not found.");
|
||||
|
Loading…
Reference in New Issue
Block a user