github.com/amarpal/go-tools@v0.0.0-20240422043104-40142f59f616/go/types/typeutil/ext.go (about)

     1  package typeutil
     2  
     3  import (
     4  	"fmt"
     5  	"go/types"
     6  )
     7  
     8  type Iterator struct {
     9  	elem types.Type
    10  }
    11  
    12  func (t *Iterator) Underlying() types.Type { return t }
    13  func (t *Iterator) String() string         { return fmt.Sprintf("iterator(%s)", t.elem) }
    14  func (t *Iterator) Elem() types.Type       { return t.elem }
    15  
    16  func NewIterator(elem types.Type) *Iterator {
    17  	return &Iterator{elem: elem}
    18  }