1
0
mirror of https://github.com/golang/go synced 2024-11-17 07:04:44 -07:00

cmd/compile/internal/ir: remove NewClosureExpr

The only usage of NewClosureExpr is inside NewClosureFunc, which is its
alternative version. So just remove NewClosureExpr and inline it there.

Change-Id: I1900f4fbb48d7b4f6e6a857f7f7760cd27302671
Reviewed-on: https://go-review.googlesource.com/c/go/+/395855
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
Cuong Manh Le 2022-03-26 00:46:17 +07:00
parent 1d19cea740
commit f25631b490
2 changed files with 3 additions and 9 deletions

View File

@ -186,14 +186,6 @@ type ClosureExpr struct {
IsGoWrap bool // whether this is wrapper closure of a go statement
}
// Deprecated: Use NewClosureFunc instead.
func NewClosureExpr(pos src.XPos, fn *Func) *ClosureExpr {
n := &ClosureExpr{Func: fn}
n.op = OCLOSURE
n.pos = pos
return n
}
// A CompLitExpr is a composite literal Type{Vals}.
// Before type-checking, the type is Ntype.
type CompLitExpr struct {

View File

@ -368,7 +368,9 @@ func NewClosureFunc(pos src.XPos, hidden bool) *Func {
fn.Nname.Func = fn
fn.Nname.Defn = fn
fn.OClosure = NewClosureExpr(pos, fn)
fn.OClosure = &ClosureExpr{Func: fn}
fn.OClosure.op = OCLOSURE
fn.OClosure.pos = pos
return fn
}