فهرست منبع

LibJS: Accept const GCPtrs in Cell::Visitor

The const_cast in these methods should be fine since the object really
only needs to be mutable so it's Heap-internal metadata can be altered.
Matthew Olsson 2 سال پیش
والد
کامیت
5f0ccfb499
1فایلهای تغییر یافته به همراه2 افزوده شده و 2 حذف شده
  1. 2 2
      Userland/Libraries/LibJS/Heap/Cell.h

+ 2 - 2
Userland/Libraries/LibJS/Heap/Cell.h

@@ -65,13 +65,13 @@ public:
         void visit(GCPtr<T> cell)
         {
             if (cell)
-                visit_impl(*cell.ptr());
+                visit_impl(const_cast<RemoveConst<T>&>(*cell.ptr()));
         }
 
         template<typename T>
         void visit(NonnullGCPtr<T> cell)
         {
-            visit_impl(*cell.ptr());
+            visit_impl(const_cast<RemoveConst<T>&>(*cell.ptr()));
         }
 
         void visit(Value value)