}
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)
n2.PtrInit().Append(as)
ok = tmp
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.
// The caller should order the right-hand side of the assignment before calling order.as2.
// It rewrites,
n.List().SetFirst(tmp1)
}
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)
o.mapAssign(r)
n.List().SetSecond(tmp2)