Skip to content

Commit

Permalink
cmd/compile/internal/ir: remove NewClosureExpr
Browse files Browse the repository at this point in the history
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 <[email protected]>
Run-TryBot: Cuong Manh Le <[email protected]>
TryBot-Result: Gopher Robot <[email protected]>
Reviewed-by: Matthew Dempsky <[email protected]>
  • Loading branch information
cuonglm committed Mar 25, 2022
1 parent 1d19cea commit f25631b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
8 changes: 0 additions & 8 deletions src/cmd/compile/internal/ir/expr.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 3 additions & 1 deletion src/cmd/compile/internal/ir/func.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit f25631b

Please sign in to comment.