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>
diff --git a/src/cmd/compile/internal/gc/subr.go b/src/cmd/compile/internal/gc/subr.go
index df5e398..f82fed4 100644
--- a/src/cmd/compile/internal/gc/subr.go
+++ b/src/cmd/compile/internal/gc/subr.go
@@ -2163,17 +2163,17 @@
*/
type Symlink struct {
field *Type
- good uint8
- followptr uint8
link *Symlink
+ good bool
+ followptr bool
}
var slist *Symlink
-func expand0(t *Type, followptr int) {
+func expand0(t *Type, followptr bool) {
u := t
if Isptr[u.Etype] {
- followptr = 1
+ followptr = true
u = u.Type
}
@@ -2187,7 +2187,7 @@
sl = new(Symlink)
sl.field = f
sl.link = slist
- sl.followptr = uint8(followptr)
+ sl.followptr = followptr
slist = sl
}
@@ -2205,13 +2205,13 @@
sl = new(Symlink)
sl.field = f
sl.link = slist
- sl.followptr = uint8(followptr)
+ sl.followptr = followptr
slist = sl
}
}
}
-func expand1(t *Type, d int, followptr int) {
+func expand1(t *Type, d int, followptr bool) {
if t.Trecur != 0 {
return
}
@@ -2226,7 +2226,7 @@
u := t
if Isptr[u.Etype] {
- followptr = 1
+ followptr = true
u = u.Type
}
@@ -2263,7 +2263,7 @@
// generate all reachable methods
slist = nil
- expand1(t, len(dotlist)-1, 0)
+ expand1(t, len(dotlist)-1, false)
// check each method to be uniquely reachable
var c int
@@ -2278,7 +2278,7 @@
if c == 1 {
// addot1 may have dug out arbitrary fields, we only want methods.
if f.Type.Etype == TFUNC && f.Type.Thistuple > 0 {
- sl.good = 1
+ sl.good = true
sl.field = f
}
}
@@ -2293,13 +2293,13 @@
t.Xmethod = t.Method
for sl := slist; sl != nil; sl = sl.link {
- if sl.good != 0 {
+ if sl.good {
// add it to the base type method list
f = typ(TFIELD)
*f = *sl.field
f.Embedded = 1 // needs a trampoline
- if sl.followptr != 0 {
+ if sl.followptr {
f.Embedded = 2
}
f.Down = t.Xmethod
@@ -2968,8 +2968,8 @@
safemode = old_safemode
}
-func ifacelookdot(s *Sym, t *Type, followptr *int, ignorecase int) *Type {
- *followptr = 0
+func ifacelookdot(s *Sym, t *Type, followptr *bool, ignorecase int) *Type {
+ *followptr = false
if t == nil {
return nil
@@ -2988,7 +2988,7 @@
if c == 1 {
for i = 0; i < d; i++ {
if Isptr[dotlist[i].field.Type.Etype] {
- *followptr = 1
+ *followptr = true
break
}
}
@@ -3046,7 +3046,7 @@
}
var tm *Type
var imtype *Type
- var followptr int
+ var followptr bool
var rcvr *Type
for im := iface.Type; im != nil; im = im.Down {
imtype = methodfunc(im.Type, nil)
@@ -3065,7 +3065,7 @@
// the method does not exist for value types.
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 {
Yyerror("interface pointer mismatch")
}