cmd/compile: remove typecheck.Orig* functions

Same as CL 526397, but for typecheck.

Change-Id: Ia8f19a54ffaa2ae3b86a4c66cbe6d973482796cd
Reviewed-on: https://go-review.googlesource.com/c/go/+/526236
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
Cuong Manh Le 2023-09-12 10:45:54 +07:00 committed by Gopher Robot
parent aa381c538a
commit e50bbae2de
4 changed files with 8 additions and 64 deletions

View file

@ -355,26 +355,17 @@ func ForCapture(fn *ir.Func) []VarAndLoop {
})
postNotNil := x.Post != nil
var tmpFirstDcl *ir.AssignStmt
var tmpFirstDcl ir.Node
if postNotNil {
// body' = prebody +
// (6) if tmp_first {tmp_first = false} else {Post} +
// if !cond {break} + ...
tmpFirst := typecheck.TempAt(base.Pos, fn, types.Types[types.TBOOL])
// tmpFirstAssign assigns val to tmpFirst
tmpFirstAssign := func(val bool) *ir.AssignStmt {
s := ir.NewAssignStmt(x.Pos(), tmpFirst, typecheck.OrigBool(tmpFirst, val))
s.SetTypecheck(1)
return s
}
tmpFirstDcl = tmpFirstAssign(true)
tmpFirstDcl.Def = true // also declares tmpFirst
tmpFirstSetFalse := tmpFirstAssign(false)
tmpFirstDcl = typecheck.Stmt(ir.NewAssignStmt(x.Pos(), tmpFirst, ir.NewBool(base.Pos, true)))
tmpFirstSetFalse := typecheck.Stmt(ir.NewAssignStmt(x.Pos(), tmpFirst, ir.NewBool(base.Pos, false)))
ifTmpFirst := ir.NewIfStmt(x.Pos(), tmpFirst, ir.Nodes{tmpFirstSetFalse}, ir.Nodes{x.Post})
ifTmpFirst.SetTypecheck(1)
preBody.Append(ifTmpFirst)
ifTmpFirst.PtrInit().Append(typecheck.Stmt(ir.NewDecl(base.Pos, ir.ODCL, tmpFirst))) // declares tmpFirst
preBody.Append(typecheck.Stmt(ifTmpFirst))
}
// body' = prebody +