pointer based map sorting
This commit is contained in:
parent
fd0a780a76
commit
e27cfd9354
@ -24,7 +24,7 @@ const (
|
|||||||
skipTypes
|
skipTypes
|
||||||
allTypes
|
allTypes
|
||||||
randomMaps
|
randomMaps
|
||||||
pointerValues
|
_pointerValues // used only internally
|
||||||
)
|
)
|
||||||
|
|
||||||
type wrapLen struct {
|
type wrapLen struct {
|
||||||
|
10
reflect.go
10
reflect.go
@ -144,7 +144,7 @@ func reflectMap(o opts, p *pending, r reflect.Value) node {
|
|||||||
sn := make(map[string]node)
|
sn := make(map[string]node)
|
||||||
for _, key := range r.MapKeys() {
|
for _, key := range r.MapKeys() {
|
||||||
kn := reflectValue(itemOpts, p, key)
|
kn := reflectValue(itemOpts, p, key)
|
||||||
knExt := reflectValue(allTypes|pointerValues, p, key)
|
knExt := reflectValue(itemOpts|_pointerValues, p, key)
|
||||||
var b bytes.Buffer
|
var b bytes.Buffer
|
||||||
wr := writer{w: &b}
|
wr := writer{w: &b}
|
||||||
fprint(&wr, 0, knExt)
|
fprint(&wr, 0, knExt)
|
||||||
@ -180,17 +180,17 @@ func reflectPointer(o opts, p *pending, r reflect.Value) node {
|
|||||||
}
|
}
|
||||||
|
|
||||||
e := reflectValue(o, p, r.Elem())
|
e := reflectValue(o, p, r.Elem())
|
||||||
|
if o & _pointerValues != 0 {
|
||||||
|
e = nodeOf(e, "_", r.Pointer())
|
||||||
|
}
|
||||||
|
|
||||||
if _, t, _ := withType(o); !t {
|
if _, t, _ := withType(o); !t {
|
||||||
return e
|
return e
|
||||||
}
|
}
|
||||||
|
|
||||||
if o&pointerValues == 0 {
|
|
||||||
return nodeOf("*", e)
|
return nodeOf("*", e)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nodeOf("*(", r.Pointer(), ")", e)
|
|
||||||
}
|
|
||||||
|
|
||||||
func reflectList(o opts, p *pending, r reflect.Value) node {
|
func reflectList(o opts, p *pending, r reflect.Value) node {
|
||||||
if r.IsNil() {
|
if r.IsNil() {
|
||||||
return reflectNil(o, true, r)
|
return reflectNil(o, true, r)
|
||||||
|
Loading…
Reference in New Issue
Block a user