Recreated manually to push below some CLs it depended on.
Change-Id: I1b3316fcdce39cbb33e5cbb471f5cd1cd2efc1f5
Reviewed-on: https://go-review.googlesource.com/c/go/+/274599
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
// n.Left = inlconv2expr(n.Left)
func inlconv2expr(n ir.Node) ir.Node {
r := n.Rlist().First()
- return addinit(r, append(n.Init().Slice(), n.Body().Slice()...))
+ return initExpr(append(n.Init().Slice(), n.Body().Slice()...), r)
}
// Turn the rlist (with the return values) of the OINLCALL in
}
s := n.Rlist().Slice()
- s[0] = addinit(s[0], append(n.Init().Slice(), n.Body().Slice()...))
+ s[0] = initExpr(append(n.Init().Slice(), n.Body().Slice()...), s[0])
return s
}
var order Order
order.free = o.free
n = order.expr(n, nil)
- n = addinit(n, order.out)
+ n = initExpr(order.out, n)
// insert new temporaries from order
// at head of outer list.
return nil
}
-// The result of addinit MUST be assigned back to n, e.g.
-// n.Left = addinit(n.Left, init)
-func addinit(n ir.Node, init []ir.Node) ir.Node {
+// The result of initExpr MUST be assigned back to n, e.g.
+// n.Left = initExpr(init, n.Left)
+func initExpr(init []ir.Node, n ir.Node) ir.Node {
if len(init) == 0 {
return n
}
}
old := n
n = ir.NodAt(n.Pos(), l.SubOp(), arg, nil)
- n = addinit(n, old.Init().Slice()) // typecheckargs can add to old.Init
+ n = initExpr(old.Init().Slice(), n) // typecheckargs can add to old.Init
case ir.OCOMPLEX, ir.OCOPY:
typecheckargs(n)
}
old := n
n = ir.NodAt(n.Pos(), l.SubOp(), arg1, arg2)
- n = addinit(n, old.Init().Slice()) // typecheckargs can add to old.Init
+ n = initExpr(old.Init().Slice(), n) // typecheckargs can add to old.Init
}
n = typecheck1(n, top)
return n
n = mkcall1(chanfn("chanrecv1", 2, n.Left().Type()), nil, &init, n.Left(), nodnil())
n = walkexpr(n, &init)
- n = addinit(n, init.Slice())
+ n = initExpr(init.Slice(), n)
case ir.OBREAK,
ir.OCONTINUE,
init := n.Left().Init()
n.Left().PtrInit().Set(nil)
n.SetLeft(walkexpr(n.Left(), &init))
- n.SetLeft(addinit(n.Left(), init.Slice()))
+ n.SetLeft(initExpr(init.Slice(), n.Left()))
}
n.SetRight(walkstmt(n.Right()))
var ll ir.Nodes
n.SetRight(walkexpr(n.Right(), &ll))
- n.SetRight(addinit(n.Right(), ll.Slice()))
+ n.SetRight(initExpr(ll.Slice(), n.Right()))
case ir.OPRINT, ir.OPRINTN:
n = walkprint(n, init)