newfn.Nname = ir.NewNameAt(oldfn.Nname.Pos(), oldfn.Nname.Sym())
// XXX OK to share fn.Type() ??
newfn.Nname.SetType(oldfn.Nname.Type())
- newfn.Nname.Ntype = inlcopy(oldfn.Nname.Ntype).(ir.Ntype)
+ // Ntype can be nil for -G=3 mode.
+ if oldfn.Nname.Ntype != nil {
+ newfn.Nname.Ntype = inlcopy(oldfn.Nname.Ntype).(ir.Ntype)
+ }
newfn.Body = inlcopylist(oldfn.Body)
// Make shallow copy of the Dcl and ClosureVar slices
newfn.Dcl = append([]*ir.Name(nil), oldfn.Dcl...)
newfn.SetIsHiddenClosure(true)
newfn.Nname = ir.NewNameAt(n.Pos(), ir.BlankNode.Sym())
newfn.Nname.Func = newfn
- newfn.Nname.Ntype = subst.node(oldfn.Nname.Ntype).(ir.Ntype)
+ // Ntype can be nil for -G=3 mode.
+ if oldfn.Nname.Ntype != nil {
+ newfn.Nname.Ntype = subst.node(oldfn.Nname.Ntype).(ir.Ntype)
+ }
newfn.Nname.Defn = newfn
m.(*ir.ClosureExpr).Func = newfn
typ := g.typ(typ2)
fn.Nname.Func = fn
fn.Nname.Defn = fn
- // Set Ntype for now to be compatible with later parts of compile, remove later.
- fn.Nname.Ntype = ir.TypeNode(typ)
typed(typ, fn.Nname)
fn.SetTypecheck(1)
sym.SetFunc(true)
}
- // We already know name's type, but typecheck is really eager to try
- // recomputing it later. This appears to prevent that at least.
- name.Ntype = ir.TypeNode(typ)
name.SetTypecheck(1)
name.SetWalkdef(1)
subst.fields(ir.PPARAM, append(oldt.Recvs().FieldSlice(), oldt.Params().FieldSlice()...), newf.Dcl),
subst.fields(ir.PPARAMOUT, oldt.Results().FieldSlice(), newf.Dcl))
- newf.Nname.Ntype = ir.TypeNode(newt)
newf.Nname.SetType(newt)
ir.MarkFunc(newf.Nname)
newf.SetTypecheck(1)
case ir.OCLOSURE:
x := x.(*ir.ClosureExpr)
- // Need to save/duplicate x.Func.Nname,
- // x.Func.Nname.Ntype, x.Func.Dcl, x.Func.ClosureVars, and
+ // Need to duplicate x.Func.Nname, x.Func.Dcl, x.Func.ClosureVars, and
// x.Func.Body.
oldfn := x.Func
newfn := ir.NewFunc(oldfn.Pos())
newfn.Dcl = subst.namelist(oldfn.Dcl)
newfn.ClosureVars = subst.namelist(oldfn.ClosureVars)
- // Set Ntype for now to be compatible with later parts of compiler
- newfn.Nname.Ntype = subst.node(oldfn.Nname.Ntype).(ir.Ntype)
typed(subst.typ(oldfn.Nname.Type()), newfn.Nname)
typed(newfn.Nname.Type(), m)
newfn.SetTypecheck(1)