mirror of
https://github.com/golang/go
synced 2024-11-25 16:37:57 -07:00
06b86e9803
By default, when typechecking a closure, tcClosure() creates a new closure function. This should really be done separate from typechecking. For now, we explicitly avoid creating a new closure function when typechecking an inline body (in ImportedBody). However, the heuristic for determining when we are typechecking an inline body was not correct for double nested closures in an inline body, since CurFunc will then be the inner closure, which has a body. So, use a simple global variable to indicate when we typechecking an inline body. The global variable is fine (just like ir.CurFunc), since the front-end runs serially. Fixes #44325 Change-Id: If2829fe1ebb195a7b1a240192b57fe6f04d1a36b Reviewed-on: https://go-review.googlesource.com/c/go/+/294211 TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Trust: Dan Scales <danscales@google.com> Run-TryBot: Dan Scales <danscales@google.com> |
||
---|---|---|
.. | ||
a.go | ||
b.go |