@@ -475,7 +475,7 @@ func extractObjects(tw *trap.Writer, scope *types.Scope, scopeLabel trap.Label)
475475 populateTypeParamParents (funcObj .Type ().(* types.Signature ).TypeParams (), obj )
476476 populateTypeParamParents (funcObj .Type ().(* types.Signature ).RecvTypeParams (), obj )
477477 }
478- // Populate type parameter parents for named types.
478+ // Populate type parameter parents for defined types and alias types.
479479 if typeNameObj , ok := obj .(* types.TypeName ); ok {
480480 // `types.TypeName` represents a type with a name: a defined
481481 // type, an alias type, a type parameter, or a predeclared
@@ -574,7 +574,7 @@ func extractObject(tw *trap.Writer, obj types.Object, lbl trap.Label) {
574574// For more information on objects, see:
575575// https://github.com/golang/example/blob/master/gotypes/README.md#objects
576576func extractObjectTypes (tw * trap.Writer ) {
577- // calling `extractType` on a named type will extract all methods defined
577+ // calling `extractType` on a defined type will extract all methods defined
578578 // on it, which will add new objects. Therefore we need to do this first
579579 // before we loop over all objects and emit them.
580580 changed := true
@@ -1695,7 +1695,7 @@ func extractType(tw *trap.Writer, tp types.Type) trap.Label {
16951695 extractElementType (tw , lbl , tp .Elem ())
16961696 case * types.Named :
16971697 origintp := tp .Origin ()
1698- kind = dbscheme .NamedType .Index ()
1698+ kind = dbscheme .DefinedType .Index ()
16991699 dbscheme .TypeNameTable .Emit (tw , lbl , origintp .Obj ().Name ())
17001700 underlying := origintp .Underlying ()
17011701 extractUnderlyingType (tw , lbl , underlying )
@@ -1767,9 +1767,9 @@ func extractType(tw *trap.Writer, tp types.Type) trap.Label {
17671767// Type labels refer to global keys to ensure that if the same type is
17681768// encountered during the extraction of different files it is still ultimately
17691769// mapped to the same entity. In particular, this means that keys for compound
1770- // types refer to the labels of their component types. For named types, the key
1770+ // types refer to the labels of their component types. For defined types, the key
17711771// is constructed from their globally unique ID. This prevents cyclic type keys
1772- // since type recursion in Go always goes through named types.
1772+ // since type recursion in Go always goes through defined types.
17731773func getTypeLabel (tw * trap.Writer , tp types.Type ) (trap.Label , bool ) {
17741774 tp = resolveTypeAlias (tp )
17751775 lbl , exists := tw .Labeler .TypeLabels [tp ]
@@ -1874,12 +1874,12 @@ func getTypeLabel(tw *trap.Writer, tp types.Type) (trap.Label, bool) {
18741874 origintp := tp .Origin ()
18751875 entitylbl , exists := tw .Labeler .LookupObjectID (origintp .Obj (), lbl )
18761876 if entitylbl == trap .InvalidLabel {
1877- panic (fmt .Sprintf ("Cannot construct label for named type %v (underlying object is %v).\n " , origintp , origintp .Obj ()))
1877+ panic (fmt .Sprintf ("Cannot construct label for defined type %v (underlying object is %v).\n " , origintp , origintp .Obj ()))
18781878 }
18791879 if ! exists {
18801880 extractObject (tw , origintp .Obj (), entitylbl )
18811881 }
1882- lbl = tw .Labeler .GlobalID (fmt .Sprintf ("{%s};namedtype " , entitylbl ))
1882+ lbl = tw .Labeler .GlobalID (fmt .Sprintf ("{%s};definedtype " , entitylbl ))
18831883 case * types.TypeParam :
18841884 parentlbl := getTypeParamParentLabel (tw , tp )
18851885 idx := tp .Index ()
@@ -1921,9 +1921,9 @@ func extractBaseType(tw *trap.Writer, ptr trap.Label, base types.Type) {
19211921}
19221922
19231923// extractUnderlyingType extracts `underlying` as the underlying type of the
1924- // named type `named `
1925- func extractUnderlyingType (tw * trap.Writer , named trap.Label , underlying types.Type ) {
1926- dbscheme .UnderlyingTypeTable .Emit (tw , named , extractType (tw , underlying ))
1924+ // defined type `defined `
1925+ func extractUnderlyingType (tw * trap.Writer , defined trap.Label , underlying types.Type ) {
1926+ dbscheme .UnderlyingTypeTable .Emit (tw , defined , extractType (tw , underlying ))
19271927}
19281928
19291929// extractComponentType extracts `component` as the `idx`th component type of `parent` with name `name`
@@ -2173,8 +2173,8 @@ func checkObjectNotSpecialized(obj types.Object) {
21732173 log .Fatalf ("Encountered unexpected specialization %s of generic variable object %s" , varObj .String (), varObj .Origin ().String ())
21742174 }
21752175 if typeNameObj , ok := obj .(* types.TypeName ); ok {
2176- if namedType , ok := typeNameObj .Type ().(* types.Named ); ok && namedType != namedType .Origin () {
2177- log .Fatalf ("Encountered type object for specialization %s of named type %s" , namedType .String (), namedType .Origin ().String ())
2176+ if definedType , ok := typeNameObj .Type ().(* types.Named ); ok && definedType != definedType .Origin () {
2177+ log .Fatalf ("Encountered type object for specialization %s of defined type %s" , definedType .String (), definedType .Origin ().String ())
21782178 }
21792179 }
21802180}
0 commit comments