From 96a1ad298ad9e6a308c3b05c07e1b3bf53ac9cfe Mon Sep 17 00:00:00 2001 From: Cuong Manh Le Date: Fri, 29 Apr 2022 01:20:38 +0700 Subject: [PATCH] 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 --- src/cmd/compile/internal/typecheck/func.go | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/src/cmd/compile/internal/typecheck/func.go b/src/cmd/compile/internal/typecheck/func.go index 2db1ae344ca..f407ab61332 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