@@ -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. Note that we
478+ // Populate type parameter parents for defined types. Note that we
479479 // skip type aliases as the original type should be the parent
480480 // of any type parameters.
481481 if typeNameObj , ok := obj .(* types.TypeName ); ok && ! typeNameObj .IsAlias () {
@@ -568,7 +568,7 @@ func extractObject(tw *trap.Writer, obj types.Object, lbl trap.Label) {
568568// For more information on objects, see:
569569// https://github.com/golang/example/blob/master/gotypes/README.md#objects
570570func extractObjectTypes (tw * trap.Writer ) {
571- // calling `extractType` on a named type will extract all methods defined
571+ // calling `extractType` on a defined type will extract all methods defined
572572 // on it, which will add new objects. Therefore we need to do this first
573573 // before we loop over all objects and emit them.
574574 changed := true
@@ -1689,7 +1689,7 @@ func extractType(tw *trap.Writer, tp types.Type) trap.Label {
16891689 extractElementType (tw , lbl , tp .Elem ())
16901690 case * types.Named :
16911691 origintp := tp .Origin ()
1692- kind = dbscheme .NamedType .Index ()
1692+ kind = dbscheme .DefinedType .Index ()
16931693 dbscheme .TypeNameTable .Emit (tw , lbl , origintp .Obj ().Name ())
16941694 underlying := origintp .Underlying ()
16951695 extractUnderlyingType (tw , lbl , underlying )
@@ -1761,9 +1761,9 @@ func extractType(tw *trap.Writer, tp types.Type) trap.Label {
17611761// Type labels refer to global keys to ensure that if the same type is
17621762// encountered during the extraction of different files it is still ultimately
17631763// mapped to the same entity. In particular, this means that keys for compound
1764- // types refer to the labels of their component types. For named types, the key
1764+ // types refer to the labels of their component types. For defined types, the key
17651765// is constructed from their globally unique ID. This prevents cyclic type keys
1766- // since type recursion in Go always goes through named types.
1766+ // since type recursion in Go always goes through defined types.
17671767func getTypeLabel (tw * trap.Writer , tp types.Type ) (trap.Label , bool ) {
17681768 tp = resolveTypeAlias (tp )
17691769 lbl , exists := tw .Labeler .TypeLabels [tp ]
@@ -1868,12 +1868,12 @@ func getTypeLabel(tw *trap.Writer, tp types.Type) (trap.Label, bool) {
18681868 origintp := tp .Origin ()
18691869 entitylbl , exists := tw .Labeler .LookupObjectID (origintp .Obj (), lbl )
18701870 if entitylbl == trap .InvalidLabel {
1871- panic (fmt .Sprintf ("Cannot construct label for named type %v (underlying object is %v).\n " , origintp , origintp .Obj ()))
1871+ panic (fmt .Sprintf ("Cannot construct label for defined type %v (underlying object is %v).\n " , origintp , origintp .Obj ()))
18721872 }
18731873 if ! exists {
18741874 extractObject (tw , origintp .Obj (), entitylbl )
18751875 }
1876- lbl = tw .Labeler .GlobalID (fmt .Sprintf ("{%s};namedtype " , entitylbl ))
1876+ lbl = tw .Labeler .GlobalID (fmt .Sprintf ("{%s};definedtype " , entitylbl ))
18771877 case * types.TypeParam :
18781878 parentlbl := getTypeParamParentLabel (tw , tp )
18791879 idx := tp .Index ()
@@ -1915,9 +1915,9 @@ func extractBaseType(tw *trap.Writer, ptr trap.Label, base types.Type) {
19151915}
19161916
19171917// extractUnderlyingType extracts `underlying` as the underlying type of the
1918- // named type `named `
1919- func extractUnderlyingType (tw * trap.Writer , named trap.Label , underlying types.Type ) {
1920- dbscheme .UnderlyingTypeTable .Emit (tw , named , extractType (tw , underlying ))
1918+ // defined type `defined `
1919+ func extractUnderlyingType (tw * trap.Writer , defined trap.Label , underlying types.Type ) {
1920+ dbscheme .UnderlyingTypeTable .Emit (tw , defined , extractType (tw , underlying ))
19211921}
19221922
19231923// extractComponentType extracts `component` as the `idx`th component type of `parent` with name `name`
@@ -2167,8 +2167,8 @@ func checkObjectNotSpecialized(obj types.Object) {
21672167 log .Fatalf ("Encountered unexpected specialization %s of generic variable object %s" , varObj .String (), varObj .Origin ().String ())
21682168 }
21692169 if typeNameObj , ok := obj .(* types.TypeName ); ok {
2170- if namedType , ok := typeNameObj .Type ().(* types.Named ); ok && namedType != namedType .Origin () {
2171- log .Fatalf ("Encountered type object for specialization %s of named type %s" , namedType .String (), namedType .Origin ().String ())
2170+ if definedType , ok := typeNameObj .Type ().(* types.Named ); ok && definedType != definedType .Origin () {
2171+ log .Fatalf ("Encountered type object for specialization %s of defined type %s" , definedType .String (), definedType .Origin ().String ())
21722172 }
21732173 }
21742174}
0 commit comments