mirror of
https://github.com/golang/go
synced 2024-11-02 11:50:30 +00:00
[dev.typealias] cmd/compile: change Func.Shortname to *Sym
A Func's Shortname is just an identifier. No need for an entire ONAME Node. Change-Id: Ie4d397e8d694c907fdf924ce57bd96bdb4aaabca Reviewed-on: https://go-review.googlesource.com/35574 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
parent
a7c884efc1
commit
5d92916770
5 changed files with 8 additions and 8 deletions
|
@ -1163,14 +1163,14 @@ bad:
|
|||
return nil
|
||||
}
|
||||
|
||||
func methodname(n, recv *Node) *Node {
|
||||
func methodname(s *Sym, recv *Node) *Node {
|
||||
star := false
|
||||
if recv.Op == OIND {
|
||||
star = true
|
||||
recv = recv.Left
|
||||
}
|
||||
|
||||
return methodname0(n.Sym, star, recv.Sym)
|
||||
return methodname0(s, star, recv.Sym)
|
||||
}
|
||||
|
||||
func methodname0(s *Sym, star bool, tsym *Sym) *Node {
|
||||
|
@ -1318,7 +1318,7 @@ func funcsym(s *Sym) *Sym {
|
|||
s1 := Pkglookup(s.Name+"·f", s.Pkg)
|
||||
if !Ctxt.Flag_dynlink && s1.Def == nil {
|
||||
s1.Def = newfuncname(s1)
|
||||
s1.Def.Func.Shortname = newname(s)
|
||||
s1.Def.Func.Shortname = s
|
||||
funcsyms = append(funcsyms, s1.Def)
|
||||
}
|
||||
s.Fsym = s1
|
||||
|
@ -1336,7 +1336,7 @@ func makefuncsym(s *Sym) {
|
|||
}
|
||||
s1 := funcsym(s)
|
||||
s1.Def = newfuncname(s1)
|
||||
s1.Def.Func.Shortname = newname(s)
|
||||
s1.Def.Func.Shortname = s
|
||||
funcsyms = append(funcsyms, s1.Def)
|
||||
}
|
||||
|
||||
|
|
|
@ -252,7 +252,7 @@ func (p *noder) funcHeader(fun *syntax.FuncDecl) *Node {
|
|||
} else {
|
||||
// Receiver MethodName Signature
|
||||
|
||||
f.Func.Shortname = newfuncname(name)
|
||||
f.Func.Shortname = name
|
||||
f.Func.Nname = methodname(f.Func.Shortname, t.Left.Right)
|
||||
}
|
||||
|
||||
|
|
|
@ -213,7 +213,7 @@ func dumpglobls() {
|
|||
}
|
||||
|
||||
for _, n := range funcsyms {
|
||||
dsymptr(n.Sym, 0, n.Sym.Def.Func.Shortname.Sym, 0)
|
||||
dsymptr(n.Sym, 0, n.Sym.Def.Func.Shortname, 0)
|
||||
ggloblsym(n.Sym, int32(Widthptr), obj.DUPOK|obj.RODATA)
|
||||
}
|
||||
|
||||
|
|
|
@ -289,7 +289,7 @@ type Param struct {
|
|||
|
||||
// Func holds Node fields used only with function-like nodes.
|
||||
type Func struct {
|
||||
Shortname *Node
|
||||
Shortname *Sym
|
||||
Enter Nodes // for example, allocate and initialize memory for escaping parameters
|
||||
Exit Nodes
|
||||
Cvars Nodes // closure params
|
||||
|
|
|
@ -3436,7 +3436,7 @@ func typecheckfunc(n *Node) {
|
|||
t.SetNname(n.Func.Nname)
|
||||
rcvr := t.Recv()
|
||||
if rcvr != nil && n.Func.Shortname != nil {
|
||||
addmethod(n.Func.Shortname.Sym, t, true, n.Func.Pragma&Nointerface != 0)
|
||||
addmethod(n.Func.Shortname, t, true, n.Func.Pragma&Nointerface != 0)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue