1
0
mirror of https://github.com/golang/go synced 2024-11-11 20:50:23 -07:00

[dev.regabi] cmd/compile: remove okAs

The check for blank in okAs is redundant with what its callers already
done, so just inline the conversion in callers side instead.

Passes toolstash-check.

Change-Id: I606105e2d2cf8e80214722a13c3101c464d20d82
Reviewed-on: https://go-review.googlesource.com/c/go/+/274793
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Cuong Manh Le 2020-12-02 14:40:48 +07:00
parent 5a3b6796cd
commit 00e5727790

View File

@ -936,7 +936,7 @@ func (o *Order) stmt(n ir.Node) {
} }
tmp := o.newTemp(types.Types[types.TBOOL], false) tmp := o.newTemp(types.Types[types.TBOOL], false)
as := okas(ok, tmp) as := ir.Nod(ir.OAS, ok, conv(tmp, ok.Type()))
as = typecheck(as, ctxStmt) as = typecheck(as, ctxStmt)
n2.PtrInit().Append(as) n2.PtrInit().Append(as)
ok = tmp ok = tmp
@ -1382,15 +1382,6 @@ func (o *Order) expr(n, lhs ir.Node) ir.Node {
return n return n
} }
// okas creates and returns an assignment of val to ok,
// including an explicit conversion if necessary.
func okas(ok, val ir.Node) ir.Node {
if !ir.IsBlank(ok) {
val = conv(val, ok.Type())
}
return ir.Nod(ir.OAS, ok, val)
}
// as2 orders OAS2XXXX nodes. It creates temporaries to ensure left-to-right assignment. // as2 orders OAS2XXXX nodes. It creates temporaries to ensure left-to-right assignment.
// The caller should order the right-hand side of the assignment before calling order.as2. // The caller should order the right-hand side of the assignment before calling order.as2.
// It rewrites, // It rewrites,
@ -1442,7 +1433,7 @@ func (o *Order) okAs2(n ir.Node) {
n.List().SetFirst(tmp1) n.List().SetFirst(tmp1)
} }
if tmp2 != nil { if tmp2 != nil {
r := okas(n.List().Second(), tmp2) r := ir.Nod(ir.OAS, n.List().Second(), conv(tmp2, n.List().Second().Type()))
r = typecheck(r, ctxStmt) r = typecheck(r, ctxStmt)
o.mapAssign(r) o.mapAssign(r)
n.List().SetSecond(tmp2) n.List().SetSecond(tmp2)