LibJS: Add a convenience helper for visiting a JS::Value

We only really care to visit values if they refer to a Cell, but it's
nice to be able to say visit(some_value).
This commit is contained in:
Andreas Kling 2020-03-09 22:14:51 +01:00
parent 05c80cac20
commit 386867da9f
Notes: sideshowbarker 2024-07-19 08:47:44 +09:00
3 changed files with 12 additions and 4 deletions

View file

@ -51,10 +51,8 @@ void Object::put(String property_name, Value value)
void Object::visit_children(Cell::Visitor& visitor)
{
Cell::visit_children(visitor);
for (auto& it : m_properties) {
if (it.value.is_object())
visitor.visit(it.value.as_object());
}
for (auto& it : m_properties)
visitor.visit(it.value);
}
}