]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile/internal/gc: remove a bunch of uses of typenod
authorMatthew Dempsky <mdempsky@google.com>
Thu, 6 Apr 2017 01:52:33 +0000 (18:52 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Thu, 6 Apr 2017 22:47:08 +0000 (22:47 +0000)
Passes toolstash-check -all.

Change-Id: Ic9eb0c52bedac185ab86cc62207f199d93700344
Reviewed-on: https://go-review.googlesource.com/39795
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
src/cmd/compile/internal/gc/bexport.go
src/cmd/compile/internal/gc/bimport.go
src/cmd/compile/internal/gc/closure.go
src/cmd/compile/internal/gc/swt.go

index 960037da750c0649c8d70b0f6c4555b2740f70c5..474b36412a46ccf5817a8be31ea85911d07c59aa 100644 (file)
@@ -1273,11 +1273,11 @@ func (p *exporter) expr(n *Node) {
                p.op(ODOTTYPE)
                p.pos(n)
                p.expr(n.Left)
-               if p.bool(n.Right != nil) {
-                       p.expr(n.Right)
-               } else {
-                       p.typ(n.Type)
+               if n.Right != nil {
+                       Fatalf("impossible")
                }
+               p.bool(false)
+               p.typ(n.Type)
 
        case OINDEX, OINDEXMAP:
                p.op(OINDEX)
index 7b770ff24171900fe87e6838664807191d915211..5f4121d7b5a159e573474560ea986d10273a1fa5 100644 (file)
@@ -884,13 +884,11 @@ func (p *importer) node() *Node {
                        // again. Re-introduce explicit uintptr(c) conversion.
                        // (issue 16317).
                        if typ.IsUnsafePtr() {
-                               conv := nod(OCALL, typenod(Types[TUINTPTR]), nil)
-                               conv.List.Set1(n)
-                               n = conv
+                               n = nod(OCONV, n, nil)
+                               n.Type = Types[TUINTPTR]
                        }
-                       conv := nod(OCALL, typenod(typ), nil)
-                       conv.List.Set1(n)
-                       n = conv
+                       n = nod(OCONV, n, nil)
+                       n.Type = typ
                }
                return n
 
@@ -963,10 +961,9 @@ func (p *importer) node() *Node {
        case ODOTTYPE:
                n := nodl(p.pos(), ODOTTYPE, p.expr(), nil)
                if p.bool() {
-                       n.Right = p.expr()
-               } else {
-                       n.Right = typenod(p.typ())
+                       Fatalf("impossible")
                }
+               n.Type = p.typ()
                return n
 
        // case OINDEX, OINDEXMAP, OSLICE, OSLICESTR, OSLICEARR, OSLICE3, OSLICE3ARR:
@@ -989,8 +986,13 @@ func (p *importer) node() *Node {
        //      unreachable - mapped to OCONV case below by exporter
 
        case OCONV:
-               n := nodl(p.pos(), OCALL, typenod(p.typ()), nil)
-               n.List.Set(p.exprList())
+               n := nodl(p.pos(), OCONV, nil, nil)
+               n.Type = p.typ()
+               exprs := p.exprList()
+               if len(exprs) != 1 {
+                       Fatalf("impossible")
+               }
+               n.Left = exprs[0]
                return n
 
        case OCOPY, OCOMPLEX, OREAL, OIMAG, OAPPEND, OCAP, OCLOSE, ODELETE, OLEN, OMAKE, ONEW, OPANIC, ORECOVER, OPRINT, OPRINTN:
index 5319d1bd6de8db10eca047d19034588e9aacc62d..99b2678f5035139c3aa2b096fcc74cc3f97e4ec3 100644 (file)
@@ -395,7 +395,7 @@ func transformclosure(xfunc *Node) {
                                // Declare variable holding addresses taken from closure
                                // and initialize in entry prologue.
                                addr := newname(lookup("&" + v.Sym.Name))
-                               addr.Name.Param.Ntype = nod(OIND, typenod(v.Type), nil)
+                               addr.Type = typPtr(v.Type)
                                addr.Class = PAUTO
                                addr.SetUsed(true)
                                addr.Name.Curfn = xfunc
@@ -626,10 +626,10 @@ func makepartialcall(fn *Node, t0 *Type, meth *Sym) *Node {
        xfunc.Func.Dcl = append(xfunc.Func.Dcl, ptr)
        var body []*Node
        if rcvrtype.IsPtr() || rcvrtype.IsInterface() {
-               ptr.Name.Param.Ntype = typenod(rcvrtype)
+               ptr.Type = rcvrtype
                body = append(body, nod(OAS, ptr, cv))
        } else {
-               ptr.Name.Param.Ntype = typenod(typPtr(rcvrtype))
+               ptr.Type = typPtr(rcvrtype)
                body = append(body, nod(OAS, ptr, nod(OADDR, cv, nil)))
        }
 
index da99d5e218fc012e588c3959053711c9668c62a3..455957bec108061bd3f7fd2ed31fc35df5ed65a0 100644 (file)
@@ -182,10 +182,10 @@ func typecheckswitch(n *Node) {
                                nvar := ncase.Rlist.First()
                                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)
+                                       nvar.Type = ll.First().Type
                                } else {
                                        // multiple entry type switch or default
-                                       nvar.Name.Param.Ntype = typenod(n.Type)
+                                       nvar.Type = n.Type
                                }
 
                                nvar = typecheck(nvar, Erv|Easgn)