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>
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 {
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
}