From: Cuong Manh Le Date: Thu, 28 Apr 2022 18:20:38 +0000 (+0700) Subject: cmd/compile: remove inTypeCheckInl boolean X-Git-Tag: go1.19beta1~516 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=96a1ad298ad9e6a308c3b05c07e1b3bf53ac9cfe;p=gostls13.git cmd/compile: remove inTypeCheckInl boolean After CL 402974, we do not typecheck an inline body in ImportedBody anymore, thus the inTypeCheckInl check is un-necessary. Change-Id: Ia6154a57db507c3e00b67333f1e3b910a6de7d05 Reviewed-on: https://go-review.googlesource.com/c/go/+/402975 TryBot-Result: Gopher Robot Reviewed-by: Matthew Dempsky Run-TryBot: Cuong Manh Le Reviewed-by: Keith Randall Reviewed-by: Keith Randall Auto-Submit: Keith Randall --- diff --git a/src/cmd/compile/internal/typecheck/func.go b/src/cmd/compile/internal/typecheck/func.go index 2db1ae344c..f407ab6133 100644 --- a/src/cmd/compile/internal/typecheck/func.go +++ b/src/cmd/compile/internal/typecheck/func.go @@ -137,11 +137,6 @@ func MethodValueType(n *ir.SelectorExpr) *types.Type { return t } -// True if we are typechecking an inline body in ImportedBody below. We use this -// flag to not create a new closure function in tcClosure when we are just -// typechecking an inline body, as opposed to the body of a real function. -var inTypeCheckInl bool - // ImportedBody returns immediately if the inlining information for fn is // populated. Otherwise, fn must be an imported function. If so, ImportedBody // loads in the dcls and body for fn, and typechecks as needed. @@ -263,15 +258,7 @@ func tcClosure(clo *ir.ClosureExpr, top int) ir.Node { clo.SetType(fn.Type()) - target := Target - if inTypeCheckInl { - // We're typechecking an imported function, so it's not actually - // part of Target. Skip adding it to Target.Decls so we don't - // compile it again. - target = nil - } - - return ir.UseClosure(clo, target) + return ir.UseClosure(clo, Target) } // type check function definition