mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile/internal/typecheck: replace Temp calls with TempAt
Steps towards eliminating implicit dependencies on base.Pos and ir.CurFunc. Mechanical CL produced with gofmt -r. Change-Id: I070015513cb955cbe87f9a148d81db8c0d4b0dc5 Reviewed-on: https://go-review.googlesource.com/c/go/+/520605 Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
2a0b8cfd80
commit
78f90511ec
15 changed files with 61 additions and 69 deletions
|
|
@ -107,7 +107,7 @@ func ForCapture(fn *ir.Func) []VarAndLoop {
|
|||
if base.LoopVarHash.MatchPos(n.Pos(), desc) {
|
||||
// Rename the loop key, prefix body with assignment from loop key
|
||||
transformed = append(transformed, VarAndLoop{n, x, lastPos})
|
||||
tk := typecheck.Temp(n.Type())
|
||||
tk := typecheck.TempAt(base.Pos, ir.CurFunc, n.Type())
|
||||
tk.SetTypecheck(1)
|
||||
as := ir.NewAssignStmt(x.Pos(), n, tk)
|
||||
as.Def = true
|
||||
|
|
@ -298,7 +298,7 @@ func ForCapture(fn *ir.Func) []VarAndLoop {
|
|||
for _, z := range leaked {
|
||||
transformed = append(transformed, VarAndLoop{z, x, lastPos})
|
||||
|
||||
tz := typecheck.Temp(z.Type())
|
||||
tz := typecheck.TempAt(base.Pos, ir.CurFunc, z.Type())
|
||||
tz.SetTypecheck(1)
|
||||
zPrimeForZ[z] = tz
|
||||
|
||||
|
|
@ -360,7 +360,7 @@ func ForCapture(fn *ir.Func) []VarAndLoop {
|
|||
// body' = prebody +
|
||||
// (6) if tmp_first {tmp_first = false} else {Post} +
|
||||
// if !cond {break} + ...
|
||||
tmpFirst := typecheck.Temp(types.Types[types.TBOOL])
|
||||
tmpFirst := typecheck.TempAt(base.Pos, ir.CurFunc, types.Types[types.TBOOL])
|
||||
|
||||
// tmpFirstAssign assigns val to tmpFirst
|
||||
tmpFirstAssign := func(val bool) *ir.AssignStmt {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue