@@ -1584,15 +1584,7 @@ func extractType(tw *trap.Writer, tp types.Type) trap.Label {
1584
1584
extractUnderlyingType (tw , lbl , underlying )
1585
1585
trackInstantiatedStructFields (tw , tp , origintp )
1586
1586
1587
- entitylbl , exists := tw .Labeler .LookupObjectID (origintp .Obj (), lbl )
1588
- if entitylbl == trap .InvalidLabel {
1589
- log .Printf ("Omitting type-object binding for unknown object %v.\n " , origintp .Obj ())
1590
- } else {
1591
- if ! exists {
1592
- extractObject (tw , origintp .Obj (), entitylbl )
1593
- }
1594
- dbscheme .TypeObjectTable .Emit (tw , lbl , entitylbl )
1595
- }
1587
+ extractTypeObject (tw , lbl , origintp .Obj ())
1596
1588
1597
1589
// ensure all methods have labels - note that methods do not have a
1598
1590
// parent scope, so they are not dealt with by `extractScopes`
@@ -1614,6 +1606,8 @@ func extractType(tw *trap.Writer, tp types.Type) trap.Label {
1614
1606
parentlbl := getTypeParamParentLabel (tw , tp )
1615
1607
constraintLabel := extractType (tw , tp .Constraint ())
1616
1608
dbscheme .TypeParamTable .Emit (tw , lbl , tp .Obj ().Name (), constraintLabel , parentlbl , tp .Index ())
1609
+
1610
+ extractTypeObject (tw , lbl , tp .Obj ())
1617
1611
case * types.Union :
1618
1612
kind = dbscheme .TypeSetLiteral .Index ()
1619
1613
for i := 0 ; i < tp .Len (); i ++ {
@@ -1775,6 +1769,19 @@ func getTypeLabel(tw *trap.Writer, tp types.Type) (trap.Label, bool) {
1775
1769
return lbl , exists
1776
1770
}
1777
1771
1772
+ // extractTypeObject extracts a single type object and emits it to the type object table.
1773
+ func extractTypeObject (tw * trap.Writer , lbl trap.Label , entity * types.TypeName ) {
1774
+ entitylbl , exists := tw .Labeler .LookupObjectID (entity , lbl )
1775
+ if entitylbl == trap .InvalidLabel {
1776
+ log .Printf ("Omitting type-object binding for unknown object %v.\n " , entity )
1777
+ } else {
1778
+ if ! exists {
1779
+ extractObject (tw , entity , entitylbl )
1780
+ }
1781
+ dbscheme .TypeObjectTable .Emit (tw , lbl , entitylbl )
1782
+ }
1783
+ }
1784
+
1778
1785
// extractKeyType extracts `key` as the key type of the map type `mp`
1779
1786
func extractKeyType (tw * trap.Writer , mp trap.Label , key types.Type ) {
1780
1787
dbscheme .KeyTypeTable .Emit (tw , mp , extractType (tw , key ))
0 commit comments