aboutsummaryrefslogtreecommitdiff
path: root/src/cmd
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2020-12-27 11:11:11 -0800
committerMatthew Dempsky <mdempsky@google.com>2020-12-28 08:07:51 +0000
commit098a6490b93f337ed3f13a7a18376ebb8175f2be (patch)
treee46668060d7e30fa8dc2f0e118bc14e3bfc8752c /src/cmd
parent137f0d2e06523f6daf808ea09e77e68d8944a85a (diff)
downloadgo-098a6490b93f337ed3f13a7a18376ebb8175f2be.tar.xz
[dev.regabi] cmd/compile: remove Declare in makepartialcall
This is the only remaining late call to Declare. By changing it to use Temp, we'll be able to move the legacy lexical scoping logic by moving it to noder and iimport. Passes toolstash -cmp. Change-Id: Id7cf7a08e3138e50816f515fef3088785a10aaf4 Reviewed-on: https://go-review.googlesource.com/c/go/+/280513 Trust: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Diffstat (limited to 'src/cmd')
-rw-r--r--src/cmd/compile/internal/typecheck/func.go8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/cmd/compile/internal/typecheck/func.go b/src/cmd/compile/internal/typecheck/func.go
index a9d92c668c..ed4f3ad4fe 100644
--- a/src/cmd/compile/internal/typecheck/func.go
+++ b/src/cmd/compile/internal/typecheck/func.go
@@ -285,15 +285,13 @@ func makepartialcall(dot *ir.SelectorExpr) *ir.Func {
// Declare and initialize variable holding receiver.
cr := ir.NewClosureRead(rcvrtype, types.Rnd(int64(types.PtrSize), int64(rcvrtype.Align)))
- ptr := NewName(Lookup(".this"))
- Declare(ptr, ir.PAUTO)
- ptr.SetUsed(true)
+ var ptr *ir.Name
var body []ir.Node
if rcvrtype.IsPtr() || rcvrtype.IsInterface() {
- ptr.SetType(rcvrtype)
+ ptr = Temp(rcvrtype)
body = append(body, ir.NewAssignStmt(base.Pos, ptr, cr))
} else {
- ptr.SetType(types.NewPtr(rcvrtype))
+ ptr = Temp(types.NewPtr(rcvrtype))
body = append(body, ir.NewAssignStmt(base.Pos, ptr, NodAddr(cr)))
}