Commit 93471a13 authored by Matthew Dempsky's avatar Matthew Dempsky

cmd/compile: merge tempnamel into tempAt

Passes toolstash-check.

Change-Id: I01ed1c04be5a23756742d461f13f1e587ea7ecb8
Reviewed-on: https://go-review.googlesource.com/59610
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: default avatarJosh Bleecher Snyder <josharian@gmail.com>
parent 2dd1f87d
...@@ -39,7 +39,7 @@ func autotmpname(n int) string { ...@@ -39,7 +39,7 @@ func autotmpname(n int) string {
} }
// make a new Node off the books // make a new Node off the books
func tempnamel(pos src.XPos, curfn *Node, nn *Node, t *types.Type) { func tempAt(pos src.XPos, curfn *Node, t *types.Type) *Node {
if curfn == nil { if curfn == nil {
Fatalf("no curfn for tempname") Fatalf("no curfn for tempname")
} }
...@@ -61,23 +61,15 @@ func tempnamel(pos src.XPos, curfn *Node, nn *Node, t *types.Type) { ...@@ -61,23 +61,15 @@ func tempnamel(pos src.XPos, curfn *Node, nn *Node, t *types.Type) {
n.SetClass(PAUTO) n.SetClass(PAUTO)
n.Esc = EscNever n.Esc = EscNever
n.Name.Curfn = curfn n.Name.Curfn = curfn
n.Name.SetUsed(true)
n.Name.SetAutoTemp(true) n.Name.SetAutoTemp(true)
curfn.Func.Dcl = append(curfn.Func.Dcl, n) curfn.Func.Dcl = append(curfn.Func.Dcl, n)
dowidth(t) dowidth(t)
*nn = *n
}
func temp(t *types.Type) *Node {
var n Node
tempnamel(lineno, Curfn, &n, t)
asNode(n.Sym.Def).Name.SetUsed(true)
return n.Orig return n.Orig
} }
func tempAt(pos src.XPos, curfn *Node, t *types.Type) *Node { func temp(t *types.Type) *Node {
var n Node return tempAt(lineno, Curfn, t)
tempnamel(pos, curfn, &n, t)
asNode(n.Sym.Def).Name.SetUsed(true)
return n.Orig
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment