1
0
mirror of https://github.com/golang/go synced 2024-11-23 15:40:06 -07:00

cmd/compile/internal/gc: convert fields of Symlink to bool

Convert two fields of struct Symlink in subr.go from uint8 to bool.

This change passes go build -toolexec 'toolstash -cmp' -a std.

Change-Id: I913006f41605b17b0d82fe358ee773f6ecaa681c
Reviewed-on: https://go-review.googlesource.com/14378
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Marvin Stenger 2015-09-08 20:29:10 +02:00 committed by Brad Fitzpatrick
parent d862753ccc
commit a20fbe8e18

View File

@ -2163,17 +2163,17 @@ func adddot(n *Node) *Node {
*/ */
type Symlink struct { type Symlink struct {
field *Type field *Type
good uint8
followptr uint8
link *Symlink link *Symlink
good bool
followptr bool
} }
var slist *Symlink var slist *Symlink
func expand0(t *Type, followptr int) { func expand0(t *Type, followptr bool) {
u := t u := t
if Isptr[u.Etype] { if Isptr[u.Etype] {
followptr = 1 followptr = true
u = u.Type u = u.Type
} }
@ -2187,7 +2187,7 @@ func expand0(t *Type, followptr int) {
sl = new(Symlink) sl = new(Symlink)
sl.field = f sl.field = f
sl.link = slist sl.link = slist
sl.followptr = uint8(followptr) sl.followptr = followptr
slist = sl slist = sl
} }
@ -2205,13 +2205,13 @@ func expand0(t *Type, followptr int) {
sl = new(Symlink) sl = new(Symlink)
sl.field = f sl.field = f
sl.link = slist sl.link = slist
sl.followptr = uint8(followptr) sl.followptr = followptr
slist = sl slist = sl
} }
} }
} }
func expand1(t *Type, d int, followptr int) { func expand1(t *Type, d int, followptr bool) {
if t.Trecur != 0 { if t.Trecur != 0 {
return return
} }
@ -2226,7 +2226,7 @@ func expand1(t *Type, d int, followptr int) {
u := t u := t
if Isptr[u.Etype] { if Isptr[u.Etype] {
followptr = 1 followptr = true
u = u.Type u = u.Type
} }
@ -2263,7 +2263,7 @@ func expandmeth(t *Type) {
// generate all reachable methods // generate all reachable methods
slist = nil slist = nil
expand1(t, len(dotlist)-1, 0) expand1(t, len(dotlist)-1, false)
// check each method to be uniquely reachable // check each method to be uniquely reachable
var c int var c int
@ -2278,7 +2278,7 @@ func expandmeth(t *Type) {
if c == 1 { if c == 1 {
// addot1 may have dug out arbitrary fields, we only want methods. // addot1 may have dug out arbitrary fields, we only want methods.
if f.Type.Etype == TFUNC && f.Type.Thistuple > 0 { if f.Type.Etype == TFUNC && f.Type.Thistuple > 0 {
sl.good = 1 sl.good = true
sl.field = f sl.field = f
} }
} }
@ -2293,13 +2293,13 @@ func expandmeth(t *Type) {
t.Xmethod = t.Method t.Xmethod = t.Method
for sl := slist; sl != nil; sl = sl.link { for sl := slist; sl != nil; sl = sl.link {
if sl.good != 0 { if sl.good {
// add it to the base type method list // add it to the base type method list
f = typ(TFIELD) f = typ(TFIELD)
*f = *sl.field *f = *sl.field
f.Embedded = 1 // needs a trampoline f.Embedded = 1 // needs a trampoline
if sl.followptr != 0 { if sl.followptr {
f.Embedded = 2 f.Embedded = 2
} }
f.Down = t.Xmethod f.Down = t.Xmethod
@ -2968,8 +2968,8 @@ func geneq(sym *Sym, t *Type) {
safemode = old_safemode safemode = old_safemode
} }
func ifacelookdot(s *Sym, t *Type, followptr *int, ignorecase int) *Type { func ifacelookdot(s *Sym, t *Type, followptr *bool, ignorecase int) *Type {
*followptr = 0 *followptr = false
if t == nil { if t == nil {
return nil return nil
@ -2988,7 +2988,7 @@ func ifacelookdot(s *Sym, t *Type, followptr *int, ignorecase int) *Type {
if c == 1 { if c == 1 {
for i = 0; i < d; i++ { for i = 0; i < d; i++ {
if Isptr[dotlist[i].field.Type.Etype] { if Isptr[dotlist[i].field.Type.Etype] {
*followptr = 1 *followptr = true
break break
} }
} }
@ -3046,7 +3046,7 @@ func implements(t *Type, iface *Type, m **Type, samename **Type, ptr *int) bool
} }
var tm *Type var tm *Type
var imtype *Type var imtype *Type
var followptr int var followptr bool
var rcvr *Type var rcvr *Type
for im := iface.Type; im != nil; im = im.Down { for im := iface.Type; im != nil; im = im.Down {
imtype = methodfunc(im.Type, nil) imtype = methodfunc(im.Type, nil)
@ -3065,7 +3065,7 @@ func implements(t *Type, iface *Type, m **Type, samename **Type, ptr *int) bool
// the method does not exist for value types. // the method does not exist for value types.
rcvr = getthisx(tm.Type).Type.Type rcvr = getthisx(tm.Type).Type.Type
if Isptr[rcvr.Etype] && !Isptr[t0.Etype] && followptr == 0 && !isifacemethod(tm.Type) { if Isptr[rcvr.Etype] && !Isptr[t0.Etype] && !followptr && !isifacemethod(tm.Type) {
if false && Debug['r'] != 0 { if false && Debug['r'] != 0 {
Yyerror("interface pointer mismatch") Yyerror("interface pointer mismatch")
} }