From eb6a07fcf99050c447097a8ff6358c484c0f8715 Mon Sep 17 00:00:00 2001 From: Matthew Dempsky Date: Thu, 26 Aug 2021 12:05:45 -0700 Subject: cmd/compile: unexport Type.Vargen This field is only used outside of packages types in two places, and they follow the same pattern. So this CL creates a Type.Setvargen function that they can use instead, so that Type.Vargen can be unexported. A bit clumsy, but it works for now. Change-Id: I7b4f33fac635e2464df2fbc0607ab40902f6f09f Reviewed-on: https://go-review.googlesource.com/c/go/+/345469 Trust: Matthew Dempsky Run-TryBot: Matthew Dempsky Reviewed-by: Cuong Manh Le TryBot-Result: Go Bot --- src/cmd/compile/internal/typecheck/typecheck.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'src/cmd/compile/internal/typecheck/typecheck.go') diff --git a/src/cmd/compile/internal/typecheck/typecheck.go b/src/cmd/compile/internal/typecheck/typecheck.go index db1b11c4cf..404af5b1b2 100644 --- a/src/cmd/compile/internal/typecheck/typecheck.go +++ b/src/cmd/compile/internal/typecheck/typecheck.go @@ -1736,11 +1736,6 @@ func CheckMapKeys() { mapqueue = nil } -// TypeGen tracks the number of function-scoped defined types that -// have been declared. It's used to generate unique linker symbols for -// their runtime type descriptors. -var TypeGen int32 - func typecheckdeftype(n *ir.Name) { if base.EnableTrace && base.Flag.LowerT { defer tracePrint("typecheckdeftype", n)(nil) @@ -1748,8 +1743,7 @@ func typecheckdeftype(n *ir.Name) { t := types.NewNamed(n) if n.Curfn != nil { - TypeGen++ - t.Vargen = TypeGen + t.SetVargen() } if n.Pragma()&ir.NotInHeap != 0 { -- cgit v1.2.3-54-g00ecf