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>
diff --git a/src/cmd/compile/internal/gc/swt.go b/src/cmd/compile/internal/gc/swt.go
index 996bd6911..cbf284c 100644
--- a/src/cmd/compile/internal/gc/swt.go
+++ b/src/cmd/compile/internal/gc/swt.go
@@ -149,7 +149,7 @@
var missing, have *Field
var ptr int
switch {
- case n1.Op == OLITERAL && Istype(n1.Type, TNIL):
+ case n1.Op == OLITERAL && n1.Type.IsKind(TNIL):
case n1.Op != OTYPE && n1.Type != nil: // should this be ||?
Yyerror("%v is not a type", Nconv(n1, FmtLong))
// reset to original type
@@ -170,7 +170,7 @@
ll := ncase.List
if ncase.Rlist.Len() != 0 {
nvar := ncase.Rlist.First()
- if ll.Len() == 1 && ll.First().Type != nil && !Istype(ll.First().Type, TNIL) {
+ if ll.Len() == 1 && ll.First().Type != nil && !ll.First().Type.IsKind(TNIL) {
// single entry type switch
nvar.Name.Param.Ntype = typenod(ll.First().Type)
} else {
@@ -449,7 +449,7 @@
switch {
case n.Left.Op == OLITERAL:
c.typ = caseKindTypeNil
- case Istype(n.Left.Type, TINTER):
+ case n.Left.Type.IsInterface():
c.typ = caseKindTypeVar
default:
c.typ = caseKindTypeConst
@@ -528,7 +528,7 @@
}
cond.Right = walkexpr(cond.Right, &sw.Ninit)
- if !Istype(cond.Right.Type, TINTER) {
+ if !cond.Right.Type.IsInterface() {
Yyerror("type switch must be on an interface")
return
}
@@ -594,7 +594,7 @@
i.Left = typecheck(i.Left, Erv)
cas = append(cas, i)
- if !isnilinter(cond.Right.Type) {
+ if !cond.Right.Type.IsEmptyInterface() {
// Load type from itab.
typ = NodSym(ODOTPTR, typ, nil)
typ.Type = Ptrto(Types[TUINT8])