// 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
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:
// 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:
// 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
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)))
}
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)