}
}
+// oaslit handles special composite literal assignments.
+// It returns true if n's effects have been added to init,
+// in which case n should be dropped from the program by the caller.
func oaslit(n ir.Node, init *ir.Nodes) bool {
if n.Left() == nil || n.Right() == nil {
// not a special composite literal assignment
anylit(n.Right(), n.Left(), init)
}
- n.SetOp(ir.OEMPTY)
- n.SetRight(nil)
return true
}
// Empty identifier is valid but useless.
// Eliminate now to simplify life later.
// See issues 7538, 11589, 11593.
- n.SetOp(ir.OEMPTY)
- n.SetLeft(nil)
+ n = ir.NodAt(n.Pos(), ir.OEMPTY, nil, nil)
}
case ir.ODEFER:
init := n.Init()
n.PtrInit().Set(nil)
n = walkexpr(n, &init)
- n = addinit(n, init.Slice())
- if wascopy && n.Op() == ir.OCONVNOP {
- n.SetOp(ir.OEMPTY) // don't leave plain values as statements.
+ if wascopy && n.Op() == ir.ONAME {
+ // copy rewrote to a statement list and a temp for the length.
+ // Throw away the temp to avoid plain values as statements.
+ n = ir.NodAt(n.Pos(), ir.OEMPTY, nil, nil)
}
+ n = addinit(n, init.Slice())
// special case for a receive where we throw away
// the value received.
}
if oaslit(n, init) {
+ n = ir.NodAt(n.Pos(), ir.OEMPTY, nil, nil)
break
}