Source File
typelists.go
Belonging Package
go/types
// Code generated by "go test -run=Generate -write=all"; DO NOT EDIT.
// Source: ../../cmd/compile/internal/types2/typelists.go
// Copyright 2021 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package types
// TypeParamList holds a list of type parameters.
type TypeParamList struct{ tparams []*TypeParam }
// Len returns the number of type parameters in the list.
// It is safe to call on a nil receiver.
func ( *TypeParamList) () int { return len(.list()) }
// At returns the i'th type parameter in the list.
func ( *TypeParamList) ( int) *TypeParam { return .tparams[] }
// list is for internal use where we expect a []*TypeParam.
// TODO(rfindley): list should probably be eliminated: we can pass around a
// TypeParamList instead.
func ( *TypeParamList) () []*TypeParam {
if == nil {
return nil
}
return .tparams
}
// TypeList holds a list of types.
type TypeList struct{ types []Type }
// newTypeList returns a new TypeList with the types in list.
func newTypeList( []Type) *TypeList {
if len() == 0 {
return nil
}
return &TypeList{}
}
// Len returns the number of types in the list.
// It is safe to call on a nil receiver.
func ( *TypeList) () int { return len(.list()) }
// At returns the i'th type in the list.
func ( *TypeList) ( int) Type { return .types[] }
// list is for internal use where we expect a []Type.
// TODO(rfindley): list should probably be eliminated: we can pass around a
// TypeList instead.
func ( *TypeList) () []Type {
if == nil {
return nil
}
return .types
}
// ----------------------------------------------------------------------------
// Implementation
func bindTParams( []*TypeParam) *TypeParamList {
if len() == 0 {
return nil
}
for , := range {
if .index >= 0 {
panic("type parameter bound more than once")
}
.index =
}
return &TypeParamList{tparams: }
}
The pages are generated with Golds v0.7.0-preview. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |