]> Cypherpunks repositories - gostls13.git/commit
[dev.typeparams] cmd/compile: refactor CaptureName
authorMatthew Dempsky <mdempsky@google.com>
Wed, 23 Jun 2021 01:10:59 +0000 (18:10 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Wed, 23 Jun 2021 04:03:38 +0000 (04:03 +0000)
commitc4e0c652fbf3b17cc89f72c6569fe255fe5e1047
treeff545984e43e0e1f95639489e9a05bde0dca6274
parent62095c66e042024fc631a3e9514b637ae4b5ae10
[dev.typeparams] cmd/compile: refactor CaptureName

CaptureName currently does a few things: checks if a variable needs to
be captured at all; checks if the variable has already been captured;
and creates and saves a new variable. This full suite of functionality
is useful for noder and irgen, but unified IR and other backend code
only has a need for the last feature.

This CL refactors CaptureName a little bit and extracts out
NewClosureVar as a function usable for callers that don't need the
extra features of CaptureName.

Change-Id: I8a67c6375e44babe53344bf78e335535c57f9607
Reviewed-on: https://go-review.googlesource.com/c/go/+/330193
Trust: Matthew Dempsky <mdempsky@google.com>
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.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>
src/cmd/compile/internal/ir/name.go
src/cmd/compile/internal/noder/reader.go