Might as well sort them while they're still in a slice.
Change-Id: I40c25ddc5c054dcb4da2aeefa79947967609d599
Reviewed-on: https://go-review.googlesource.com/20591
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
import (
"cmd/internal/obj"
"fmt"
+ "sort"
"strings"
)
fields = append(fields, f)
}
}
+ sort.Sort(methcmp(fields))
t.SetFields(fields)
for f, it := IterFields(t); f != nil && !t.Broke; f = it.Next() {
}
checkdupfields("method", t)
- t = sortinter(t)
checkwidth(t)
return t
return false
}
-func sortinter(t *Type) *Type {
- s := t.FieldSlice()
- sort.Sort(methcmp(s))
- t.SetFields(s)
- return t
-}
-
func Nodintconst(v int64) *Node {
c := Nod(OLITERAL, nil, nil)
c.Addable = true