| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent f7dcb11 commit 3952b1c
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -790,6 +790,9 @@ var BasicTypes = map[gotypes.BasicKind]*BranchType{ | |||
| 790 | 790 | // CompositeType is the type of all composite (that is, non-basic) types | |
| 791 | 791 | var CompositeType = NewUnionType("@compositetype") | |
| 792 | 792 | ||
| 793 | + // TypeParamType is the type of type parameter types | ||
| 794 | + var TypeParamType = TypeKind.NewBranch("@typeparamtype", CompositeType) | ||
| 795 | + | ||
| 793 | 796 | // ElementContainerType is the type of types that have elements, such as arrays | |
| 794 | 797 | // and channels | |
| 795 | 798 | var ElementContainerType = NewUnionType("@containertype", CompositeType) | |
@@ -1171,3 +1174,9 @@ var HasEllipsisTable = NewTable("has_ellipsis", | |||
| 1171 | 1174 | var VariadicTable = NewTable("variadic", | |
| 1172 | 1175 | EntityColumn(SignatureType, "id"), | |
| 1173 | 1176 | ) | |
| 1177 | + | ||
| 1178 | + var TypeParamTable = NewTable("typeparam", | ||
| 1179 | + EntityColumn(TypeParamType, "tp").Unique(), | ||
| 1180 | + StringColumn("name"), | ||
| 1181 | + EntityColumn(CompositeType, "bound"), | ||
| 1182 | + ) | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1464,6 +1464,9 @@ func extractType(tw *trap.Writer, tp types.Type) trap.Label { | |||
| 1464 | 1464 | dbscheme.MethodHostsTable.Emit(tw, methlbl, lbl) | |
| 1465 | 1465 | } | |
| 1466 | 1466 | } | |
| 1467 | + case *types.TypeParam: | ||
| 1468 | + kind = dbscheme.TypeParamType.Index() | ||
| 1469 | + dbscheme.TypeParamTable.Emit(tw, lbl, tp.Obj().Name(), extractType(tw, tp.Constraint())) | ||
| 1467 | 1470 | default: | |
| 1468 | 1471 | log.Fatalf("unexpected type %T", tp) | |
| 1469 | 1472 | } | |
@@ -1578,6 +1581,11 @@ func getTypeLabel(tw *trap.Writer, tp types.Type) (trap.Label, bool) { | |||
| 1578 | 1581 | extractObject(tw, origintp.Obj(), entitylbl) | |
| 1579 | 1582 | } | |
| 1580 | 1583 | lbl = tw.Labeler.GlobalID(fmt.Sprintf("{%s};namedtype", entitylbl)) | |
| 1584 | + case *types.TypeParam: | ||
| 1585 | + constraint := extractType(tw, tp.Constraint()) | ||
| 1586 | + lbl = tw.Labeler.GlobalID(fmt.Sprintf("{%s},{%s};typeparamtype", tp.Obj().Name(), constraint)) | ||
| 1587 | + default: | ||
| 1588 | + log.Fatalf("(getTypeLabel) unexpected type %T", tp) | ||
| 1581 | 1589 | } | |
| 1582 | 1590 | tw.Labeler.TypeLabels[tp] = lbl | |
| 1583 | 1591 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -225,6 +225,8 @@ has_ellipsis(int id: @callorconversionexpr ref); | |||
| 225 | 225 | ||
| 226 | 226 | variadic(int id: @signaturetype ref); | |
| 227 | 227 | ||
| 228 | + typeparam(unique int tp: @typeparamtype ref, string name: string ref, int bound: @compositetype ref); | ||
| 229 | + | ||
| 228 | 230 | @container = @file | @folder; | |
| 229 | 231 | ||
| 230 | 232 | @locatable = @xmllocatable | @node | @localscope; | |
@@ -476,18 +478,19 @@ case @type.kind of | |||
| 476 | 478 | | 23 = @complexliteraltype | |
| 477 | 479 | | 24 = @stringliteraltype | |
| 478 | 480 | | 25 = @nilliteraltype | |
| 479 | - | 26 = @arraytype | ||
| 480 | - | 27 = @slicetype | ||
| 481 | - | 28 = @structtype | ||
| 482 | - | 29 = @pointertype | ||
| 483 | - | 30 = @interfacetype | ||
| 484 | - | 31 = @tupletype | ||
| 485 | - | 32 = @signaturetype | ||
| 486 | - | 33 = @maptype | ||
| 487 | - | 34 = @sendchantype | ||
| 488 | - | 35 = @recvchantype | ||
| 489 | - | 36 = @sendrcvchantype | ||
| 490 | - | 37 = @namedtype; | ||
| 481 | + | 26 = @typeparamtype | ||
| 482 | + | 27 = @arraytype | ||
| 483 | + | 28 = @slicetype | ||
| 484 | + | 29 = @structtype | ||
| 485 | + | 30 = @pointertype | ||
| 486 | + | 31 = @interfacetype | ||
| 487 | + | 32 = @tupletype | ||
| 488 | + | 33 = @signaturetype | ||
| 489 | + | 34 = @maptype | ||
| 490 | + | 35 = @sendchantype | ||
| 491 | + | 36 = @recvchantype | ||
| 492 | + | 37 = @sendrcvchantype | ||
| 493 | + | 38 = @namedtype; | ||
| 491 | 494 | ||
| 492 | 495 | @basictype = @booltype | @numerictype | @stringtype | @literaltype | @invalidtype | @unsafepointertype; | |
| 493 | 496 | ||
@@ -510,7 +513,8 @@ case @type.kind of | |||
| 510 | 513 | @literaltype = @boolliteraltype | @intliteraltype | @runeliteraltype | @floatliteraltype | @complexliteraltype | |
| 511 | 514 | | @stringliteraltype | @nilliteraltype; | |
| 512 | 515 | ||
| 513 | - @compositetype = @containertype | @structtype | @pointertype | @interfacetype | @tupletype | @signaturetype | @namedtype; | ||
| 516 | + @compositetype = @typeparamtype | @containertype | @structtype | @pointertype | @interfacetype | @tupletype | ||
| 517 | + | @signaturetype | @namedtype; | ||
| 514 | 518 | ||
| 515 | 519 | @containertype = @arraytype | @slicetype | @maptype | @chantype; | |
| 516 | 520 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments