mirror of
https://github.com/golang/go
synced 2024-11-23 01:20:02 -07:00
go/types, types2: be deliberate with Checker.use in Checker.assignVar
Follow-up on comment in CL 486135. Cleanup. Change-Id: Ib0480d52e30687350f8328965c18fa83262df0a3 Reviewed-on: https://go-review.googlesource.com/c/go/+/486215 Run-TryBot: Robert Griesemer <gri@google.com> Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Robert Griesemer <gri@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Robert Findley <rfindley@google.com>
This commit is contained in:
parent
969ab34e46
commit
522eace4ca
@ -235,9 +235,10 @@ func (check *Checker) lhsVar(lhs syntax.Expr) Type {
|
||||
func (check *Checker) assignVar(lhs, rhs syntax.Expr, x *operand) {
|
||||
T := check.lhsVar(lhs) // nil if lhs is _
|
||||
if T == Typ[Invalid] {
|
||||
check.use(rhs)
|
||||
if x != nil {
|
||||
x.mode = invalid
|
||||
} else {
|
||||
check.use(rhs)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -234,9 +234,10 @@ func (check *Checker) lhsVar(lhs ast.Expr) Type {
|
||||
func (check *Checker) assignVar(lhs, rhs ast.Expr, x *operand) {
|
||||
T := check.lhsVar(lhs) // nil if lhs is _
|
||||
if T == Typ[Invalid] {
|
||||
check.use(rhs)
|
||||
if x != nil {
|
||||
x.mode = invalid
|
||||
} else {
|
||||
check.use(rhs)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user