]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile/internal/types: eliminate FieldName
authorMatthew Dempsky <mdempsky@google.com>
Sat, 22 Apr 2017 01:11:15 +0000 (18:11 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Sat, 22 Apr 2017 01:36:17 +0000 (01:36 +0000)
This functionality can be implemented in package types without a
trampoline back to gc.

Change-Id: Iaff7169fece35482e654553bf16b07dc67d1991a
Reviewed-on: https://go-review.googlesource.com/41416
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/compile/internal/gc/main.go
src/cmd/compile/internal/types/type.go
src/cmd/compile/internal/types/utils.go

index 6d7afa28691a671a07d61fa28ad169a7f86ed654..ec6665f75c3a9f2853c0dbee42baa3044531e177 100644 (file)
@@ -386,9 +386,6 @@ func Main(archInit func(*Arch)) {
        types.FormatType = func(t *types.Type, s fmt.State, verb rune, mode int) {
                typeFormat(t, s, verb, fmtMode(mode))
        }
-       types.FieldName = func(f *types.Field) string {
-               return f.Sym.Name
-       }
        types.TypeLinkSym = func(t *types.Type) *obj.LSym {
                return typenamesym(t).Linksym()
        }
index b1903f22ec6de6476058c0f304701ffb8f749d55..11ea551b91cce8b7d80ff3b5916f52a0e34c4219 100644 (file)
@@ -1221,7 +1221,7 @@ func (t *Type) FieldOff(i int) int64 {
        return t.Field(i).Offset
 }
 func (t *Type) FieldName(i int) string {
-       return FieldName(t.Field(i))
+       return t.Field(i).Sym.Name
 }
 
 func (t *Type) NumElem() int64 {
index 9d00adf97978545adb408485aa4ef86296a54228..5fb40210656d3b4275b70e5b09444793e3208964 100644 (file)
@@ -25,7 +25,6 @@ var (
        Tconv       func(*Type, int, int, int) string // orig: func tconv(t *Type, flag FmtFlag, mode fmtMode, depth int) string
        FormatSym   func(*Sym, fmt.State, rune, int)  // orig: func symFormat(sym *Sym, s fmt.State, verb rune, mode fmtMode)
        FormatType  func(*Type, fmt.State, rune, int) // orig: func typeFormat(t *Type, s fmt.State, verb rune, mode fmtMode)
-       FieldName   func(*Field) string
        TypeLinkSym func(*Type) *obj.LSym
        Ctxt        *obj.Link