mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.typeparams] cmd/compile: factor out implicit/explicit handling
The logic for handling them must keep in sync between reader/writer, so factoring them out from addBody make it's easier to refer later. Change-Id: I26447065867d79f4f47cc678a398b9e7bf5d2403 Reviewed-on: https://go-review.googlesource.com/c/go/+/328051 Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
cf1ae5fc36
commit
ee0420d3b5
3 changed files with 21 additions and 6 deletions
|
|
@ -789,18 +789,25 @@ var bodyReader = map[*ir.Func]pkgReaderIndex{}
|
|||
// constructed.
|
||||
var todoBodies []*ir.Func
|
||||
|
||||
func (r *reader) addBody(fn *ir.Func) {
|
||||
r.sync(syncAddBody)
|
||||
// Keep in sync with writer.implicitTypes
|
||||
// Also see comment there for why r.implicits and r.explicits should
|
||||
// never both be non-empty.
|
||||
func (r *reader) implicitTypes() []*types.Type {
|
||||
r.sync(syncImplicitTypes)
|
||||
|
||||
// See commont in writer.addBody for why r.implicits and r.explicits
|
||||
// should never both be non-empty.
|
||||
implicits := r.implicits
|
||||
if len(implicits) == 0 {
|
||||
implicits = r.explicits
|
||||
} else {
|
||||
assert(len(r.explicits) == 0)
|
||||
}
|
||||
return implicits
|
||||
}
|
||||
|
||||
func (r *reader) addBody(fn *ir.Func) {
|
||||
r.sync(syncAddBody)
|
||||
|
||||
implicits := r.implicitTypes()
|
||||
pri := pkgReaderIndex{r.p, r.reloc(relocBody), implicits}
|
||||
bodyReader[fn] = pri
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue