cmd/compile: remove typechecklist
Convert remaining uses to typecheckslice.
Passes toolstash -cmp.
Change-Id: I6ed0877386fb6c0b036e8ee5a228433343855abd
Reviewed-on: https://go-review.googlesource.com/20905
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
diff --git a/src/cmd/compile/internal/gc/alg.go b/src/cmd/compile/internal/gc/alg.go
index 4ee9de5..460c538 100644
--- a/src/cmd/compile/internal/gc/alg.go
+++ b/src/cmd/compile/internal/gc/alg.go
@@ -282,7 +282,7 @@
Curfn = fn
fn.Func.Dupok = true
typecheck(&fn, Etop)
- typechecklist(fn.Nbody.Slice(), Etop)
+ typecheckslice(fn.Nbody.Slice(), Etop)
Curfn = nil
popdcl()
testdclstack()
@@ -475,7 +475,7 @@
Curfn = fn
fn.Func.Dupok = true
typecheck(&fn, Etop)
- typechecklist(fn.Nbody.Slice(), Etop)
+ typecheckslice(fn.Nbody.Slice(), Etop)
Curfn = nil
popdcl()
testdclstack()
diff --git a/src/cmd/compile/internal/gc/closure.go b/src/cmd/compile/internal/gc/closure.go
index 4c97cad..0677c30 100644
--- a/src/cmd/compile/internal/gc/closure.go
+++ b/src/cmd/compile/internal/gc/closure.go
@@ -109,7 +109,7 @@
Curfn = func_
olddd := decldepth
decldepth = 1
- typechecklist(func_.Nbody.Slice(), Etop)
+ typecheckslice(func_.Nbody.Slice(), Etop)
decldepth = olddd
Curfn = oldfn
}
diff --git a/src/cmd/compile/internal/gc/inl.go b/src/cmd/compile/internal/gc/inl.go
index 0ef9253..cc311c4 100644
--- a/src/cmd/compile/internal/gc/inl.go
+++ b/src/cmd/compile/internal/gc/inl.go
@@ -75,7 +75,7 @@
savefn := Curfn
Curfn = fn
- typechecklist(fn.Func.Inl.Slice(), Etop)
+ typecheckslice(fn.Func.Inl.Slice(), Etop)
Curfn = savefn
safemode = save_safemode
@@ -955,7 +955,7 @@
m.Ninit.Append(as)
}
- typechecklist(m.Ninit.Slice(), Etop)
+ typecheckslice(m.Ninit.Slice(), Etop)
typecheck(&m, Etop)
// dump("Return after substitution", m);
diff --git a/src/cmd/compile/internal/gc/main.go b/src/cmd/compile/internal/gc/main.go
index 63a0ab8..b29f7d1 100644
--- a/src/cmd/compile/internal/gc/main.go
+++ b/src/cmd/compile/internal/gc/main.go
@@ -392,7 +392,7 @@
Curfn = xtop[i]
decldepth = 1
saveerrors()
- typechecklist(Curfn.Nbody.Slice(), Etop)
+ typecheckslice(Curfn.Nbody.Slice(), Etop)
checkreturn(Curfn)
if nerrors != 0 {
Curfn.Nbody.Set(nil) // type errors; do not compile
diff --git a/src/cmd/compile/internal/gc/range.go b/src/cmd/compile/internal/gc/range.go
index bf7938a..a702010 100644
--- a/src/cmd/compile/internal/gc/range.go
+++ b/src/cmd/compile/internal/gc/range.go
@@ -127,7 +127,7 @@
}
decldepth++
- typechecklist(n.Nbody.Slice(), Etop)
+ typecheckslice(n.Nbody.Slice(), Etop)
decldepth--
}
@@ -313,9 +313,9 @@
}
n.Op = OFOR
- typechecklist(init, Etop)
+ typecheckslice(init, Etop)
n.Ninit.Append(init...)
- typechecklist(n.Left.Ninit.Slice(), Etop)
+ typecheckslice(n.Left.Ninit.Slice(), Etop)
typecheck(&n.Left, Erv)
typecheck(&n.Right, Etop)
typecheckslice(body, Etop)
@@ -399,7 +399,7 @@
n.Nbody.Append(v1)
typecheck(&n.Left, Erv)
- typechecklist(n.Nbody.Slice(), Etop)
+ typecheckslice(n.Nbody.Slice(), Etop)
walkstmt(&n)
return true
}
diff --git a/src/cmd/compile/internal/gc/select.go b/src/cmd/compile/internal/gc/select.go
index 1703901..9b88c38 100644
--- a/src/cmd/compile/internal/gc/select.go
+++ b/src/cmd/compile/internal/gc/select.go
@@ -12,7 +12,7 @@
var def *Node
lno := setlineno(sel)
count := 0
- typechecklist(sel.Ninit.Slice(), Etop)
+ typecheckslice(sel.Ninit.Slice(), Etop)
for _, n1 := range sel.List.Slice() {
count++
ncase = n1
@@ -79,7 +79,7 @@
}
}
- typechecklist(ncase.Nbody.Slice(), Etop)
+ typecheckslice(ncase.Nbody.Slice(), Etop)
}
sel.Xoffset = int64(count)
diff --git a/src/cmd/compile/internal/gc/subr.go b/src/cmd/compile/internal/gc/subr.go
index 411f7e0..153e621 100644
--- a/src/cmd/compile/internal/gc/subr.go
+++ b/src/cmd/compile/internal/gc/subr.go
@@ -2009,7 +2009,7 @@
fn.Func.Dupok = true
}
typecheck(&fn, Etop)
- typechecklist(fn.Nbody.Slice(), Etop)
+ typecheckslice(fn.Nbody.Slice(), Etop)
inlcalls(fn)
escAnalyze([]*Node{fn}, false)
diff --git a/src/cmd/compile/internal/gc/swt.go b/src/cmd/compile/internal/gc/swt.go
index 2a4e741..6eca91d 100644
--- a/src/cmd/compile/internal/gc/swt.go
+++ b/src/cmd/compile/internal/gc/swt.go
@@ -58,7 +58,7 @@
// typecheckswitch typechecks a switch statement.
func typecheckswitch(n *Node) {
lno := lineno
- typechecklist(n.Ninit.Slice(), Etop)
+ typecheckslice(n.Ninit.Slice(), Etop)
var nilonly string
var top int
@@ -182,7 +182,7 @@
}
}
- typechecklist(ncase.Nbody.Slice(), Etop)
+ typecheckslice(ncase.Nbody.Slice(), Etop)
}
lineno = lno
diff --git a/src/cmd/compile/internal/gc/typecheck.go b/src/cmd/compile/internal/gc/typecheck.go
index 7e09912..2de8947 100644
--- a/src/cmd/compile/internal/gc/typecheck.go
+++ b/src/cmd/compile/internal/gc/typecheck.go
@@ -34,12 +34,6 @@
return n
}
-func typechecklist(l []*Node, top int) {
- for i := range l {
- typecheck(&l[i], top)
- }
-}
-
func typecheckslice(l []*Node, top int) {
for i := range l {
typecheck(&l[i], top)
@@ -1290,7 +1284,7 @@
if n.List.Len() == 1 && !n.Isddd {
typecheck(n.List.Addr(0), Erv|Efnstruct)
} else {
- typechecklist(n.List.Slice(), Erv)
+ typecheckslice(n.List.Slice(), Erv)
}
t := l.Type
if t == nil {
@@ -1437,7 +1431,7 @@
var r *Node
var l *Node
if n.List.Len() == 1 {
- typechecklist(n.List.Slice(), Efnstruct)
+ typecheckslice(n.List.Slice(), Efnstruct)
if n.List.First().Op != OCALLFUNC && n.List.First().Op != OCALLMETH {
Yyerror("invalid operation: complex expects two arguments")
n.Type = nil
@@ -1557,7 +1551,7 @@
}
ok |= Etop
- typechecklist(args.Slice(), Erv)
+ typecheckslice(args.Slice(), Erv)
l := args.First()
r := args.Second()
if l.Type != nil && l.Type.Etype != TMAP {
@@ -1581,7 +1575,7 @@
if args.Len() == 1 && !n.Isddd {
typecheck(args.Addr(0), Erv|Efnstruct)
} else {
- typechecklist(args.Slice(), Erv)
+ typecheckslice(args.Slice(), Erv)
}
t := args.First().Type
@@ -1904,7 +1898,7 @@
case OPRINT, OPRINTN:
ok |= Etop
- typechecklist(n.List.Slice(), Erv|Eindir) // Eindir: address does not escape
+ typecheckslice(n.List.Slice(), Erv|Eindir) // Eindir: address does not escape
ls := n.List.Slice()
for i1, n1 := range ls {
// Special case for print: int constant is int64, not int.
@@ -2047,7 +2041,7 @@
case OFOR:
ok |= Etop
- typechecklist(n.Ninit.Slice(), Etop)
+ typecheckslice(n.Ninit.Slice(), Etop)
decldepth++
typecheck(&n.Left, Erv)
if n.Left != nil {
@@ -2057,13 +2051,13 @@
}
}
typecheck(&n.Right, Etop)
- typechecklist(n.Nbody.Slice(), Etop)
+ typecheckslice(n.Nbody.Slice(), Etop)
decldepth--
break OpSwitch
case OIF:
ok |= Etop
- typechecklist(n.Ninit.Slice(), Etop)
+ typecheckslice(n.Ninit.Slice(), Etop)
typecheck(&n.Left, Erv)
if n.Left != nil {
t := n.Left.Type
@@ -2071,16 +2065,16 @@
Yyerror("non-bool %v used as if condition", Nconv(n.Left, FmtLong))
}
}
- typechecklist(n.Nbody.Slice(), Etop)
- typechecklist(n.Rlist.Slice(), Etop)
+ typecheckslice(n.Nbody.Slice(), Etop)
+ typecheckslice(n.Rlist.Slice(), Etop)
break OpSwitch
case ORETURN:
ok |= Etop
if n.List.Len() == 1 {
- typechecklist(n.List.Slice(), Erv|Efnstruct)
+ typecheckslice(n.List.Slice(), Erv|Efnstruct)
} else {
- typechecklist(n.List.Slice(), Erv)
+ typecheckslice(n.List.Slice(), Erv)
}
if Curfn == nil {
Yyerror("return outside function")
@@ -2120,8 +2114,8 @@
case OXCASE:
ok |= Etop
- typechecklist(n.List.Slice(), Erv)
- typechecklist(n.Nbody.Slice(), Etop)
+ typecheckslice(n.List.Slice(), Erv)
+ typecheckslice(n.Nbody.Slice(), Etop)
break OpSwitch
case ODCLFUNC:
@@ -3310,7 +3304,7 @@
if cl > 1 && cr == 1 {
typecheck(n.Rlist.Addr(0), Erv|Efnstruct)
} else {
- typechecklist(n.Rlist.Slice(), Erv)
+ typecheckslice(n.Rlist.Slice(), Erv)
}
checkassignlist(n, n.List)
diff --git a/src/cmd/compile/internal/gc/walk.go b/src/cmd/compile/internal/gc/walk.go
index 587914b..a4fa607 100644
--- a/src/cmd/compile/internal/gc/walk.go
+++ b/src/cmd/compile/internal/gc/walk.go
@@ -2022,7 +2022,7 @@
calls = append(calls, mkcall("printunlock", nil, init))
- typechecklist(calls, Etop)
+ typecheckslice(calls, Etop)
walkexprlist(calls, init)
r = Nod(OEMPTY, nil, nil)
@@ -2890,7 +2890,7 @@
l = append(ln.Slice(), nt)
}
- typechecklist(l, Etop)
+ typecheckslice(l, Etop)
walkstmtlist(l)
init.Append(l...)
return s
@@ -2987,7 +2987,7 @@
}
}
- typechecklist(l, Etop)
+ typecheckslice(l, Etop)
walkstmtlist(l)
init.Append(l...)
return ns
@@ -3053,7 +3053,7 @@
nwid = Nod(OMUL, nwid, Nodintconst(nl.Type.Type.Width))
l = append(l, mkcall1(fn, nil, init, nto, nfrm, nwid))
- typechecklist(l, Etop)
+ typecheckslice(l, Etop)
walkstmtlist(l)
init.Append(l...)
return nlen
@@ -4009,7 +4009,7 @@
funcbody(fn)
typecheck(&fn, Etop)
- typechecklist(fn.Nbody.Slice(), Etop)
+ typecheckslice(fn.Nbody.Slice(), Etop)
xtop = append(xtop, fn)
Curfn = oldfn