case TFUNCARGS:
t1 := t.Type
- w = widstruct(t.Type, t1.Recv(), 0, 0)
+ w = widstruct(t.Type, t1.Recvs(), 0, 0)
w = widstruct(t.Type, t1.Params(), w, Widthreg)
w = widstruct(t.Type, t1.Results(), w, Widthreg)
t1.Argwid = w
func Argsize(t *Type) int {
var w int64
- for _, p := range recvParamsResults {
+ for _, p := range recvsParamsResults {
for f, it := IterFields(p(t)); f != nil; f = it.Next() {
if x := f.Width + f.Type.Width; x > w {
w = x
for _, m := range methods {
p.string(m.Sym.Name)
- p.paramList(m.Type.Recv())
+ p.paramList(m.Type.Recvs())
p.paramList(m.Type.Params())
p.paramList(m.Type.Results())
p.inlinedBody(m.Type.Nname)
}
if t.Thistuple != 0 {
- for ft, it := IterFields(t.Recv()); ft != nil; ft = it.Next() {
+ for ft, it := IterFields(t.Recvs()); ft != nil; ft = it.Next() {
if ft.Nname == nil || ft.Nname.Sym == nil {
continue
}
// Those methods have an anonymous *struct{} as the receiver.
// (See fakethis above.)
func isifacemethod(f *Type) bool {
- rcvr := f.Recv0()
+ rcvr := f.Recv()
if rcvr.Sym != nil {
return false
}
if this != nil {
rcvr = []*Node{this}
}
- *t.RecvP() = tofunargs(rcvr)
+ *t.RecvsP() = tofunargs(rcvr)
*t.ResultsP() = tofunargs(out)
*t.ParamsP() = tofunargs(in)
uniqgen++
- checkdupfields(t.Recv().Type, "argument")
+ checkdupfields(t.Recvs().Type, "argument")
checkdupfields(t.Results().Type, "argument")
checkdupfields(t.Params().Type, "argument")
- if t.Recv().Broke || t.Results().Broke || t.Params().Broke {
+ if t.Recvs().Broke || t.Results().Broke || t.Params().Broke {
t.Broke = true
}
}
// get parent type sym
- pa := t.Recv0() // ptr to this structure
+ pa := t.Recv() // ptr to this structure
if pa == nil {
Yyerror("missing receiver")
return
initEscretval(e, n, fntype)
// If there is a receiver, it also leaks to heap.
if n.Op != OCALLFUNC {
- t := fntype.Recv0()
+ t := fntype.Recv()
src := n.Left.Left
if haspointers(t.Type) {
escassign(e, &e.theSink, src)
// Receiver.
if n.Op != OCALLFUNC {
- t := fntype.Recv0()
+ t := fntype.Recv()
src := n.Left.Left
if haspointers(t.Type) {
escassignfromtag(e, t.Note, nE.Escretval, src)
if Debug['l'] < 2 {
typecheckinl(f.Type.Nname)
}
- exportf("\tfunc (%v) %v %v { %v }\n", Tconv(f.Type.Recv0(), obj.FmtSharp), Sconv(f.Sym, obj.FmtShort|obj.FmtByte|obj.FmtSharp), Tconv(f.Type, obj.FmtShort|obj.FmtSharp), Hconv(f.Type.Nname.Func.Inl, obj.FmtSharp))
+ exportf("\tfunc (%v) %v %v { %v }\n", Tconv(f.Type.Recv(), obj.FmtSharp), Sconv(f.Sym, obj.FmtShort|obj.FmtByte|obj.FmtSharp), Tconv(f.Type, obj.FmtShort|obj.FmtSharp), Hconv(f.Type.Nname.Func.Inl, obj.FmtSharp))
reexportdeplist(f.Type.Nname.Func.Inl)
} else {
- exportf("\tfunc (%v) %v %v\n", Tconv(f.Type.Recv0(), obj.FmtSharp), Sconv(f.Sym, obj.FmtShort|obj.FmtByte|obj.FmtSharp), Tconv(f.Type, obj.FmtShort|obj.FmtSharp))
+ exportf("\tfunc (%v) %v %v\n", Tconv(f.Type.Recv(), obj.FmtSharp), Sconv(f.Sym, obj.FmtShort|obj.FmtByte|obj.FmtSharp), Tconv(f.Type, obj.FmtShort|obj.FmtSharp))
}
}
}
} else {
if t.Thistuple != 0 {
buf.WriteString("method")
- buf.WriteString(Tconv(t.Recv(), 0))
+ buf.WriteString(Tconv(t.Recvs(), 0))
buf.WriteString(" ")
}
buf.WriteString("func")
func fnpkg(fn *Node) *Pkg {
if fn.Type.Thistuple != 0 {
// method
- rcvr := fn.Type.Recv0().Type
+ rcvr := fn.Type.Recv().Type
if Isptr[rcvr.Etype] {
rcvr = rcvr.Type
var as *Node
if fn.Type.Thistuple != 0 && n.Left.Op == ODOTMETH {
// method call with a receiver.
- t := fn.Type.Recv0()
+ t := fn.Type.Recv()
if t != nil && t.Nname != nil && !isblank(t.Nname) && t.Nname.Name.Inlvar == nil {
Fatalf("missing inlvar for %v\n", t.Nname)
}
// append receiver inlvar to LHS.
- t := fn.Type.Recv0()
+ t := fn.Type.Recv()
if t != nil && t.Nname != nil && !isblank(t.Nname) && t.Nname.Name.Inlvar == nil {
Fatalf("missing inlvar for %v\n", t.Nname)
out.Type.Type = Types[TSTRING]
out.Funarg = true
f := typ(TFUNC)
- *f.RecvP() = rcvr
+ *f.RecvsP() = rcvr
*f.ResultsP() = out
*f.ParamsP() = in
f.Thistuple = 1
var xoffset int64
if Curfn.Type.Thistuple > 0 {
xoffset = 0
- onebitwalktype1(Curfn.Type.Recv(), &xoffset, bv)
+ onebitwalktype1(Curfn.Type.Recvs(), &xoffset, bv)
}
if Curfn.Type.Intuple > 0 {
// If the receiver or arguments are unnamed, they will be omitted
// from the list above. Preserve those values - even though they are unused -
// in order to keep their addresses live for use in stack traces.
- thisargtype := lv.fn.Type.Recv()
+ thisargtype := lv.fn.Type.Recvs()
if thisargtype != nil {
xoffset = 0
if f.Type.Etype != TFUNC || f.Type.Thistuple == 0 {
Fatalf("non-method on %v method %v %v\n", mt, f.Sym, f)
}
- if f.Type.Recv0() == nil {
+ if f.Type.Recv() == nil {
Fatalf("receiver with no type on %v method %v %v\n", mt, f.Sym, f)
}
if f.Nointerface {
// if pointer receiver but non-pointer t and
// this is not an embedded pointer inside a struct,
// method does not apply.
- this := f.Type.Recv0().Type
+ this := f.Type.Recv().Type
if Isptr[this.Etype] && this.Type == t {
continue
ot = dextratype(s, ot, t, 0)
case TFUNC:
- for t1, it := IterFields(t.Recv()); t1 != nil; t1 = it.Next() {
+ for t1, it := IterFields(t.Recvs()); t1 != nil; t1 = it.Next() {
dtypesym(t1.Type)
}
isddd := false
ot = dextratype(s, ot, t, dataAdd)
// Array of rtype pointers follows funcType.
- for t1, it := IterFields(t.Recv()); t1 != nil; t1 = it.Next() {
+ for t1, it := IterFields(t.Recvs()); t1 != nil; t1 = it.Next() {
ot = dsymptr(s, ot, dtypesym(t1.Type), 0)
}
for t1, it := IterFields(t.Params()); t1 != nil; t1 = it.Next() {
// Loop over structs: receiver, in, out.
case TFUNC:
- for _, f := range recvParamsResults {
+ for _, f := range recvsParamsResults {
// Loop over fields in structs, ignoring argument names.
ta, ia := IterFields(f(t1))
tb, ib := IterFields(f(t2))
continue
case TFUNC:
- substAny(t.RecvP(), types)
+ substAny(t.RecvsP(), types)
substAny(t.ParamsP(), types)
substAny(t.ResultsP(), types)
case TFUNC:
nt = t.Copy()
- *nt.RecvP() = deep(t.Recv())
+ *nt.RecvsP() = deep(t.Recvs())
*nt.ResultsP() = deep(t.Results())
*nt.ParamsP() = deep(t.Params())
isddd = n.Left.Isddd
}
- methodrcvr := method.Type.Recv0().Type
+ methodrcvr := method.Type.Recv().Type
// generate nil pointer check for better error
if Isptr[rcvr.Etype] && rcvr.Type == methodrcvr {
// if pointer receiver in method,
// the method does not exist for value types.
- rcvr = tm.Type.Recv0().Type
+ rcvr = tm.Type.Recv().Type
if Isptr[rcvr.Etype] && !Isptr[t0.Etype] && !followptr && !isifacemethod(tm.Type) {
if false && Debug['r'] != 0 {
}
}
-func (t *Type) RecvP() **Type {
+func (t *Type) RecvsP() **Type {
t.wantEtype(TFUNC)
return &t.Type
}
return &t.Type.Down
}
-func (t *Type) Recv() *Type { return *t.RecvP() }
+func (t *Type) Recvs() *Type { return *t.RecvsP() }
func (t *Type) Params() *Type { return *t.ParamsP() }
func (t *Type) Results() *Type { return *t.ResultsP() }
-// TODO(mdempsky): Rename Recv to Recvs, so Recv0 can become just Recv.
-func (t *Type) Recv0() *Type { return t.Recv().Field(0) }
+func (t *Type) Recv() *Type { return t.Recvs().Field(0) }
-// recvParamsResults stores the accessor functions for a function Type's
+// recvsParamsResults stores the accessor functions for a function Type's
// receiver, parameters, and result parameters, in that order.
// It can be used to iterate over all of a function's parameter lists.
-var recvParamsResults = [3]func(*Type) *Type{
- (*Type).Recv, (*Type).Params, (*Type).Results,
+var recvsParamsResults = [3]func(*Type) *Type{
+ (*Type).Recvs, (*Type).Params, (*Type).Results,
}
// Field returns the i'th field/method of struct/interface type t.
return ssa.CMPeq
case TFUNC:
- for _, f := range recvParamsResults {
+ for _, f := range recvsParamsResults {
// Loop over fields in structs, ignoring argument names.
ta, ia := IterFields(f(t))
tb, ib := IterFields(f(x))
// information further down the call chain to know if we
// were testing a method receiver for unexported fields.
// It isn't necessary, so just do a sanity check.
- tp := t.Recv0().Type
+ tp := t.Recv().Type
if l.Left == nil || !Eqtype(l.Left.Type, tp) {
Fatalf("method receiver")
}
// disallow T.m if m requires *T receiver
- if Isptr[f2.Type.Recv0().Type.Etype] && !Isptr[t.Etype] && f2.Embedded != 2 && !isifacemethod(f2.Type) {
+ if Isptr[f2.Type.Recv().Type.Etype] && !Isptr[t.Etype] && f2.Embedded != 2 && !isifacemethod(f2.Type) {
Yyerror("invalid method expression %v (needs pointer receiver: (*%v).%v)", n, t, Sconv(f2.Sym, obj.FmtShort))
return false
}
}
tt := n.Left.Type
dowidth(tt)
- rcvr := f2.Type.Recv0().Type
+ rcvr := f2.Type.Recv().Type
if !Eqtype(rcvr, tt) {
if rcvr.Etype == Tptr && Eqtype(rcvr.Type, tt) {
checklvalue(n.Left, "call pointer method on")
}
n.Type = t
t.Nname = n.Func.Nname
- rcvr := t.Recv0()
+ rcvr := t.Recv()
if rcvr != nil && n.Func.Shortname != nil {
addmethod(n.Func.Shortname.Sym, t, true, n.Func.Nname.Nointerface)
}
}
walkexpr(&n.Left, init)
walkexprlist(n.List.Slice(), init)
- ll := ascompatte(n.Op, n, false, t.Recv(), []*Node{n.Left.Left}, 0, init)
+ ll := ascompatte(n.Op, n, false, t.Recvs(), []*Node{n.Left.Left}, 0, init)
lr := ascompatte(n.Op, n, n.Isddd, t.Params(), n.List.Slice(), 0, init)
ll = append(ll, lr...)
n.Left.Left = nil
func heapmoves() {
lno := lineno
lineno = Curfn.Lineno
- nn := paramstoheap(Curfn.Type.Recv(), false)
+ nn := paramstoheap(Curfn.Type.Recvs(), false)
nn = append(nn, paramstoheap(Curfn.Type.Params(), false)...)
nn = append(nn, paramstoheap(Curfn.Type.Results(), true)...)
Curfn.Func.Enter.Append(nn...)