mirror of
https://github.com/golang/go
synced 2024-10-06 08:00:07 +00:00
[dev.typeparams] cmd/compile: swap export order of union term components (cleanup)
Export a term as a pair (tilde, type) rather than (type, tilde) to match the new Union/Term API. Change-Id: I221c09c2c746ae19fbae0c970ffb26fa7a8ac736 Reviewed-on: https://go-review.googlesource.com/c/go/+/340251 Trust: Robert Griesemer <gri@golang.org> Trust: Dan Scales <danscales@google.com> Run-TryBot: Robert Griesemer <gri@golang.org> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Dan Scales <danscales@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
0d7dc417ea
commit
313924f272
|
@ -676,12 +676,9 @@ func (r *importReader) doType(base *types2.Named) types2.Type {
|
|||
if r.p.exportVersion < iexportVersionGenerics {
|
||||
errorf("unexpected instantiation type")
|
||||
}
|
||||
nt := int(r.uint64())
|
||||
terms := make([]*types2.Term, nt)
|
||||
terms := make([]*types2.Term, r.uint64())
|
||||
for i := range terms {
|
||||
typ := r.typ()
|
||||
tilde := r.bool()
|
||||
terms[i] = types2.NewTerm(tilde, typ)
|
||||
terms[i] = types2.NewTerm(r.bool(), r.typ())
|
||||
}
|
||||
return types2.NewUnion(terms)
|
||||
}
|
||||
|
|
|
@ -283,9 +283,7 @@ func (r *reader2) structType() *types2.Struct {
|
|||
func (r *reader2) unionType() *types2.Union {
|
||||
terms := make([]*types2.Term, r.len())
|
||||
for i := range terms {
|
||||
typ := r.typ()
|
||||
tilde := r.bool()
|
||||
terms[i] = types2.NewTerm(tilde, typ)
|
||||
terms[i] = types2.NewTerm(r.bool(), r.typ())
|
||||
}
|
||||
return types2.NewUnion(terms)
|
||||
}
|
||||
|
|
|
@ -397,8 +397,8 @@ func (w *writer) unionType(typ *types2.Union) {
|
|||
w.len(typ.Len())
|
||||
for i := 0; i < typ.Len(); i++ {
|
||||
t := typ.Term(i)
|
||||
w.typ(t.Type())
|
||||
w.bool(t.Tilde())
|
||||
w.typ(t.Type())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1002,9 +1002,9 @@ func (w *exportWriter) doTyp(t *types.Type) {
|
|||
nt := t.NumTerms()
|
||||
w.uint64(uint64(nt))
|
||||
for i := 0; i < nt; i++ {
|
||||
t, b := t.Term(i)
|
||||
w.typ(t)
|
||||
w.bool(b)
|
||||
typ, tilde := t.Term(i)
|
||||
w.bool(tilde)
|
||||
w.typ(typ)
|
||||
}
|
||||
|
||||
default:
|
||||
|
|
|
@ -847,8 +847,8 @@ func (r *importReader) typ1() *types.Type {
|
|||
terms := make([]*types.Type, nt)
|
||||
tildes := make([]bool, nt)
|
||||
for i := range terms {
|
||||
terms[i] = r.typ()
|
||||
tildes[i] = r.bool()
|
||||
terms[i] = r.typ()
|
||||
}
|
||||
return types.NewUnion(terms, tildes)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue