@@ -11,9 +11,9 @@ import (
1111 "sync"
1212)
1313
14- // IRNode represents an ir.Node, but without needing to import cmd/compile/internal/ir,
14+ // Object represents an ir.Node, but without needing to import cmd/compile/internal/ir,
1515// which would cause an import cycle. The uses in other packages must type assert
16- // values of type IRNode to ir.Node or a more specific type.
16+ // values of type Object to ir.Node or a more specific type.
1717type Object interface {
1818 Pos () src.XPos
1919 Sym () * Sym
@@ -157,12 +157,15 @@ type Type struct {
157157 // Width is the width of this Type in bytes.
158158 Width int64 // valid if Align > 0
159159
160- methods Fields
160+ // list of base methods (excluding embedding)
161+ methods Fields
162+ // list of all methods (including embedding)
161163 allMethods Fields
162164
163165 // canonical OTYPE node for a named type (should be an ir.Name node with same sym)
164- nod Object
165- underlying * Type // original type (type literal or predefined type)
166+ nod Object
167+ // the underlying type (type literal or predeclared type) for a defined type
168+ underlying * Type
166169
167170 // Cache of composite types, with this type being the element type.
168171 cache struct {
@@ -423,8 +426,11 @@ type Slice struct {
423426 Elem * Type // element type
424427}
425428
426- // A Field represents a field in a struct or a method in an interface or
427- // associated with a named type.
429+ // A Field is a (Sym, Type) pairing along with some other information, and,
430+ // depending on the context, is used to represent:
431+ // - a field in a struct
432+ // - a method in an interface or associated with a named type
433+ // - a function parameter
428434type Field struct {
429435 flags bitset8
430436
@@ -1656,9 +1662,10 @@ var (
16561662)
16571663
16581664// NewNamed returns a new named type for the given type name. obj should be an
1659- // ir.Name. The new type is incomplete, and the underlying type should be set
1660- // later via SetUnderlying(). References to the type are maintained until the type
1661- // is filled in, so those references can be updated when the type is complete.
1665+ // ir.Name. The new type is incomplete (marked as TFORW kind), and the underlying
1666+ // type should be set later via SetUnderlying(). References to the type are
1667+ // maintained until the type is filled in, so those references can be updated when
1668+ // the type is complete.
16621669func NewNamed (obj Object ) * Type {
16631670 t := New (TFORW )
16641671 t .sym = obj .Sym ()
0 commit comments