]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: remove typechecklist
authorJosh Bleecher Snyder <josharian@gmail.com>
Sun, 20 Mar 2016 00:02:01 +0000 (17:02 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Sun, 20 Mar 2016 00:34:42 +0000 (00:34 +0000)
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>

src/cmd/compile/internal/gc/alg.go
src/cmd/compile/internal/gc/closure.go
src/cmd/compile/internal/gc/inl.go
src/cmd/compile/internal/gc/main.go
src/cmd/compile/internal/gc/range.go
src/cmd/compile/internal/gc/select.go
src/cmd/compile/internal/gc/subr.go
src/cmd/compile/internal/gc/swt.go
src/cmd/compile/internal/gc/typecheck.go
src/cmd/compile/internal/gc/walk.go

index 4ee9de5c9cdd4f71f14045ff738e8393aa365d71..460c5389779e247b1965784e8ffef00126e74450 100644 (file)
@@ -282,7 +282,7 @@ func genhash(sym *Sym, t *Type) {
        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 @@ func geneq(sym *Sym, t *Type) {
        Curfn = fn
        fn.Func.Dupok = true
        typecheck(&fn, Etop)
-       typechecklist(fn.Nbody.Slice(), Etop)
+       typecheckslice(fn.Nbody.Slice(), Etop)
        Curfn = nil
        popdcl()
        testdclstack()
index 4c97cad4bc6ff7dc1914a4cbc329050d84061e99..0677c3030b1bf9ce92df21dc9607279fccc330a8 100644 (file)
@@ -109,7 +109,7 @@ func typecheckclosure(func_ *Node, top int) {
                Curfn = func_
                olddd := decldepth
                decldepth = 1
-               typechecklist(func_.Nbody.Slice(), Etop)
+               typecheckslice(func_.Nbody.Slice(), Etop)
                decldepth = olddd
                Curfn = oldfn
        }
index 0ef92534c949d8cdba9b8eeb65e9d75f15310041..cc311c4445baa21d8da4be6a206ac8393ce864ea 100644 (file)
@@ -75,7 +75,7 @@ func typecheckinl(fn *Node) {
 
        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 @@ func (subst *inlsubst) node(n *Node) *Node {
                        m.Ninit.Append(as)
                }
 
-               typechecklist(m.Ninit.Slice(), Etop)
+               typecheckslice(m.Ninit.Slice(), Etop)
                typecheck(&m, Etop)
 
                //              dump("Return after substitution", m);
index 63a0ab8ca9a3900f039bea55958260ae09f5405f..b29f7d10ae34d5565d3ea15c965675807306efd5 100644 (file)
@@ -392,7 +392,7 @@ func Main() {
                        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
index bf7938a30cc0e52f9677c09386ba5b07e0c8565a..a702010f18c58695ea4190ddd769978008cb8cd8 100644 (file)
@@ -127,7 +127,7 @@ out:
        }
 
        decldepth++
-       typechecklist(n.Nbody.Slice(), Etop)
+       typecheckslice(n.Nbody.Slice(), Etop)
        decldepth--
 }
 
@@ -313,9 +313,9 @@ func walkrange(n *Node) {
        }
 
        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 @@ func memclrrange(n, v1, v2, a *Node) bool {
        n.Nbody.Append(v1)
 
        typecheck(&n.Left, Erv)
-       typechecklist(n.Nbody.Slice(), Etop)
+       typecheckslice(n.Nbody.Slice(), Etop)
        walkstmt(&n)
        return true
 }
index 17039014d69557ce189fd73a846e70094d72038c..9b88c38a4e7de31d8ec81607626d9cdf2068572c 100644 (file)
@@ -12,7 +12,7 @@ func typecheckselect(sel *Node) {
        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 @@ func typecheckselect(sel *Node) {
                        }
                }
 
-               typechecklist(ncase.Nbody.Slice(), Etop)
+               typecheckslice(ncase.Nbody.Slice(), Etop)
        }
 
        sel.Xoffset = int64(count)
index 411f7e0475a50ef95049091dca6e638f2660ea0e..153e6210ccb209967d84c5f10bd1cdec7d10ea8a 100644 (file)
@@ -2009,7 +2009,7 @@ func genwrapper(rcvr *Type, method *Field, newnam *Sym, iface int) {
                fn.Func.Dupok = true
        }
        typecheck(&fn, Etop)
-       typechecklist(fn.Nbody.Slice(), Etop)
+       typecheckslice(fn.Nbody.Slice(), Etop)
 
        inlcalls(fn)
        escAnalyze([]*Node{fn}, false)
index 2a4e741297c9c35d6e83d2362ba257720846a984..6eca91d3fb1d06a315081ab8bceacb87b2700b7e 100644 (file)
@@ -58,7 +58,7 @@ type caseClause struct {
 // 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 @@ func typecheckswitch(n *Node) {
                        }
                }
 
-               typechecklist(ncase.Nbody.Slice(), Etop)
+               typecheckslice(ncase.Nbody.Slice(), Etop)
        }
 
        lineno = lno
index 7e09912054eb7de7438aab1977bb6b3dd428d5f7..2de8947dfcbe3617a44c6916a2dd7dafa5bc2e82 100644 (file)
@@ -34,12 +34,6 @@ func resolve(n *Node) *Node {
        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 @@ OpSwitch:
                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 @@ OpSwitch:
                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 @@ OpSwitch:
                }
 
                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 @@ OpSwitch:
                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 @@ OpSwitch:
 
        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 @@ OpSwitch:
 
        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 @@ OpSwitch:
                        }
                }
                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 @@ OpSwitch:
                                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 @@ OpSwitch:
 
        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 @@ func typecheckas2(n *Node) {
        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)
 
index 587914bcd120e09e0a8b28594ebb0a6e8ce633a2..a4fa607c8fa448d99753d131609ccb62caa664b1 100644 (file)
@@ -2022,7 +2022,7 @@ func walkprint(nn *Node, init *Nodes) *Node {
 
        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 @@ func appendslice(n *Node, init *Nodes) *Node {
                l = append(ln.Slice(), nt)
        }
 
-       typechecklist(l, Etop)
+       typecheckslice(l, Etop)
        walkstmtlist(l)
        init.Append(l...)
        return s
@@ -2987,7 +2987,7 @@ func walkappend(n *Node, init *Nodes, dst *Node) *Node {
                }
        }
 
-       typechecklist(l, Etop)
+       typecheckslice(l, Etop)
        walkstmtlist(l)
        init.Append(l...)
        return ns
@@ -3053,7 +3053,7 @@ func copyany(n *Node, init *Nodes, runtimecall bool) *Node {
        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 @@ func walkprintfunc(np **Node, init *Nodes) {
        funcbody(fn)
 
        typecheck(&fn, Etop)
-       typechecklist(fn.Nbody.Slice(), Etop)
+       typecheckslice(fn.Nbody.Slice(), Etop)
        xtop = append(xtop, fn)
        Curfn = oldfn