cmd/compile: add convnop helper function

Like the conv helper function but for creating OCONVNOP nodes
instead of OCONV nodes.

passes toolstash -cmp

Change-Id: Ib93ffe66590ebaa2b4fa552c81f1a2902e789d8e
Reviewed-on: https://go-review.googlesource.com/112597
Run-TryBot: Martin Möhrmann <moehrmann@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
This commit is contained in:
Martin Möhrmann 2018-05-10 13:25:39 +02:00
parent 9e2a04d5eb
commit c5d38b896d
5 changed files with 21 additions and 27 deletions

View file

@ -382,10 +382,7 @@ func walkclosure(clo *Node, init *Nodes) *Node {
clos.List.Set(append([]*Node{nod(OCFUNC, xfunc.Func.Nname, nil)}, clo.Func.Enter.Slice()...))
// Force type conversion from *struct to the func type.
clos = nod(OCONVNOP, clos, nil)
clos.Type = clo.Type
clos = typecheck(clos, Erv)
clos = convnop(clos, clo.Type)
// typecheck will insert a PTRLIT node under CONVNOP,
// tag it with escape analysis result.
@ -511,10 +508,7 @@ func walkpartialcall(n *Node, init *Nodes) *Node {
clos.List.Append(n.Left)
// Force type conversion from *struct to the func type.
clos = nod(OCONVNOP, clos, nil)
clos.Type = n.Type
clos = typecheck(clos, Erv)
clos = convnop(clos, n.Type)
// typecheck will insert a PTRLIT node under CONVNOP,
// tag it with escape analysis result.