cgen: omit "x ~mod+= y ~mod* 0"

This commit is contained in:
Nigel Tao committed 2026-06-19 20:28:56 +10:00
1 parent 1f3df26c7f
commit 40f39a3ba3
5 files changed
+22 -235

No files matched your search

+7
View File
@@ -127,6 +127,13 @@ func (g *gen) writeStatementAssign1(b *buffer, op t.ID, lhs *a.Expr, rhs *a.Expr
lhsBuf := buffer(nil)
opName, closer, disableWconversion := "", "", false
switch op {
case t.IDPlusEq, t.IDMinusEq, t.IDTildeModPlusEq, t.IDTildeModMinusEq:
if rhs.MBounds().IsJustZero() {
return nil
}
}
if lhs != nil {
if err := g.writeExpr(&lhsBuf, lhs, false, 0); err != nil {
return err