pos := base.AutogeneratedPos
fn := r.newWrapperFunc(pos, sym, nil, method)
- sym.Def = fn
+ sym.Def = fn.Nname
// Declare and initialize variable holding receiver.
recv := ir.NewHiddenParam(pos, fn, typecheck.Lookup(".this"), recvType)
clos := ir.NewCompLitExpr(base.Pos, ir.OCOMPLIT, ir.TypeNode(typ), nil)
clos.SetEsc(n.Esc())
- clos.List = []ir.Node{ir.NewUnaryExpr(base.Pos, ir.OCFUNC, methodValueWrapper(n).Nname), n.X}
+ clos.List = []ir.Node{ir.NewUnaryExpr(base.Pos, ir.OCFUNC, methodValueWrapper(n)), n.X}
addr := typecheck.NodAddr(clos)
addr.SetEsc(n.Esc())
return walkExpr(cfn, init)
}
-// methodValueWrapper returns the DCLFUNC node representing the
+// methodValueWrapper returns the ONAME node representing the
// wrapper function (*-fm) needed for the given method value. If the
// wrapper function hasn't already been created yet, it's created and
// added to typecheck.Target.Decls.
-func methodValueWrapper(dot *ir.SelectorExpr) *ir.Func {
+func methodValueWrapper(dot *ir.SelectorExpr) *ir.Name {
if dot.Op() != ir.OMETHVALUE {
base.Fatalf("methodValueWrapper: unexpected %v (%v)", dot, dot.Op())
}
sym := ir.MethodSymSuffix(rcvrtype, meth, "-fm")
if sym.Uniq() {
- return sym.Def.(*ir.Func)
+ return sym.Def.(*ir.Name)
}
sym.SetUniq(true)
// typecheckslice() requires that Curfn is set when processing an ORETURN.
ir.CurFunc = fn
typecheck.Stmts(fn.Body)
- sym.Def = fn
+ sym.Def = fn.Nname
typecheck.Target.Decls = append(typecheck.Target.Decls, fn)
ir.CurFunc = savecurfn
base.Pos = saveLineNo
- return fn
+ return fn.Nname
}