mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 23:37:36 +00:00
LibJS: Add Visitor::visit(GCPtr<T>) and Visitor::visit(NonnullGCPtr<T>)
Let's avoid reaching for ptr() as much as possible.
This commit is contained in:
parent
d3b7c06712
commit
0585029c30
2 changed files with 13 additions and 1 deletions
|
@ -11,6 +11,7 @@
|
|||
#include <AK/Noncopyable.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <LibJS/Forward.h>
|
||||
#include <LibJS/Heap/GCPtr.h>
|
||||
|
||||
namespace JS {
|
||||
|
||||
|
@ -55,6 +56,17 @@ public:
|
|||
{
|
||||
visit_impl(cell);
|
||||
}
|
||||
template<typename T>
|
||||
void visit(GCPtr<T> cell)
|
||||
{
|
||||
if (cell)
|
||||
visit_impl(*cell.ptr());
|
||||
}
|
||||
template<typename T>
|
||||
void visit(NonnullGCPtr<T> cell)
|
||||
{
|
||||
visit_impl(*cell.ptr());
|
||||
}
|
||||
void visit(Value);
|
||||
|
||||
protected:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue