mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: more Isfoo Type cleanups
Replace isideal(t) with t.IsUntyped(). Replace Istype(t, k) with t.IsKind(k). Replace isnilinter(t) with t.IsEmptyInterface(). Also replace a lot of t.IsKind(TFOO) with t.IsFoo(). Replacements prepared mechanically with gofmt -w -r. Passes toolstash -cmp. Change-Id: Iba48058f3cc863e15af14277b5ff5e729e67e043 Reviewed-on: https://go-review.googlesource.com/21424 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
5dd129bcff
commit
00e5a68c3e
17 changed files with 72 additions and 70 deletions
|
|
@ -569,10 +569,6 @@ func isptrto(t *Type, et EType) bool {
|
|||
return true
|
||||
}
|
||||
|
||||
func Istype(t *Type, et EType) bool {
|
||||
return t != nil && t.Etype == et
|
||||
}
|
||||
|
||||
func isblank(n *Node) bool {
|
||||
if n == nil {
|
||||
return false
|
||||
|
|
@ -584,25 +580,6 @@ func isblanksym(s *Sym) bool {
|
|||
return s != nil && s.Name == "_"
|
||||
}
|
||||
|
||||
func isnilinter(t *Type) bool {
|
||||
return t.IsInterface() && t.NumFields() == 0
|
||||
}
|
||||
|
||||
func isideal(t *Type) bool {
|
||||
if t == nil {
|
||||
return false
|
||||
}
|
||||
if t == idealstring || t == idealbool {
|
||||
return true
|
||||
}
|
||||
switch t.Etype {
|
||||
case TNIL, TIDEAL:
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// given receiver of type t (t == r or t == *r)
|
||||
// return type to hang methods off (r).
|
||||
func methtype(t *Type, mustname int) *Type {
|
||||
|
|
@ -812,7 +789,7 @@ func assignop(src *Type, dst *Type, why *string) Op {
|
|||
// both are empty interface types.
|
||||
// For assignable but different non-empty interface types,
|
||||
// we want to recompute the itab.
|
||||
if Eqtype(src.Orig, dst.Orig) && (src.Sym == nil || dst.Sym == nil || isnilinter(src)) {
|
||||
if Eqtype(src.Orig, dst.Orig) && (src.Sym == nil || dst.Sym == nil || src.IsEmptyInterface()) {
|
||||
return OCONVNOP
|
||||
}
|
||||
|
||||
|
|
@ -2269,7 +2246,7 @@ func isdirectiface(t *Type) bool {
|
|||
// 'I' if t is an interface type, and 'E' if t is an empty interface type.
|
||||
// It is used to build calls to the conv* and assert* runtime routines.
|
||||
func (t *Type) iet() byte {
|
||||
if isnilinter(t) {
|
||||
if t.IsEmptyInterface() {
|
||||
return 'E'
|
||||
}
|
||||
if t.IsInterface() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue