mirror of
https://github.com/golang/go
synced 2024-11-24 12:50:11 -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:
parent
197b32817b
commit
2e107b43c7
@ -622,10 +622,7 @@ func walkPrint(nn *ir.CallExpr, init *ir.Nodes) ir.Node {
|
|||||||
r := ir.NewCallExpr(base.Pos, ir.OCALL, on, nil)
|
r := ir.NewCallExpr(base.Pos, ir.OCALL, on, nil)
|
||||||
if params := on.Type().Params().FieldSlice(); len(params) > 0 {
|
if params := on.Type().Params().FieldSlice(); len(params) > 0 {
|
||||||
t := params[0].Type
|
t := params[0].Type
|
||||||
if !types.Identical(t, n.Type()) {
|
n = typecheck.Conv(n, t)
|
||||||
n = ir.NewConvExpr(base.Pos, ir.OCONV, nil, n)
|
|
||||||
n.SetType(t)
|
|
||||||
}
|
|
||||||
r.Args.Append(n)
|
r.Args.Append(n)
|
||||||
}
|
}
|
||||||
calls = append(calls, r)
|
calls = append(calls, r)
|
||||||
|
Loading…
Reference in New Issue
Block a user