*/
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
}
sl = new(Symlink)
sl.field = f
sl.link = slist
- sl.followptr = uint8(followptr)
+ sl.followptr = followptr
slist = sl
}
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
}
u := t
if Isptr[u.Etype] {
- followptr = 1
+ followptr = true
u = u.Type
}
// 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
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
}
}
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
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
if c == 1 {
for i = 0; i < d; i++ {
if Isptr[dotlist[i].field.Type.Etype] {
- *followptr = 1
+ *followptr = true
break
}
}
}
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)
// 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")
}