@@ -475,7 +475,7 @@ func extractObjects(tw *trap.Writer, scope *types.Scope, scopeLabel trap.Label)
475
475
populateTypeParamParents (funcObj .Type ().(* types.Signature ).TypeParams (), obj )
476
476
populateTypeParamParents (funcObj .Type ().(* types.Signature ).RecvTypeParams (), obj )
477
477
}
478
- // Populate type parameter parents for named types.
478
+ // Populate type parameter parents for defined types and alias types.
479
479
if typeNameObj , ok := obj .(* types.TypeName ); ok {
480
480
// `types.TypeName` represents a type with a name: a defined
481
481
// 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) {
574
574
// For more information on objects, see:
575
575
// https://github.com/golang/example/blob/master/gotypes/README.md#objects
576
576
func 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
578
578
// on it, which will add new objects. Therefore we need to do this first
579
579
// before we loop over all objects and emit them.
580
580
changed := true
@@ -1695,7 +1695,7 @@ func extractType(tw *trap.Writer, tp types.Type) trap.Label {
1695
1695
extractElementType (tw , lbl , tp .Elem ())
1696
1696
case * types.Named :
1697
1697
origintp := tp .Origin ()
1698
- kind = dbscheme .NamedType .Index ()
1698
+ kind = dbscheme .DefinedType .Index ()
1699
1699
dbscheme .TypeNameTable .Emit (tw , lbl , origintp .Obj ().Name ())
1700
1700
underlying := origintp .Underlying ()
1701
1701
extractUnderlyingType (tw , lbl , underlying )
@@ -1767,9 +1767,9 @@ func extractType(tw *trap.Writer, tp types.Type) trap.Label {
1767
1767
// Type labels refer to global keys to ensure that if the same type is
1768
1768
// encountered during the extraction of different files it is still ultimately
1769
1769
// 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
1771
1771
// 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.
1773
1773
func getTypeLabel (tw * trap.Writer , tp types.Type ) (trap.Label , bool ) {
1774
1774
tp = resolveTypeAlias (tp )
1775
1775
lbl , exists := tw .Labeler .TypeLabels [tp ]
@@ -1874,12 +1874,12 @@ func getTypeLabel(tw *trap.Writer, tp types.Type) (trap.Label, bool) {
1874
1874
origintp := tp .Origin ()
1875
1875
entitylbl , exists := tw .Labeler .LookupObjectID (origintp .Obj (), lbl )
1876
1876
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 ()))
1878
1878
}
1879
1879
if ! exists {
1880
1880
extractObject (tw , origintp .Obj (), entitylbl )
1881
1881
}
1882
- lbl = tw .Labeler .GlobalID (fmt .Sprintf ("{%s};namedtype " , entitylbl ))
1882
+ lbl = tw .Labeler .GlobalID (fmt .Sprintf ("{%s};definedtype " , entitylbl ))
1883
1883
case * types.TypeParam :
1884
1884
parentlbl := getTypeParamParentLabel (tw , tp )
1885
1885
idx := tp .Index ()
@@ -1921,9 +1921,9 @@ func extractBaseType(tw *trap.Writer, ptr trap.Label, base types.Type) {
1921
1921
}
1922
1922
1923
1923
// 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 ))
1927
1927
}
1928
1928
1929
1929
// extractComponentType extracts `component` as the `idx`th component type of `parent` with name `name`
@@ -2173,8 +2173,8 @@ func checkObjectNotSpecialized(obj types.Object) {
2173
2173
log .Fatalf ("Encountered unexpected specialization %s of generic variable object %s" , varObj .String (), varObj .Origin ().String ())
2174
2174
}
2175
2175
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 ())
2178
2178
}
2179
2179
}
2180
2180
}
0 commit comments