go/types, types2: remove unused argument from Checker.updateExprType0

With Checker.updateExprType0 and Checker.updateExprType being the
same now, rename updateExprType0 to updateExprType and remove the
old updateExprType.

Change-Id: Ib5c3d74e7fac9cedcc87ad521b7543b8d7f83943
Reviewed-on: https://go-review.googlesource.com/c/go/+/611276
Reviewed-by: Tim King <taking@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Robert Griesemer <gri@google.com>
This commit is contained in:
Robert Griesemer 2024-09-05 14:40:24 -07:00 committed by Gopher Robot
parent e4f9cb5f77
commit 9e621c3ae0
2 changed files with 11 additions and 19 deletions

View file

@ -238,10 +238,6 @@ func isComparison(op syntax.Operator) bool {
// and if x is the (formerly untyped) lhs operand of a non-constant
// shift, it must be an integer value.
func (check *Checker) updateExprType(x syntax.Expr, typ Type, final bool) {
check.updateExprType0(nil, x, typ, final)
}
func (check *Checker) updateExprType0(parent, x syntax.Expr, typ Type, final bool) {
old, found := check.untyped[x]
if !found {
return // nothing to do
@ -284,7 +280,7 @@ func (check *Checker) updateExprType0(parent, x syntax.Expr, typ Type, final boo
// No operands to take care of.
case *syntax.ParenExpr:
check.updateExprType0(x, x.X, typ, final)
check.updateExprType(x.X, typ, final)
// case *syntax.UnaryExpr:
// // If x is a constant, the operands were constants.
@ -295,7 +291,7 @@ func (check *Checker) updateExprType0(parent, x syntax.Expr, typ Type, final boo
// if old.val != nil {
// break
// }
// check.updateExprType0(x, x.X, typ, final)
// check.updateExprType(x.X, typ, final)
case *syntax.Operation:
if x.Y == nil {
@ -316,7 +312,7 @@ func (check *Checker) updateExprType0(parent, x syntax.Expr, typ Type, final boo
if old.val != nil {
break
}
check.updateExprType0(x, x.X, typ, final)
check.updateExprType(x.X, typ, final)
break
}
@ -330,11 +326,11 @@ func (check *Checker) updateExprType0(parent, x syntax.Expr, typ Type, final boo
} else if isShift(x.Op) {
// The result type depends only on lhs operand.
// The rhs type was updated when checking the shift.
check.updateExprType0(x, x.X, typ, final)
check.updateExprType(x.X, typ, final)
} else {
// The operand types match the result type.
check.updateExprType0(x, x.X, typ, final)
check.updateExprType0(x, x.Y, typ, final)
check.updateExprType(x.X, typ, final)
check.updateExprType(x.Y, typ, final)
}
default:

View file

@ -239,10 +239,6 @@ func isComparison(op token.Token) bool {
// and if x is the (formerly untyped) lhs operand of a non-constant
// shift, it must be an integer value.
func (check *Checker) updateExprType(x ast.Expr, typ Type, final bool) {
check.updateExprType0(nil, x, typ, final)
}
func (check *Checker) updateExprType0(parent, x ast.Expr, typ Type, final bool) {
old, found := check.untyped[x]
if !found {
return // nothing to do
@ -284,7 +280,7 @@ func (check *Checker) updateExprType0(parent, x ast.Expr, typ Type, final bool)
// No operands to take care of.
case *ast.ParenExpr:
check.updateExprType0(x, x.X, typ, final)
check.updateExprType(x.X, typ, final)
case *ast.UnaryExpr:
// If x is a constant, the operands were constants.
@ -295,7 +291,7 @@ func (check *Checker) updateExprType0(parent, x ast.Expr, typ Type, final bool)
if old.val != nil {
break
}
check.updateExprType0(x, x.X, typ, final)
check.updateExprType(x.X, typ, final)
case *ast.BinaryExpr:
if old.val != nil {
@ -307,11 +303,11 @@ func (check *Checker) updateExprType0(parent, x ast.Expr, typ Type, final bool)
} else if isShift(x.Op) {
// The result type depends only on lhs operand.
// The rhs type was updated when checking the shift.
check.updateExprType0(x, x.X, typ, final)
check.updateExprType(x.X, typ, final)
} else {
// The operand types match the result type.
check.updateExprType0(x, x.X, typ, final)
check.updateExprType0(x, x.Y, typ, final)
check.updateExprType(x.X, typ, final)
check.updateExprType(x.Y, typ, final)
}
default: