mirror of
https://github.com/golang/go
synced 2024-11-26 07:47:57 -07:00
[dev.typeparams] cmd/compile: fix case where we were copying a raw Node
Replace the raw Node copy with the creation of a new node, and the copying of the needed flags and fields. Change-Id: I636bf228ba28c0d5dc25f8366d82379d86ecd731 Reviewed-on: https://go-review.googlesource.com/c/go/+/322189 Run-TryBot: Dan Scales <danscales@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Trust: Dan Scales <danscales@google.com>
This commit is contained in:
parent
5b1120fac7
commit
b18b2d372e
@ -1153,17 +1153,21 @@ func (subst *inlsubst) fields(oldt *types.Type) []*types.Field {
|
|||||||
// clovar creates a new ONAME node for a local variable or param of a closure
|
// clovar creates a new ONAME node for a local variable or param of a closure
|
||||||
// inside a function being inlined.
|
// inside a function being inlined.
|
||||||
func (subst *inlsubst) clovar(n *ir.Name) *ir.Name {
|
func (subst *inlsubst) clovar(n *ir.Name) *ir.Name {
|
||||||
// TODO(danscales): want to get rid of this shallow copy, with code like the
|
m := ir.NewNameAt(n.Pos(), n.Sym())
|
||||||
// following, but it is hard to copy all the necessary flags in a maintainable way.
|
m.Class = n.Class
|
||||||
// m := ir.NewNameAt(n.Pos(), n.Sym())
|
m.SetType(n.Type())
|
||||||
// m.Class = n.Class
|
m.SetTypecheck(1)
|
||||||
// m.SetType(n.Type())
|
if n.IsClosureVar() {
|
||||||
// m.SetTypecheck(1)
|
m.SetIsClosureVar(true)
|
||||||
//if n.IsClosureVar() {
|
}
|
||||||
// m.SetIsClosureVar(true)
|
if n.Addrtaken() {
|
||||||
//}
|
m.SetAddrtaken(true)
|
||||||
m := &ir.Name{}
|
}
|
||||||
*m = *n
|
if n.Used() {
|
||||||
|
m.SetUsed(true)
|
||||||
|
}
|
||||||
|
m.Defn = n.Defn
|
||||||
|
|
||||||
m.Curfn = subst.newclofn
|
m.Curfn = subst.newclofn
|
||||||
|
|
||||||
switch defn := n.Defn.(type) {
|
switch defn := n.Defn.(type) {
|
||||||
|
Loading…
Reference in New Issue
Block a user