diff --git a/internal/lib/fmt/print.go b/internal/lib/fmt/print.go index d3368b85..88786f0a 100644 --- a/internal/lib/fmt/print.go +++ b/internal/lib/fmt/print.go @@ -777,13 +777,10 @@ func (p *pp) printArg(arg any, verb rune) { func (p *pp) printValue(value reflect.Value, verb rune, depth int) { // Handle values with special methods if not already handled by printArg (depth == 0). if depth > 0 && value.IsValid() && value.CanInterface() { - /* TODO(xsw): p.arg = value.Interface() if p.handleMethods(verb) { return } - */ - panic("todo: fmt.(*pp).printValue - handleMethods") } p.arg = nil p.value = value diff --git a/internal/lib/internal/reflectlite/type.go b/internal/lib/internal/reflectlite/type.go index e1670162..8e06a915 100644 --- a/internal/lib/internal/reflectlite/type.go +++ b/internal/lib/internal/reflectlite/type.go @@ -157,7 +157,7 @@ func (t rtype) NumMethod() int { } return len(t.exportedMethods()) */ - panic("todo") + panic("todo: reflectlite.rtype.NumMethod") } func (t rtype) PkgPath() string { @@ -171,7 +171,7 @@ func (t rtype) PkgPath() string { } return t.nameOff(ut.PkgPath).Name() */ - panic("todo") + panic("todo: reflectlite.rtype.PkgPath") } func (t rtype) Name() string { @@ -193,7 +193,7 @@ func (t rtype) Name() string { } return s[i+1:] */ - panic("todo") + panic("todo: reflectlite.rtype.Name") } func toRType(t *abi.Type) rtype { @@ -220,7 +220,7 @@ func (t rtype) In(i int) Type { } return toType(tt.InSlice()[i]) */ - panic("todo") + panic("todo: reflectlite.rtype.In") } func (t rtype) Key() Type { @@ -255,7 +255,7 @@ func (t rtype) NumIn() int { } return int(tt.InCount) */ - panic("todo") + panic("todo: reflectlite.rtype.NumIn") } func (t rtype) NumOut() int { @@ -266,7 +266,7 @@ func (t rtype) NumOut() int { } return tt.NumOut() */ - panic("todo") + panic("todo: reflectlite.rtype.NumOut") } func (t rtype) Out(i int) Type { @@ -277,7 +277,7 @@ func (t rtype) Out(i int) Type { } return toType(tt.OutSlice()[i]) */ - panic("todo") + panic("todo: reflectlite.rtype.Out") } // add returns p+x. @@ -408,7 +408,7 @@ func implements(T, V *abi.Type) bool { } return false */ - panic("todo") + panic("todo: reflectlite.implements") } // directlyAssignable reports whether a value x of type V can be directly @@ -544,7 +544,7 @@ func haveIdenticalUnderlyingType(T, V *abi.Type, cmpTags bool) bool { return false */ - panic("todo") + panic("todo: reflectlite.haveIdenticalUnderlyingType") } // toType converts from a *rtype to a Type that can be returned diff --git a/internal/lib/internal/reflectlite/value.go b/internal/lib/internal/reflectlite/value.go index d986048a..9bbd5e47 100644 --- a/internal/lib/internal/reflectlite/value.go +++ b/internal/lib/internal/reflectlite/value.go @@ -98,7 +98,7 @@ func (v Value) pointer() unsafe.Pointer { } return v.ptr */ - panic("todo") + panic("todo: reflectlite.Value.pointer") } // packEface converts v to the empty interface. @@ -263,7 +263,7 @@ func (v Value) Elem() Value { } panic(&ValueError{"reflectlite.Value.Elem", v.kind()}) */ - panic("todo") + panic("todo: reflectlite.Value.Elem") } func valueInterface(v Value) any { @@ -367,7 +367,7 @@ func (v Value) numMethod() int { } return v.typ.NumMethod() */ - panic("todo") + panic("todo: reflectlite.Value.numMethod") } // Set assigns x to the value v. @@ -455,7 +455,7 @@ func (v Value) assignTo(context string, dst *abi.Type, target unsafe.Pointer) Va // Failed. // TODO(xsw): // panic(context + ": value of type " + toRType(v.typ).String() + " is not assignable to type " + toRType(dst).String()) - panic("todo") + panic("todo: reflectlite.Value.assignTo") } // arrayAt returns the i-th element of p, diff --git a/internal/lib/os/file.go b/internal/lib/os/file.go index a522f7f3..a48f759b 100644 --- a/internal/lib/os/file.go +++ b/internal/lib/os/file.go @@ -87,7 +87,7 @@ func (f *File) ReadAt(b []byte, off int64) (n int, err error) { } return */ - panic("todo") + panic("todo: os.File.ReadAt") } // ReadFrom implements io.ReaderFrom. @@ -102,7 +102,7 @@ func (f *File) ReadFrom(r io.Reader) (n int64, err error) { } return n, f.wrapErr("write", e) */ - panic("todo") + panic("todo: os.File.ReadFrom") } func genericReadFrom(f *File, r io.Reader) (int64, error) { diff --git a/internal/lib/reflect/makefunc.go b/internal/lib/reflect/makefunc.go index 2a0e6208..cdc48840 100644 --- a/internal/lib/reflect/makefunc.go +++ b/internal/lib/reflect/makefunc.go @@ -146,7 +146,7 @@ func makeMethodValue(op string, v Value) Value { return Value{ftyp.Common(), unsafe.Pointer(fv), v.flag&flagRO | flag(Func)} */ - panic("todo") + panic("todo: reflect.makeMethodValue") } /* diff --git a/internal/lib/reflect/type.go b/internal/lib/reflect/type.go index 8dfce54a..68b3c93b 100644 --- a/internal/lib/reflect/type.go +++ b/internal/lib/reflect/type.go @@ -461,7 +461,7 @@ func (t *rtype) NumMethod() int { } return len(t.exportedMethods()) */ - panic("todo") + panic("todo: reflect.rtype.NumMethod") } func (t *rtype) Method(i int) (m Method) { @@ -498,7 +498,7 @@ func (t *rtype) Method(i int) (m Method) { m.Index = i return m */ - panic("todo") + panic("todo: reflect.rtype.Method") } func (t *rtype) MethodByName(name string) (m Method, ok bool) { @@ -533,7 +533,7 @@ func (t *rtype) MethodByName(name string) (m Method, ok bool) { return Method{}, false */ - panic("todo") + panic("todo: reflect.rtype.MethodByName") } func (t *rtype) PkgPath() string { @@ -570,7 +570,7 @@ func (t *rtype) Name() string { } return s[i+1:] */ - panic("todo") + panic("todo: reflect.rtype.Name") } func nameFor(t *abi.Type) string { @@ -596,7 +596,7 @@ func elem(t *abi.Type) *abi.Type { } // TODO(xsw): // panic("reflect: Elem of invalid type " + stringFor(t)) - panic("todo") + panic("todo: reflect.elem") } func (t *rtype) Elem() Type { @@ -611,7 +611,7 @@ func (t *rtype) Field(i int) StructField { tt := (*structType)(unsafe.Pointer(t)) return tt.Field(i) */ - panic("todo") + panic("todo: reflect.rtype.Field") } func (t *rtype) FieldByIndex(index []int) StructField { @@ -622,7 +622,7 @@ func (t *rtype) FieldByIndex(index []int) StructField { tt := (*structType)(unsafe.Pointer(t)) return tt.FieldByIndex(index) */ - panic("todo") + panic("todo: reflect.rtype.FieldByIndex") } func (t *rtype) FieldByName(name string) (StructField, bool) { @@ -633,7 +633,7 @@ func (t *rtype) FieldByName(name string) (StructField, bool) { tt := (*structType)(unsafe.Pointer(t)) return tt.FieldByName(name) */ - panic("todo") + panic("todo: reflect.rtype.FieldByName") } func (t *rtype) FieldByNameFunc(match func(string) bool) (StructField, bool) { @@ -644,7 +644,7 @@ func (t *rtype) FieldByNameFunc(match func(string) bool) (StructField, bool) { tt := (*structType)(unsafe.Pointer(t)) return tt.FieldByNameFunc(match) */ - panic("todo") + panic("todo: reflect.rtype.FieldByNameFunc") } func (t *rtype) Key() Type { @@ -679,7 +679,7 @@ func (t *rtype) In(i int) Type { tt := (*abi.FuncType)(unsafe.Pointer(t)) return toType(tt.InSlice()[i]) */ - panic("todo") + panic("todo: reflect.rtype.In") } func (t *rtype) NumIn() int { @@ -690,7 +690,7 @@ func (t *rtype) NumIn() int { tt := (*abi.FuncType)(unsafe.Pointer(t)) return tt.NumIn() */ - panic("todo") + panic("todo: reflect.rtype.NumIn") } func (t *rtype) NumOut() int { @@ -701,7 +701,7 @@ func (t *rtype) NumOut() int { tt := (*abi.FuncType)(unsafe.Pointer(t)) return tt.NumOut() */ - panic("todo") + panic("todo: reflect.rtype.NumOut") } func (t *rtype) Out(i int) Type { @@ -712,7 +712,7 @@ func (t *rtype) Out(i int) Type { tt := (*abi.FuncType)(unsafe.Pointer(t)) return toType(tt.OutSlice()[i]) */ - panic("todo") + panic("todo: reflect.rtype.Out") } func (t *rtype) IsVariadic() bool { @@ -723,7 +723,7 @@ func (t *rtype) IsVariadic() bool { tt := (*abi.FuncType)(unsafe.Pointer(t)) return tt.IsVariadic() */ - panic("todo") + panic("todo: reflect.rtype.IsVariadic") } // add returns p+x. @@ -916,7 +916,7 @@ func (t *rtype) ptrTo() *abi.Type { pi, _ := ptrMap.LoadOrStore(t, &pp) return &pi.(*ptrType).Type */ - panic("todo") + panic("todo: reflect.rtype.ptrTo") } func ptrTo(t *abi.Type) *abi.Type { @@ -942,7 +942,7 @@ func (t *rtype) Implements(u Type) bool { } return implements(u.common(), t.common()) */ - panic("todo") + panic("todo: reflect.rtype.Implements") } func (t *rtype) AssignableTo(u Type) bool { @@ -953,7 +953,7 @@ func (t *rtype) AssignableTo(u Type) bool { uu := u.common() return directlyAssignable(uu, t.common()) || implements(uu, t.common()) */ - panic("todo") + panic("todo: reflect.rtype.AssignableTo") } func (t *rtype) ConvertibleTo(u Type) bool { @@ -963,7 +963,7 @@ func (t *rtype) ConvertibleTo(u Type) bool { } return convertOp(u.common(), t.common()) != nil */ - panic("todo") + panic("todo: reflect.rtype.ConvertibleTo") } func (t *rtype) Comparable() bool { @@ -1055,7 +1055,7 @@ func implements(T, V *abi.Type) bool { } return false */ - panic("todo") + panic("todo: reflect.implements") } // specialChannelAssignability reports whether a value x of channel type V @@ -1070,7 +1070,7 @@ func specialChannelAssignability(T, V *abi.Type) bool { // and at least one of V or T is not a defined type. return V.ChanDir() == abi.BothDir && (nameFor(T) == "" || nameFor(V) == "") && haveIdenticalType(T.Elem(), V.Elem(), true) */ - panic("todo") + panic("todo: reflect.specialChannelAssignability") } // directlyAssignable reports whether a value x of type V can be directly @@ -1202,7 +1202,7 @@ func haveIdenticalUnderlyingType(T, V *abi.Type, cmpTags bool) bool { return false */ - panic("todo") + panic("todo: reflect.haveIdenticalUnderlyingType") } // SliceOf returns the slice type with element type t. diff --git a/internal/lib/reflect/value.go b/internal/lib/reflect/value.go index 205cf5c3..7e5f8c60 100644 --- a/internal/lib/reflect/value.go +++ b/internal/lib/reflect/value.go @@ -128,7 +128,7 @@ func (v Value) pointer() unsafe.Pointer { } return v.ptr */ - panic("todo") + panic("todo: reflect.Value.pointer") } // packEface converts v to the empty interface. @@ -355,7 +355,7 @@ func (v Value) bytesSlow() []byte { } panic(&ValueError{"reflect.Value.Bytes", v.kind()}) */ - panic("todo") + panic("todo: reflect.Value.byteSlow") } // runes returns v's underlying value. @@ -776,7 +776,7 @@ func valueInterface(v Value, safe bool) any { // TODO: pass safe to packEface so we don't need to copy if safe==true? return packEface(v) */ - panic("todo") + panic("todo: reflect.valueInterface") } // InterfaceData returns a pair of unspecified uintptr values. @@ -800,7 +800,7 @@ func (v Value) InterfaceData() [2]uintptr { // Interface value is always bigger than a word; assume flagIndir. return *(*[2]uintptr)(v.ptr) */ - panic("todo") + panic("todo: reflect.Value.InterfaceData") } // IsNil reports whether its argument v is nil. The argument must be @@ -901,7 +901,7 @@ func (v Value) IsZero() bool { panic(&ValueError{"reflect.Value.IsZero", v.Kind()}) } */ - panic("todo") + panic("todo: reflect.Value.IsZero") } // SetZero sets v to be the zero value of v's type. @@ -958,7 +958,7 @@ func (v Value) SetZero() { panic(&ValueError{"reflect.Value.SetZero", v.Kind()}) } */ - panic("todo") + panic("todo: reflect.Value.SetZero") } // Kind returns v's Kind. @@ -998,7 +998,7 @@ func (v Value) lenNonSlice() int { } panic(&ValueError{"reflect.Value.Len", v.kind()}) */ - panic("todo") + panic("todo: reflect.Value.lenNonSlice") } // Pointer returns v's value as a uintptr. @@ -1772,7 +1772,7 @@ func AppendSlice(s, t Value) Value { Copy(s.Slice(ns, ns+nt), t) return s */ - panic("todo") + panic("todo: reflect.AppendSlice") } // Zero returns a Value representing the zero value for the specified type. @@ -1819,7 +1819,7 @@ func New(typ Type) Value { fl := flag(Pointer) return Value{pt, ptr, fl} */ - panic("todo") + panic("todo: reflect.New") } // NewAt returns a Value representing a pointer to a value of the @@ -1872,7 +1872,7 @@ func (v Value) assignTo(context string, dst *abi.Type, target unsafe.Pointer) Va // Failed. // TODO(xsw): // panic(context + ": value of type " + stringFor(v.typ()) + " is not assignable to type " + stringFor(dst)) - panic("todo") + panic("todo: reflect.Value.assignTo") } // memmove copies size bytes to dst from src. No write barriers are used.