1
0
mirror of https://github.com/golang/go synced 2024-09-30 05:24:29 -06:00

cmd/compile: convert Type.Trecur to a boolean flag

Change-Id: I162e86e5f92c8b827a74ee860d16abadf83bc43e
Reviewed-on: https://go-review.googlesource.com/38910
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Josh Bleecher Snyder 2017-03-29 21:00:55 -07:00
parent efc47819c0
commit 371aa23d10
2 changed files with 11 additions and 9 deletions

View File

@ -1426,10 +1426,10 @@ func lookdot0(s *Sym, t *Type, save **Field, ignorecase bool) int {
// embedded fields at depth d, so callers can decide whether to retry at // embedded fields at depth d, so callers can decide whether to retry at
// a greater depth. // a greater depth.
func adddot1(s *Sym, t *Type, d int, save **Field, ignorecase bool) (c int, more bool) { func adddot1(s *Sym, t *Type, d int, save **Field, ignorecase bool) (c int, more bool) {
if t.Trecur != 0 { if t.Recur() {
return return
} }
t.Trecur = 1 t.SetRecur(true)
var u *Type var u *Type
d-- d--
@ -1471,7 +1471,7 @@ func adddot1(s *Sym, t *Type, d int, save **Field, ignorecase bool) (c int, more
} }
out: out:
t.Trecur = 0 t.SetRecur(false)
return c, more return c, more
} }
@ -1585,10 +1585,10 @@ func expand0(t *Type, followptr bool) {
} }
func expand1(t *Type, top, followptr bool) { func expand1(t *Type, top, followptr bool) {
if t.Trecur != 0 { if t.Recur() {
return return
} }
t.Trecur = 1 t.SetRecur(true)
if !top { if !top {
expand0(t, followptr) expand0(t, followptr)
@ -1615,7 +1615,7 @@ func expand1(t *Type, top, followptr bool) {
} }
out: out:
t.Trecur = 0 t.SetRecur(false)
} }
func expandmeth(t *Type) { func expandmeth(t *Type) {

View File

@ -153,9 +153,8 @@ type Type struct {
Sym *Sym // symbol containing name, for named types Sym *Sym // symbol containing name, for named types
Vargen int32 // unique name for OTYPE/ONAME Vargen int32 // unique name for OTYPE/ONAME
Etype EType // kind of type Etype EType // kind of type
Trecur uint8 // to detect loops Align uint8 // the required alignment of this type, in bytes
Align uint8 // the required alignment of this type, in bytes
flags bitset8 flags bitset8
} }
@ -166,6 +165,7 @@ const (
typeBroke // broken type definition typeBroke // broken type definition
typeNoalg // suppress hash and eq algorithm generation typeNoalg // suppress hash and eq algorithm generation
typeDeferwidth typeDeferwidth
typeRecur
) )
func (t *Type) Local() bool { return t.flags&typeLocal != 0 } func (t *Type) Local() bool { return t.flags&typeLocal != 0 }
@ -173,12 +173,14 @@ func (t *Type) NotInHeap() bool { return t.flags&typeNotInHeap != 0 }
func (t *Type) Broke() bool { return t.flags&typeBroke != 0 } func (t *Type) Broke() bool { return t.flags&typeBroke != 0 }
func (t *Type) Noalg() bool { return t.flags&typeNoalg != 0 } func (t *Type) Noalg() bool { return t.flags&typeNoalg != 0 }
func (t *Type) Deferwidth() bool { return t.flags&typeDeferwidth != 0 } func (t *Type) Deferwidth() bool { return t.flags&typeDeferwidth != 0 }
func (t *Type) Recur() bool { return t.flags&typeRecur != 0 }
func (t *Type) SetLocal(b bool) { t.flags.set(typeLocal, b) } func (t *Type) SetLocal(b bool) { t.flags.set(typeLocal, b) }
func (t *Type) SetNotInHeap(b bool) { t.flags.set(typeNotInHeap, b) } func (t *Type) SetNotInHeap(b bool) { t.flags.set(typeNotInHeap, b) }
func (t *Type) SetBroke(b bool) { t.flags.set(typeBroke, b) } func (t *Type) SetBroke(b bool) { t.flags.set(typeBroke, b) }
func (t *Type) SetNoalg(b bool) { t.flags.set(typeNoalg, b) } func (t *Type) SetNoalg(b bool) { t.flags.set(typeNoalg, b) }
func (t *Type) SetDeferwidth(b bool) { t.flags.set(typeDeferwidth, b) } func (t *Type) SetDeferwidth(b bool) { t.flags.set(typeDeferwidth, b) }
func (t *Type) SetRecur(b bool) { t.flags.set(typeRecur, b) }
// MapType contains Type fields specific to maps. // MapType contains Type fields specific to maps.
type MapType struct { type MapType struct {