Skip to content

Commit 0c0f748

Browse files
committed
Go: Extract objects for aliases
1 parent eb2f198 commit 0c0f748

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

go/extractor/extractor.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1651,6 +1651,16 @@ func extractType(tw *trap.Writer, tp types.Type) trap.Label {
16511651
kind = dbscheme.TypeAlias.Index()
16521652
dbscheme.TypeNameTable.Emit(tw, lbl, tp.Obj().Name())
16531653
dbscheme.AliasRhsTable.Emit(tw, lbl, extractType(tw, tp.Rhs()))
1654+
1655+
entitylbl, exists := tw.Labeler.LookupObjectID(tp.Obj(), lbl)
1656+
if entitylbl == trap.InvalidLabel {
1657+
log.Printf("Omitting type-object binding for unknown object %v.\n", tp.Obj())
1658+
} else {
1659+
if !exists {
1660+
extractObject(tw, tp.Obj(), entitylbl)
1661+
}
1662+
dbscheme.TypeObjectTable.Emit(tw, lbl, entitylbl)
1663+
}
16541664
default:
16551665
log.Fatalf("unexpected type %T", tp)
16561666
}

0 commit comments

Comments
 (0)