]> Cypherpunks repositories - gostls13.git/commit
[dev.typeparams] cmd/compile: refactor "need to emit" logic for types
authorMatthew Dempsky <mdempsky@google.com>
Thu, 24 Jun 2021 18:31:56 +0000 (11:31 -0700)
committerMatthew Dempsky <mdempsky@google.com>
Fri, 25 Jun 2021 05:00:04 +0000 (05:00 +0000)
commit3f1a517a45d2e443a327e0b28df17698e299ea50
treeb94f274e4638ce10d413772400adc39239e25850
parentbadb98364b3710933de89bfe579fb8d1f82741c8
[dev.typeparams] cmd/compile: refactor "need to emit" logic for types

This CL refactors out a single reflectdata.NeedEmit function that
reports whether the current compilation unit needs to emit the runtime
type descriptor and method wrappers for a given type.

As a minor side bonus, this CL also skips compiling the "error.Error"
wrapper in non-runtime packages. Package runtime already
unconditionally emitted the runtime type descriptor for error, so we
just need to make sure it emits the wrapper and other packages don't.

Passes toolstash -cmp.

Change-Id: Ic9ea219dfba8a0a57f2f42f817bdff7618732bff
Reviewed-on: https://go-review.googlesource.com/c/go/+/330754
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>
src/cmd/compile/internal/reflectdata/reflect.go