[dev.typeparams] cmd/compile: use nil instead of syntax.ImplicitOne

Represent x++/-- as x +=/-= with the RHS of the assignment being nil
rather than syntax.ImplicitOne.

Dependent code already had to check for syntax.ImplicitOne, but
then shared some existing code for regular assignment operations.
Now always handle this case fully explicit, which simplifies the
code.

Change-Id: I28c7918153c27cbbf97b041d0c85ff027c58687c
Reviewed-on: https://go-review.googlesource.com/c/go/+/285172
Trust: Robert Griesemer <gri@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Robert Griesemer 2021-01-20 17:03:36 -08:00
parent 2427f6e6c0
commit 18bd7aa625
10 changed files with 48 additions and 53 deletions

View file

@ -19,10 +19,6 @@ func (g *irgen) expr(expr syntax.Expr) ir.Node {
return nil
}
if expr == syntax.ImplicitOne {
base.Fatalf("expr of ImplicitOne")
}
if expr, ok := expr.(*syntax.Name); ok && expr.Value == "_" {
return ir.BlankNode
}