Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 13 for SendOnly (0.19 sec)

  1. src/go/types/chan.go

    	dir  ChanDir
    	elem Type
    }
    
    // A ChanDir value indicates a channel direction.
    type ChanDir int
    
    // The direction of a channel is indicated by one of these constants.
    const (
    	SendRecv ChanDir = iota
    	SendOnly
    	RecvOnly
    )
    
    // NewChan returns a new channel type for the given direction and element type.
    func NewChan(dir ChanDir, elem Type) *Chan {
    	return &Chan{dir: dir, elem: elem}
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Apr 03 18:48:38 UTC 2024
    - 1K bytes
    - Viewed (0)
  2. src/go/internal/gcimporter/support.go

    )
    
    func chanDir(d int) types.ChanDir {
    	// tag values must match the constants in cmd/compile/internal/gc/go.go
    	switch d {
    	case 1 /* Crecv */ :
    		return types.RecvOnly
    	case 2 /* Csend */ :
    		return types.SendOnly
    	case 3 /* Cboth */ :
    		return types.SendRecv
    	default:
    		errorf("unexpected channel dir %d", d)
    		return 0
    	}
    }
    
    var predeclared = []types.Type{
    	// basic types
    	types.Typ[types.Bool],
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 07 20:08:23 UTC 2024
    - 4.1K bytes
    - Viewed (0)
  3. src/cmd/compile/internal/types2/typexpr.go

    		return typ
    
    	case *syntax.ChanType:
    		typ := new(Chan)
    		setDefType(def, typ)
    
    		dir := SendRecv
    		switch e.Dir {
    		case 0:
    			// nothing to do
    		case syntax.SendOnly:
    			dir = SendOnly
    		case syntax.RecvOnly:
    			dir = RecvOnly
    		default:
    			check.errorf(e, InvalidSyntaxTree, "unknown channel direction %d", e.Dir)
    			// ok to continue
    		}
    
    		typ.dir = dir
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 30 19:19:55 UTC 2024
    - 16.6K bytes
    - Viewed (0)
  4. src/go/types/typestring.go

    		var parens bool
    		switch t.dir {
    		case SendRecv:
    			s = "chan "
    			// chan (<-chan T) requires parentheses
    			if c, _ := t.elem.(*Chan); c != nil && c.dir == RecvOnly {
    				parens = true
    			}
    		case SendOnly:
    			s = "chan<- "
    		case RecvOnly:
    			s = "<-chan "
    		default:
    			w.error("unknown channel direction")
    		}
    		w.string(s)
    		if parens {
    			w.byte('(')
    		}
    		w.typ(t.elem)
    		if parens {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 03:01:18 UTC 2024
    - 12.3K bytes
    - Viewed (0)
  5. src/cmd/compile/internal/types2/typestring.go

    		var parens bool
    		switch t.dir {
    		case SendRecv:
    			s = "chan "
    			// chan (<-chan T) requires parentheses
    			if c, _ := t.elem.(*Chan); c != nil && c.dir == RecvOnly {
    				parens = true
    			}
    		case SendOnly:
    			s = "chan<- "
    		case RecvOnly:
    			s = "<-chan "
    		default:
    			w.error("unknown channel direction")
    		}
    		w.string(s)
    		if parens {
    			w.byte('(')
    		}
    		w.typ(t.elem)
    		if parens {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 03:01:18 UTC 2024
    - 12.2K bytes
    - Viewed (0)
  6. src/cmd/compile/internal/syntax/parser.go

    		//
    		//   <-(chan E)   =>  (<-chan E)
    		//   <-(chan<-E)  =>  (<-chan (<-E))
    
    		if _, ok := x.(*ChanType); ok {
    			// x is a channel type => re-associate <-
    			dir := SendOnly
    			t := x
    			for dir == SendOnly {
    				c, ok := t.(*ChanType)
    				if !ok {
    					break
    				}
    				dir = c.Dir
    				if dir == RecvOnly {
    					// t is type <-chan E but <-<-chan E is not permitted
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 30 19:19:55 UTC 2024
    - 62.9K bytes
    - Viewed (0)
  7. src/go/types/typexpr.go

    		return typ
    
    	case *ast.ChanType:
    		typ := new(Chan)
    		setDefType(def, typ)
    
    		dir := SendRecv
    		switch e.Dir {
    		case ast.SEND | ast.RECV:
    			// nothing to do
    		case ast.SEND:
    			dir = SendOnly
    		case ast.RECV:
    			dir = RecvOnly
    		default:
    			check.errorf(e, InvalidSyntaxTree, "unknown channel direction %d", e.Dir)
    			// ok to continue
    		}
    
    		typ.dir = dir
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 30 19:19:55 UTC 2024
    - 16.3K bytes
    - Viewed (0)
  8. src/go/types/stmt.go

    	case *Array:
    		return Typ[Int], typ.elem, "", false, true
    	case *Slice:
    		return Typ[Int], typ.elem, "", false, true
    	case *Map:
    		return typ.key, typ.elem, "", false, true
    	case *Chan:
    		if typ.dir == SendOnly {
    			return bad("receive from send-only channel")
    		}
    		return typ.elem, nil, "", false, true
    	case *Signature:
    		if !buildcfg.Experiment.RangeFunc && allowVersion != nil && !allowVersion(go1_23) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 30 19:19:55 UTC 2024
    - 30.6K bytes
    - Viewed (0)
  9. src/go/internal/gccgoimporter/parser.go

    	p.expectKeyword("chan")
    
    	t := new(types.Chan)
    	p.update(t, nlist)
    
    	dir := types.SendRecv
    	switch p.tok {
    	case '-':
    		p.next()
    		p.expect('<')
    		dir = types.SendOnly
    
    	case '<':
    		// don't consume '<' if it belongs to Type
    		if p.scanner.Peek() == '-' {
    			p.next()
    			p.expect('-')
    			dir = types.RecvOnly
    		}
    	}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Feb 02 23:14:07 UTC 2024
    - 31.2K bytes
    - Viewed (0)
  10. src/cmd/compile/internal/types2/stmt.go

    	case *Array:
    		return Typ[Int], typ.elem, "", false, true
    	case *Slice:
    		return Typ[Int], typ.elem, "", false, true
    	case *Map:
    		return typ.key, typ.elem, "", false, true
    	case *Chan:
    		if typ.dir == SendOnly {
    			return bad("receive from send-only channel")
    		}
    		return typ.elem, nil, "", false, true
    	case *Signature:
    		if !buildcfg.Experiment.RangeFunc && allowVersion != nil && !allowVersion(go1_23) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 30 19:19:55 UTC 2024
    - 30.7K bytes
    - Viewed (0)
Back to top