]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile/internal/ir: remove NewClosureExpr
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Fri, 25 Mar 2022 17:46:17 +0000 (00:46 +0700)
committerCuong Manh Le <cuong.manhle.vn@gmail.com>
Fri, 25 Mar 2022 18:19:09 +0000 (18:19 +0000)
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>
src/cmd/compile/internal/ir/expr.go
src/cmd/compile/internal/ir/func.go

index 815e369ad83bc806e20faf79d919bf8f0cf9d591..3b650c0787014082c2c3feb7f6cfb32890a99d66 100644 (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 {
index 894fff23ffbe37ec41f6d0d16dd7d41bf2092b32..a9a7f19d3f669e6eab1a32ea777b07ad2a8904f1 100644 (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
 }