MCPcopy Create free account
hub / github.com/decomp/decomp / killPos

Function killPos

cmd/go-post/fix.go:740–762  ·  view source on GitHub ↗
(v reflect.Value)

Source from the content-addressed store, hash-verified

738var posType = reflect.TypeOf(token.Pos(0))
739
740func killPos(v reflect.Value) {
741 switch v.Kind() {
742 case reflect.Ptr, reflect.Interface:
743 if !v.IsNil() {
744 killPos(v.Elem())
745 }
746 case reflect.Slice:
747 n := v.Len()
748 for i := 0; i < n; i++ {
749 killPos(v.Index(i))
750 }
751 case reflect.Struct:
752 n := v.NumField()
753 for i := 0; i < n; i++ {
754 f := v.Field(i)
755 if f.Type() == posType {
756 f.SetInt(0)
757 continue
758 }
759 killPos(f)
760 }
761 }
762}
763
764// A Rename describes a single renaming.
765type rename struct {

Callers 1

exprFunction · 0.85

Calls 1

LenMethod · 0.45

Tested by

no test coverage detected