cmd/compile: update doc at top of iexport.go on the changes for typeparams

Add in the documentation of the new declarations and type descriptors to
support parameterized functions and types.

Change-Id: Ia21c544caa704309cc8fd639f104c192e1786b72
Reviewed-on: https://go-review.googlesource.com/c/go/+/350951
Trust: Dan Scales <danscales@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
This commit is contained in:
Dan Scales 2021-09-19 18:26:19 -07:00
parent a81b0dc6ee
commit 2d9b486420
1 changed files with 34 additions and 4 deletions

View File

@ -63,8 +63,9 @@
// } // }
// //
// type Func struct { // type Func struct {
// Tag byte // 'F' // Tag byte // 'F' or 'G'
// Pos Pos // Pos Pos
// TypeParams []typeOff // only present if Tag == 'G'
// Signature Signature // Signature Signature
// } // }
// //
@ -75,8 +76,9 @@
// } // }
// //
// type Type struct { // type Type struct {
// Tag byte // 'T' // Tag byte // 'T' or 'U'
// Pos Pos // Pos Pos
// TypeParams []typeOff // only present if Tag == 'U'
// Underlying typeOff // Underlying typeOff
// //
// Methods []struct{ // omitted if Underlying is an interface type // Methods []struct{ // omitted if Underlying is an interface type
@ -93,6 +95,12 @@
// Type typeOff // Type typeOff
// } // }
// //
// // "Automatic" declaration of each typeparam
// type TypeParam struct {
// Tag byte // 'P'
// Pos Pos
// Bound typeOff
// }
// //
// typeOff means a uvarint that either indicates a predeclared type, // typeOff means a uvarint that either indicates a predeclared type,
// or an offset into the Data section. If the uvarint is less than // or an offset into the Data section. If the uvarint is less than
@ -104,7 +112,7 @@
// (*exportWriter).value for details. // (*exportWriter).value for details.
// //
// //
// There are nine kinds of type descriptors, distinguished by an itag: // There are twelve kinds of type descriptors, distinguished by an itag:
// //
// type DefinedType struct { // type DefinedType struct {
// Tag itag // definedType // Tag itag // definedType
@ -172,8 +180,30 @@
// } // }
// } // }
// //
// // Reference to a type param declaration
// type TypeParamType struct {
// Tag itag // typeParamType
// Name stringOff
// PkgPath stringOff
// }
//
// // Instantiation of a generic type (like List[T2] or List[int])
// type InstanceType struct {
// Tag itag // instanceType
// Pos pos
// TypeArgs []typeOff
// BaseType typeOff
// }
//
// type UnionType struct {
// Tag itag // interfaceType
// Terms []struct {
// tilde bool
// Type typeOff
// }
// }
//
// //
// TODO(danscales): fill in doc for 'type TypeParamType' and 'type InstType'
// //
// type Signature struct { // type Signature struct {
// Params []Param // Params []Param