LibJS: Add make_handle({Nonnull,}GCPtr<T>) overloads

This commit is contained in:
Linus Groh 2022-12-14 18:37:37 +00:00 committed by Tim Flynn
commit 2a66fc6cae
Notes: sideshowbarker 2024-07-17 06:09:44 +09:00
5 changed files with 18 additions and 4 deletions

View file

@ -121,6 +121,20 @@ inline Handle<T> make_handle(T& cell)
return Handle<T>::create(&cell);
}
template<class T>
inline Handle<T> make_handle(GCPtr<T> cell)
{
if (!cell)
return Handle<T> {};
return Handle<T>::create(cell.ptr());
}
template<class T>
inline Handle<T> make_handle(NonnullGCPtr<T> cell)
{
return Handle<T>::create(cell.ptr());
}
template<>
class Handle<Value> {
public: