aboutsummaryrefslogtreecommitdiff
path: root/src/go/types/typelists.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/go/types/typelists.go')
-rw-r--r--src/go/types/typelists.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/go/types/typelists.go b/src/go/types/typelists.go
index a8181404bf..ef8ea1f32b 100644
--- a/src/go/types/typelists.go
+++ b/src/go/types/typelists.go
@@ -27,6 +27,14 @@ func (l *TParamList) list() []*TypeParam {
// TypeList holds a list of types.
type TypeList struct{ types []Type }
+// NewTypeList returns a new TypeList with the types in list.
+func NewTypeList(list []Type) *TypeList {
+ if len(list) == 0 {
+ return nil
+ }
+ return &TypeList{list}
+}
+
// Len returns the number of types in the list.
// It is safe to call on a nil receiver.
func (l *TypeList) Len() int { return len(l.list()) }