1
0
mirror of https://github.com/golang/go synced 2024-11-24 10:00:12 -07:00

cmd/compile: simplify code in walkPrint

Use typecheck.Conv; it does the same thing.

Change-Id: I6bf27b8e929f8016ffc8350931c8320e36584a3d
Reviewed-on: https://go-review.googlesource.com/c/go/+/354350
Trust: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
This commit is contained in:
Josh Bleecher Snyder 2021-10-06 13:16:02 -07:00
parent 197b32817b
commit 2e107b43c7

View File

@ -622,10 +622,7 @@ func walkPrint(nn *ir.CallExpr, init *ir.Nodes) ir.Node {
r := ir.NewCallExpr(base.Pos, ir.OCALL, on, nil)
if params := on.Type().Params().FieldSlice(); len(params) > 0 {
t := params[0].Type
if !types.Identical(t, n.Type()) {
n = ir.NewConvExpr(base.Pos, ir.OCONV, nil, n)
n.SetType(t)
}
n = typecheck.Conv(n, t)
r.Args.Append(n)
}
calls = append(calls, r)