@@ -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. Note that we
478
+ // Populate type parameter parents for defined types. Note that we
479
479
// skip type aliases as the original type should be the parent
480
480
// of any type parameters.
481
481
if typeNameObj , ok := obj .(* types.TypeName ); ok && ! typeNameObj .IsAlias () {
@@ -568,7 +568,7 @@ func extractObject(tw *trap.Writer, obj types.Object, lbl trap.Label) {
568
568
// For more information on objects, see:
569
569
// https://github.com/golang/example/blob/master/gotypes/README.md#objects
570
570
func 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
572
572
// on it, which will add new objects. Therefore we need to do this first
573
573
// before we loop over all objects and emit them.
574
574
changed := true
@@ -1689,7 +1689,7 @@ func extractType(tw *trap.Writer, tp types.Type) trap.Label {
1689
1689
extractElementType (tw , lbl , tp .Elem ())
1690
1690
case * types.Named :
1691
1691
origintp := tp .Origin ()
1692
- kind = dbscheme .NamedType .Index ()
1692
+ kind = dbscheme .DefinedType .Index ()
1693
1693
dbscheme .TypeNameTable .Emit (tw , lbl , origintp .Obj ().Name ())
1694
1694
underlying := origintp .Underlying ()
1695
1695
extractUnderlyingType (tw , lbl , underlying )
@@ -1761,9 +1761,9 @@ func extractType(tw *trap.Writer, tp types.Type) trap.Label {
1761
1761
// Type labels refer to global keys to ensure that if the same type is
1762
1762
// encountered during the extraction of different files it is still ultimately
1763
1763
// 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
1765
1765
// 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.
1767
1767
func getTypeLabel (tw * trap.Writer , tp types.Type ) (trap.Label , bool ) {
1768
1768
tp = resolveTypeAlias (tp )
1769
1769
lbl , exists := tw .Labeler .TypeLabels [tp ]
@@ -1868,12 +1868,12 @@ func getTypeLabel(tw *trap.Writer, tp types.Type) (trap.Label, bool) {
1868
1868
origintp := tp .Origin ()
1869
1869
entitylbl , exists := tw .Labeler .LookupObjectID (origintp .Obj (), lbl )
1870
1870
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 ()))
1872
1872
}
1873
1873
if ! exists {
1874
1874
extractObject (tw , origintp .Obj (), entitylbl )
1875
1875
}
1876
- lbl = tw .Labeler .GlobalID (fmt .Sprintf ("{%s};namedtype " , entitylbl ))
1876
+ lbl = tw .Labeler .GlobalID (fmt .Sprintf ("{%s};definedtype " , entitylbl ))
1877
1877
case * types.TypeParam :
1878
1878
parentlbl := getTypeParamParentLabel (tw , tp )
1879
1879
idx := tp .Index ()
@@ -1915,9 +1915,9 @@ func extractBaseType(tw *trap.Writer, ptr trap.Label, base types.Type) {
1915
1915
}
1916
1916
1917
1917
// 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 ))
1921
1921
}
1922
1922
1923
1923
// extractComponentType extracts `component` as the `idx`th component type of `parent` with name `name`
@@ -2167,8 +2167,8 @@ func checkObjectNotSpecialized(obj types.Object) {
2167
2167
log .Fatalf ("Encountered unexpected specialization %s of generic variable object %s" , varObj .String (), varObj .Origin ().String ())
2168
2168
}
2169
2169
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 ())
2172
2172
}
2173
2173
}
2174
2174
}
0 commit comments