func valuedump(s, t string) {
typ := reflect.ParseTypeString("", s);
- v := reflect.NewInitValue(typ);
+ v := reflect.NewZeroValue(typ);
if v == nil {
panicln("valuedump", s);
}
t = reflect.ParseTypeString("", "[]int32");
v := reflect.NewSliceValue(t.(ArrayType), 5, 10);
t1 := reflect.ParseTypeString("", "*[]int32");
- v1 := reflect.NewInitValue(t1);
+ v1 := reflect.NewZeroValue(t1);
if v1 == nil { panic("V1 is nil"); }
v1.(reflect.PtrValue).SetSub(v);
a := v1.Interface().(*[]int32);
doNil := []string{"*int", "interface{}", "map[string]int", "func() bool", "chan int", "[]string"};
for i, ts := range doNotNil {
ty := reflect.ParseTypeString("", ts);
- v := reflect.NewInitValue(ty);
+ v := reflect.NewZeroValue(ty);
if nilable, ok := v.(Nillable); ok {
t.Errorf("%s is nilable; should not be", ts)
}
for i, ts := range doNil {
ty := reflect.ParseTypeString("", ts);
- v := reflect.NewInitValue(ty);
+ v := reflect.NewZeroValue(ty);
if nilable, ok := v.(Nillable); !ok {
t.Errorf("%s is not nilable; should be", ts)
}
return c(typ, addr);
}
-// NewInitValue creates a new, zero-initialized Value for the specified Type.
-func NewInitValue(typ Type) Value {
+// NewZeroValue creates a new, zero-initialized Value for the specified Type.
+func NewZeroValue(typ Type) Value {
// Some values cannot be made this way.
switch typ.Kind() {
case ArrayKind: