cmd/compile: always construct typechecked closures

This CL extends ir.NewClosureFunc to take the signature type argument,
and to handle naming the closure and adding it to typecheck.Target.

It also removes the code for typechecking OCLOSURE and ODCLFUNC nodes,
by having them always constructed as typechecked. ODCLFUNC node
construction will be further simplified in the followup CL.

Change-Id: Iabde4557d33051ee470a3bc4fd49599490024cba
Reviewed-on: https://go-review.googlesource.com/c/go/+/520337
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
This commit is contained in:
Matthew Dempsky 2023-08-16 18:56:41 -07:00 committed by Gopher Robot
parent e453971005
commit 5c6fbd2c3e
12 changed files with 43 additions and 202 deletions

View file

@ -237,7 +237,6 @@ func hashFunc(t *types.Type) *ir.Func {
typecheck.FinishFuncBody()
fn.SetDupok(true)
typecheck.Func(fn)
ir.WithFunc(fn, func() {
typecheck.Stmts(fn.Body)
@ -623,7 +622,6 @@ func eqFunc(t *types.Type) *ir.Func {
typecheck.FinishFuncBody()
fn.SetDupok(true)
typecheck.Func(fn)
ir.WithFunc(fn, func() {
typecheck.Stmts(fn.Body)