@@ -138,10 +138,6 @@ type Scope interface {
138
138
// parameters, you'll run out of stack space before anything useful happens.
139
139
Convert (src , dest interface {}, flags FieldMatchingFlags ) error
140
140
141
- // DefaultConvert performs the default conversion, without calling a conversion func
142
- // on the current stack frame. This makes it safe to call from a conversion func.
143
- DefaultConvert (src , dest interface {}, flags FieldMatchingFlags ) error
144
-
145
141
// SrcTags and DestTags contain the struct tags that src and dest had, respectively.
146
142
// If the enclosing object was not a struct, then these will contain no tags, of course.
147
143
SrcTag () reflect.StructTag
@@ -274,12 +270,6 @@ func (s *scope) Convert(src, dest interface{}, flags FieldMatchingFlags) error {
274
270
return s .converter .Convert (src , dest , flags , s .meta )
275
271
}
276
272
277
- // DefaultConvert continues a conversion, performing a default conversion (no conversion func)
278
- // for the current stack frame.
279
- func (s * scope ) DefaultConvert (src , dest interface {}, flags FieldMatchingFlags ) error {
280
- return s .converter .DefaultConvert (src , dest , flags , s .meta )
281
- }
282
-
283
273
// SrcTag returns the tag of the struct containing the current source item, if any.
284
274
func (s * scope ) SrcTag () reflect.StructTag {
285
275
return s .srcStack .top ().tag
@@ -432,18 +422,6 @@ func (c *Converter) Convert(src, dest interface{}, flags FieldMatchingFlags, met
432
422
return c .doConversion (src , dest , flags , meta , c .convert )
433
423
}
434
424
435
- // DefaultConvert will translate src to dest if it knows how. Both must be pointers.
436
- // No conversion func is used. If the default copying mechanism
437
- // doesn't work on this type pair, an error will be returned.
438
- // Read the comments on the various FieldMatchingFlags constants to understand
439
- // what the 'flags' parameter does.
440
- // 'meta' is given to allow you to pass information to conversion functions,
441
- // it is not used by DefaultConvert() other than storing it in the scope.
442
- // Not safe for objects with cyclic references!
443
- func (c * Converter ) DefaultConvert (src , dest interface {}, flags FieldMatchingFlags , meta * Meta ) error {
444
- return c .doConversion (src , dest , flags , meta , c .defaultConvert )
445
- }
446
-
447
425
type conversionFunc func (sv , dv reflect.Value , scope * scope ) error
448
426
449
427
func (c * Converter ) doConversion (src , dest interface {}, flags FieldMatchingFlags , meta * Meta , f conversionFunc ) error {
@@ -523,14 +501,6 @@ func (c *Converter) convert(sv, dv reflect.Value, scope *scope) error {
523
501
return c .callUntyped (sv , dv , f , scope )
524
502
}
525
503
526
- return c .defaultConvert (sv , dv , scope )
527
- }
528
-
529
- // defaultConvert recursively copies sv into dv. no conversion function is called
530
- // for the current stack frame (but conversion functions may be called for nested objects)
531
- func (c * Converter ) defaultConvert (sv , dv reflect.Value , scope * scope ) error {
532
- dt , st := dv .Type (), sv .Type ()
533
-
534
504
if ! dv .CanSet () {
535
505
return scope .errorf ("Cannot set dest. (Tried to deep copy something with unexported fields?)" )
536
506
}
0 commit comments