From: Cuong Manh Le Date: Fri, 25 Mar 2022 17:46:17 +0000 (+0700) Subject: cmd/compile/internal/ir: remove NewClosureExpr X-Git-Tag: go1.19beta1~925 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=f25631b490c7ccb8e555b4031dc12046b2534c11;p=gostls13.git 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 Run-TryBot: Cuong Manh Le TryBot-Result: Gopher Robot Reviewed-by: Matthew Dempsky --- diff --git a/src/cmd/compile/internal/ir/expr.go b/src/cmd/compile/internal/ir/expr.go index 815e369ad8..3b650c0787 100644 --- a/src/cmd/compile/internal/ir/expr.go +++ b/src/cmd/compile/internal/ir/expr.go @@ -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 { diff --git a/src/cmd/compile/internal/ir/func.go b/src/cmd/compile/internal/ir/func.go index 894fff23ff..a9a7f19d3f 100644 --- a/src/cmd/compile/internal/ir/func.go +++ b/src/cmd/compile/internal/ir/func.go @@ -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 }