]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: remove inTypeCheckInl boolean
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Thu, 28 Apr 2022 18:20:38 +0000 (01:20 +0700)
committerGopher Robot <gobot@golang.org>
Thu, 28 Apr 2022 18:41:25 +0000 (18:41 +0000)
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 <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>

src/cmd/compile/internal/typecheck/func.go

index 2db1ae344cabf0c05ad76a7cc2804c534cea4321..f407ab613329866977b119d51658bf215283ce09 100644 (file)
@@ -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