瀏覽代碼

LibJS: Allow constructing a Handle<T> from a {Nonnull,}GCPtr<T>

Matthew Olsson 2 年之前
父節點
當前提交
1df3652e27
共有 1 個文件被更改,包括 10 次插入0 次删除
  1. 10 0
      Userland/Libraries/LibJS/Heap/Handle.h

+ 10 - 0
Userland/Libraries/LibJS/Heap/Handle.h

@@ -60,6 +60,16 @@ public:
     {
     {
     }
     }
 
 
+    Handle(GCPtr<T> cell)
+        : Handle(cell.ptr())
+    {
+    }
+
+    Handle(NonnullGCPtr<T> cell)
+        : Handle(*cell)
+    {
+    }
+
     T* cell() const
     T* cell() const
     {
     {
         if (!m_impl)
         if (!m_impl)