in reify.go [542:587]
func reifySliceMerge(
opts fieldOptions,
old reflect.Value,
tTo reflect.Type,
val value,
) (reflect.Value, Error) {
arr, err := castArr(opts.opts, val)
if err != nil {
return reflect.Value{}, err
}
arrMergeCfg := opts.configHandling()
l := len(arr)
start := 0
cpyStart := 0
withOld := old.IsValid() && !old.IsNil()
if withOld {
ol := old.Len()
switch arrMergeCfg {
case cfgReplaceValue:
// do nothing
case cfgArrAppend:
l += ol
start = ol
case cfgArrPrepend:
cpyStart = l
l += ol
default:
if l < ol {
l = ol
}
}
}
tmp := reflect.MakeSlice(tTo, l, l)
if withOld {
reflect.Copy(tmp.Slice(cpyStart, tmp.Len()), old)
}
return reifyDoArray(opts, tmp, tTo.Elem(), start, val, arr)
}