MCPcopy
hub / github.com/google/go-cmp / PushPair

Method PushPair

cmp/report_references.go:36–53  ·  view source on GitHub ↗
(vx, vy reflect.Value, d diffMode, deref bool)

Source from the content-addressed store, hash-verified

34type pointerReferences [][2]value.Pointer
35
36func (ps *pointerReferences) PushPair(vx, vy reflect.Value, d diffMode, deref bool) (pp [2]value.Pointer) {
37 if deref && vx.IsValid() {
38 vx = vx.Addr()
39 }
40 if deref && vy.IsValid() {
41 vy = vy.Addr()
42 }
43 switch d {
44 case diffUnknown, diffIdentical:
45 pp = [2]value.Pointer{value.PointerOf(vx), value.PointerOf(vy)}
46 case diffRemoved:
47 pp = [2]value.Pointer{value.PointerOf(vx), value.Pointer{}}
48 case diffInserted:
49 pp = [2]value.Pointer{value.Pointer{}, value.PointerOf(vy)}
50 }
51 *ps = append(*ps, pp)
52 return pp
53}
54
55func (ps *pointerReferences) Push(v reflect.Value) (p value.Pointer, seen bool) {
56 p = value.PointerOf(v)

Callers 1

FormatDiffMethod · 0.80

Calls 1

PointerOfFunction · 0.92

Tested by

no test coverage detected