...
Source file
src/go/types/typelists.go
1
2
3
4
5
6
7 package types
8
9
10 type TypeParamList struct{ tparams []*TypeParam }
11
12
13
14 func (l *TypeParamList) Len() int { return len(l.list()) }
15
16
17 func (l *TypeParamList) At(i int) *TypeParam { return l.tparams[i] }
18
19
20
21
22 func (l *TypeParamList) list() []*TypeParam {
23 if l == nil {
24 return nil
25 }
26 return l.tparams
27 }
28
29
30 type TypeList struct{ types []Type }
31
32
33 func newTypeList(list []Type) *TypeList {
34 if len(list) == 0 {
35 return nil
36 }
37 return &TypeList{list}
38 }
39
40
41
42 func (l *TypeList) Len() int { return len(l.list()) }
43
44
45 func (l *TypeList) At(i int) Type { return l.types[i] }
46
47
48
49
50 func (l *TypeList) list() []Type {
51 if l == nil {
52 return nil
53 }
54 return l.types
55 }
56
57
58
59
60 func bindTParams(list []*TypeParam) *TypeParamList {
61 if len(list) == 0 {
62 return nil
63 }
64 for i, typ := range list {
65 if typ.index >= 0 {
66 panic("type parameter bound more than once")
67 }
68 typ.index = i
69 }
70 return &TypeParamList{tparams: list}
71 }
72
View as plain text