mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.typeparams] cmd/compile: simple shape cleanups
- Changed some early returns to asserts (instantiateMethods and Shapify should never take a shape arg) - Added suggested change (by Ingo) to use copy() in getInstantiation() - Clarified that shape types never have methods in Shapify(), removed some TODO comments. Change-Id: Ia2164ffe670a777f7797bbb45c7ef5e6e9e15357 Reviewed-on: https://go-review.googlesource.com/c/go/+/338971 Run-TryBot: Dan Scales <danscales@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org> Trust: Dan Scales <danscales@google.com>
This commit is contained in:
parent
c3c19731a9
commit
e56234a305
2 changed files with 7 additions and 12 deletions
|
|
@ -474,10 +474,7 @@ func (g *irgen) buildClosure(outer *ir.Func, x ir.Node) ir.Node {
|
|||
func (g *irgen) instantiateMethods() {
|
||||
for i := 0; i < len(g.instTypeList); i++ {
|
||||
typ := g.instTypeList[i]
|
||||
if typ.HasShape() {
|
||||
// Shape types should not have any methods.
|
||||
continue
|
||||
}
|
||||
assert(!typ.HasShape())
|
||||
// Mark runtime type as needed, since this ensures that the
|
||||
// compiler puts out the needed DWARF symbols, when this
|
||||
// instantiated type has a different package from the local
|
||||
|
|
@ -782,9 +779,7 @@ func (g *irgen) getInstantiation(nameNode *ir.Name, shapes []*types.Type, isMeth
|
|||
if !t.HasShape() {
|
||||
if s1 == nil {
|
||||
s1 = make([]*types.Type, len(shapes))
|
||||
for j := 0; j < i; j++ {
|
||||
s1[j] = shapes[j]
|
||||
}
|
||||
copy(s1[0:i], shapes[0:i])
|
||||
}
|
||||
s1[i] = typecheck.Shapify(t)
|
||||
} else if s1 != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue