mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func methodname(n, recv *Node) *Node {
|
func methodname(s *Sym, recv *Node) *Node {
|
||||||
star := false
|
star := false
|
||||||
if recv.Op == OIND {
|
if recv.Op == OIND {
|
||||||
star = true
|
star = true
|
||||||
recv = recv.Left
|
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 {
|
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)
|
s1 := Pkglookup(s.Name+"·f", s.Pkg)
|
||||||
if !Ctxt.Flag_dynlink && s1.Def == nil {
|
if !Ctxt.Flag_dynlink && s1.Def == nil {
|
||||||
s1.Def = newfuncname(s1)
|
s1.Def = newfuncname(s1)
|
||||||
s1.Def.Func.Shortname = newname(s)
|
s1.Def.Func.Shortname = s
|
||||||
funcsyms = append(funcsyms, s1.Def)
|
funcsyms = append(funcsyms, s1.Def)
|
||||||
}
|
}
|
||||||
s.Fsym = s1
|
s.Fsym = s1
|
||||||
|
|
@ -1336,7 +1336,7 @@ func makefuncsym(s *Sym) {
|
||||||
}
|
}
|
||||||
s1 := funcsym(s)
|
s1 := funcsym(s)
|
||||||
s1.Def = newfuncname(s1)
|
s1.Def = newfuncname(s1)
|
||||||
s1.Def.Func.Shortname = newname(s)
|
s1.Def.Func.Shortname = s
|
||||||
funcsyms = append(funcsyms, s1.Def)
|
funcsyms = append(funcsyms, s1.Def)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -252,7 +252,7 @@ func (p *noder) funcHeader(fun *syntax.FuncDecl) *Node {
|
||||||
} else {
|
} else {
|
||||||
// Receiver MethodName Signature
|
// Receiver MethodName Signature
|
||||||
|
|
||||||
f.Func.Shortname = newfuncname(name)
|
f.Func.Shortname = name
|
||||||
f.Func.Nname = methodname(f.Func.Shortname, t.Left.Right)
|
f.Func.Nname = methodname(f.Func.Shortname, t.Left.Right)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -213,7 +213,7 @@ func dumpglobls() {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, n := range funcsyms {
|
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)
|
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.
|
// Func holds Node fields used only with function-like nodes.
|
||||||
type Func struct {
|
type Func struct {
|
||||||
Shortname *Node
|
Shortname *Sym
|
||||||
Enter Nodes // for example, allocate and initialize memory for escaping parameters
|
Enter Nodes // for example, allocate and initialize memory for escaping parameters
|
||||||
Exit Nodes
|
Exit Nodes
|
||||||
Cvars Nodes // closure params
|
Cvars Nodes // closure params
|
||||||
|
|
|
||||||
|
|
@ -3436,7 +3436,7 @@ func typecheckfunc(n *Node) {
|
||||||
t.SetNname(n.Func.Nname)
|
t.SetNname(n.Func.Nname)
|
||||||
rcvr := t.Recv()
|
rcvr := t.Recv()
|
||||||
if rcvr != nil && n.Func.Shortname != nil {
|
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…
Add table
Add a link
Reference in a new issue