1// Code generated by "go test -run=Generate -write=all"; DO NOT EDIT. 2// Source: ../../cmd/compile/internal/types2/chan.go 3 4// Copyright 2011 The Go Authors. All rights reserved. 5// Use of this source code is governed by a BSD-style 6// license that can be found in the LICENSE file. 7 8package types 9 10// A Chan represents a channel type. 11type Chan struct { 12 dir ChanDir 13 elem Type 14} 15 16// A ChanDir value indicates a channel direction. 17type ChanDir int 18 19// The direction of a channel is indicated by one of these constants. 20const ( 21 SendRecv ChanDir = iota 22 SendOnly 23 RecvOnly 24) 25 26// NewChan returns a new channel type for the given direction and element type. 27func NewChan(dir ChanDir, elem Type) *Chan { 28 return &Chan{dir: dir, elem: elem} 29} 30 31// Dir returns the direction of channel c. 32func (c *Chan) Dir() ChanDir { return c.dir } 33 34// Elem returns the element type of channel c. 35func (c *Chan) Elem() Type { return c.elem } 36 37func (c *Chan) Underlying() Type { return c } 38func (c *Chan) String() string { return TypeString(c, nil) } 39