mirror of
https://github.com/golang/go
synced 2024-11-08 02:36:18 -07:00
cmd/compile: skip diag error in checkassign if one was emitted
While at it, also remove checkassignlist, which is not used. For #43311 Change-Id: Ie7ed81f68080d8881fca6035da64a9755f2cb555 Reviewed-on: https://go-review.googlesource.com/c/go/+/294032 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:
parent
12a405b96a
commit
8c22874e4e
@ -1612,6 +1612,10 @@ func checkassign(stmt ir.Node, n ir.Node) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
defer n.SetType(nil)
|
||||||
|
if n.Diag() {
|
||||||
|
return
|
||||||
|
}
|
||||||
switch {
|
switch {
|
||||||
case n.Op() == ir.ODOT && n.(*ir.SelectorExpr).X.Op() == ir.OINDEXMAP:
|
case n.Op() == ir.ODOT && n.(*ir.SelectorExpr).X.Op() == ir.OINDEXMAP:
|
||||||
base.Errorf("cannot assign to struct field %v in map", n)
|
base.Errorf("cannot assign to struct field %v in map", n)
|
||||||
@ -1622,13 +1626,6 @@ func checkassign(stmt ir.Node, n ir.Node) {
|
|||||||
default:
|
default:
|
||||||
base.Errorf("cannot assign to %v", n)
|
base.Errorf("cannot assign to %v", n)
|
||||||
}
|
}
|
||||||
n.SetType(nil)
|
|
||||||
}
|
|
||||||
|
|
||||||
func checkassignlist(stmt ir.Node, l ir.Nodes) {
|
|
||||||
for _, n := range l {
|
|
||||||
checkassign(stmt, n)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkassignto(src *types.Type, dst ir.Node) {
|
func checkassignto(src *types.Type, dst ir.Node) {
|
||||||
|
Loading…
Reference in New Issue
Block a user