]> Cypherpunks repositories - gostls13.git/commitdiff
[dev.typealias] cmd/compile: change Func.Shortname to *Sym
authorMatthew Dempsky <mdempsky@google.com>
Mon, 23 Jan 2017 21:40:25 +0000 (13:40 -0800)
committerMatthew Dempsky <mdempsky@google.com>
Tue, 24 Jan 2017 01:34:14 +0000 (01:34 +0000)
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>
src/cmd/compile/internal/gc/dcl.go
src/cmd/compile/internal/gc/noder.go
src/cmd/compile/internal/gc/obj.go
src/cmd/compile/internal/gc/syntax.go
src/cmd/compile/internal/gc/typecheck.go

index f934a650bd747f8bc3e9ef9a34478c5d0e187666..a5c50f06dccacdacbb737a1c7ce0d85059b032de 100644 (file)
@@ -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)
 }
 
index 699015488a40e9340b47a4efc1de7a852224c431..0c5957f987c575f3367f89655fc3fdb703f11774 100644 (file)
@@ -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)
        }
 
index 08ed5604dadee55ac40c9b780f2b77de53f46c58..6d5f2aa208d229d92dd41f0f4e75432330653c90 100644 (file)
@@ -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)
        }
 
index 1955a0e42faaf7e543d098027059e5876c3c4092..0bd877e26ab23971731385080fea7065f93542cd 100644 (file)
@@ -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
index f18bcfad78d23b29348b51a34fb9f5d5fe4a582b..d7516107636eaf23ad2ac317ef2ac371e867913c 100644 (file)
@@ -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)
        }
 }