]> Cypherpunks repositories - gostls13.git/commitdiff
go/types, types2: remove unused argument from Checker.updateExprType0
authorRobert Griesemer <gri@golang.org>
Thu, 5 Sep 2024 21:40:24 +0000 (14:40 -0700)
committerGopher Robot <gobot@golang.org>
Thu, 5 Sep 2024 22:12:16 +0000 (22:12 +0000)
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>

src/cmd/compile/internal/types2/expr.go
src/go/types/expr.go

index 0c642655327404b0b8882694dfc478a466d50f22..72f0efbfdef275786a0b3dd20d0ded8f97ec8259 100644 (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:
index 159dfdf4cf95717e60fd937eb21fa0652b7cc684..4f17ebbc4fdeed1fc875de9c65ce30bf381a98ed 100644 (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: