func (n *Name) doChildren(do func(Node) bool) bool { return false }
func (n *Name) editChildren(edit func(Node) Node) {}
-// CloneName makes a cloned copy of the name.
-// It's not ir.Copy(n) because in general that operation is a mistake on names,
-// which uniquely identify variables.
-// Callers must use n.CloneName to make clear they intend to create a separate name.
-func (n *Name) CloneName() *Name { c := *n; return &c }
-
// TypeDefn returns the type definition for a named OTYPE.
// That is, given "type T Defn", it returns Defn.
// It is used by package types.
// The result of SubstArgTypes MUST be assigned back to old, e.g.
// n.Left = SubstArgTypes(n.Left, t1, t2)
func SubstArgTypes(old *ir.Name, types_ ...*types.Type) *ir.Name {
- n := old.CloneName()
-
for _, t := range types_ {
types.CalcSize(t)
}
- n.SetType(types.SubstAny(n.Type(), &types_))
+ n := ir.NewNameAt(old.Pos(), old.Sym())
+ n.Class_ = old.Class()
+ n.SetType(types.SubstAny(old.Type(), &types_))
if len(types_) > 0 {
base.Fatalf("substArgTypes: too many argument types")
}