Apply suggestions

This commit is contained in:
r0qs 2023-09-22 14:17:09 +02:00
parent 1ec239c63f
commit 84d3af4a29
No known key found for this signature in database
GPG Key ID: 61503DBA6667276C
2 changed files with 7 additions and 9 deletions

View File

@ -149,7 +149,7 @@ std::set<YulString> Object::qualifiedDataNames() const
return qualifiedNames; return qualifiedNames;
} }
void Object::visitPath(YulString _qualifiedName, std::function<bool(Object const*)> _visitor) const void Object::visitPath(YulString _qualifiedName, std::function<bool(Object const*)> const& _visitor) const
{ {
yulAssert(!_qualifiedName.empty(), ""); yulAssert(!_qualifiedName.empty(), "");
@ -184,7 +184,7 @@ std::vector<size_t> Object::pathToSubObject(YulString _qualifiedName) const
this->visitPath(_qualifiedName, [&](Object const* _object) -> bool { this->visitPath(_qualifiedName, [&](Object const* _object) -> bool {
yulAssert(_object->subId != std::numeric_limits<size_t>::max(), ""); yulAssert(_object->subId != std::numeric_limits<size_t>::max(), "");
path.push_back({_object->subId}); path.push_back(_object->subId);
return false; return false;
}); });
return path; return path;
@ -205,12 +205,10 @@ Object const* Object::subObjectAt(std::string const& _qualifiedName)
Object const* foundObject = nullptr; Object const* foundObject = nullptr;
this->visitPath(YulString(_qualifiedName), [&](Object const* _subObject) -> bool { this->visitPath(YulString(_qualifiedName), [&](Object const* _subObject) -> bool {
if (targetObjectName == _subObject->name.str()) if (targetObjectName != _subObject->name.str())
{ return false;
foundObject = _subObject; foundObject = _subObject;
return true; return true;
}
return false;
}); });
return foundObject; return foundObject;

View File

@ -127,7 +127,7 @@ public:
/// it continues until the last subobject in the path is reached. /// it continues until the last subobject in the path is reached.
void visitPath( void visitPath(
YulString _qualifiedName, YulString _qualifiedName,
std::function<bool(Object const*)> _visitor std::function<bool(Object const*)> const& _visitor
) const; ) const;
Object const* at(YulString _name) const; Object const* at(YulString _name) const;