Explorar o código

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 %!s(int64=2) %!d(string=hai) anos
pai
achega
5f0ccfb499
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  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)
         void visit(GCPtr<T> cell)
         {
         {
             if (cell)
             if (cell)
-                visit_impl(*cell.ptr());
+                visit_impl(const_cast<RemoveConst<T>&>(*cell.ptr()));
         }
         }
 
 
         template<typename T>
         template<typename T>
         void visit(NonnullGCPtr<T> cell)
         void visit(NonnullGCPtr<T> cell)
         {
         {
-            visit_impl(*cell.ptr());
+            visit_impl(const_cast<RemoveConst<T>&>(*cell.ptr()));
         }
         }
 
 
         void visit(Value value)
         void visit(Value value)