From e242e655696164283ef4911eab21f581f736c1ca Mon Sep 17 00:00:00 2001 From: visualfc Date: Wed, 13 Nov 2024 21:42:43 +0800 Subject: [PATCH] internal/lib/reflect: Value.SetLen Value.SetCap --- internal/lib/reflect/value.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/internal/lib/reflect/value.go b/internal/lib/reflect/value.go index d2fcd09c..b626b2b2 100644 --- a/internal/lib/reflect/value.go +++ b/internal/lib/reflect/value.go @@ -1228,32 +1228,26 @@ func (v Value) SetInt(x int64) { // It panics if v's Kind is not Slice or if n is negative or // greater than the capacity of the slice. func (v Value) SetLen(n int) { - /* TODO(xsw): v.mustBeAssignable() v.mustBe(Slice) - s := (*unsafeheader.Slice)(v.ptr) + s := (*unsafeheaderSlice)(v.ptr) if uint(n) > uint(s.Cap) { panic("reflect: slice length out of range in SetLen") } s.Len = n - */ - panic("todo: reflect.Value.SetLen") } // SetCap sets v's capacity to n. // It panics if v's Kind is not Slice or if n is smaller than the length or // greater than the capacity of the slice. func (v Value) SetCap(n int) { - /* TODO(xsw): v.mustBeAssignable() v.mustBe(Slice) - s := (*unsafeheader.Slice)(v.ptr) + s := (*unsafeheaderSlice)(v.ptr) if n < s.Len || n > s.Cap { panic("reflect: slice capacity out of range in SetCap") } s.Cap = n - */ - panic("todo: reflect.Value.SetCap") } // SetMapIndex sets the element associated with key in the map v to elem.