Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 38 for CommClause (0.34 sec)

  1. src/cmd/compile/internal/syntax/nodes_test.go

    	{"CaseClause", `@default:`},
    }
    
    var comms = []test{
    	{"CommClause", `@case <-ch:`},
    	{"CommClause", `@case x <- ch:`},
    	{"CommClause", `@case x = <-ch:`},
    	{"CommClause", `@case x := <-ch:`},
    	{"CommClause", `@case x, ok = <-ch: f(1, 2, 3)`},
    	{"CommClause", `@case x, ok := <-ch: x++`},
    	{"CommClause", `@default:`},
    	{"CommClause", `@default: ch <- true`},
    }
    
    func TestPos(t *testing.T) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Nov 02 18:45:06 UTC 2023
    - 8.7K bytes
    - Viewed (0)
  2. src/cmd/compile/internal/walk/select.go

    	init := ir.TakeInit(sel)
    
    	init = append(init, walkSelectCases(sel.Cases)...)
    	sel.Cases = nil
    
    	sel.Compiled = init
    	walkStmtList(sel.Compiled)
    
    	base.Pos = lno
    }
    
    func walkSelectCases(cases []*ir.CommClause) []ir.Node {
    	ncas := len(cases)
    	sellineno := base.Pos
    
    	// optimization: zero-case select
    	if ncas == 0 {
    		return []ir.Node{mkcallstmt("block")}
    	}
    
    	// optimization: one-case select: single op.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Aug 22 01:53:41 UTC 2023
    - 7.8K bytes
    - Viewed (0)
  3. src/go/types/return.go

    		return check.isTerminatingSwitch(s.Body, label)
    
    	case *ast.TypeSwitchStmt:
    		return check.isTerminatingSwitch(s.Body, label)
    
    	case *ast.SelectStmt:
    		for _, s := range s.Body.List {
    			cc := s.(*ast.CommClause)
    			if !check.isTerminatingList(cc.Body, "") || hasBreakList(cc.Body, label, true) {
    				return false
    			}
    
    		}
    		return true
    
    	case *ast.ForStmt:
    		if s.Cond == nil && !hasBreak(s.Body, label, true) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Feb 22 19:32:17 UTC 2024
    - 4.2K bytes
    - Viewed (0)
  4. src/cmd/compile/internal/syntax/positions.go

    		// case *SwitchStmt:
    		// case *SelectStmt:
    
    		// helper nodes
    		case *RangeClause:
    			if n.Lhs != nil {
    				m = n.Lhs
    				continue
    			}
    			m = n.X
    		// case *CaseClause:
    		// case *CommClause:
    
    		default:
    			return n.Pos()
    		}
    	}
    }
    
    // EndPos returns the approximate end position of n in the source.
    // For some nodes (*Name, *BasicLit) it returns the position immediately
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Jun 10 17:49:19 UTC 2024
    - 6.5K bytes
    - Viewed (0)
  5. src/cmd/vendor/golang.org/x/tools/go/analysis/passes/unreachable/unreachable.go

    		d.findLabels(x.Body)
    		d.breakTarget = outer
    
    	case *ast.TypeSwitchStmt:
    		outer := d.breakTarget
    		d.breakTarget = x
    		d.findLabels(x.Body)
    		d.breakTarget = outer
    
    	case *ast.CommClause:
    		for _, stmt := range x.Body {
    			d.findLabels(stmt)
    		}
    
    	case *ast.CaseClause:
    		for _, stmt := range x.Body {
    			d.findLabels(stmt)
    		}
    	}
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 09 01:28:01 UTC 2023
    - 7.6K bytes
    - Viewed (0)
  6. src/cmd/compile/internal/syntax/nodes.go

    	}
    
    	SelectStmt struct {
    		Body   []*CommClause
    		Rbrace Pos
    		stmt
    	}
    )
    
    type (
    	RangeClause struct {
    		Lhs Expr // nil means no Lhs = or Lhs :=
    		Def bool // means :=
    		X   Expr // range X
    		simpleStmt
    	}
    
    	CaseClause struct {
    		Cases Expr // nil means default clause
    		Body  []Stmt
    		Colon Pos
    		node
    	}
    
    	CommClause struct {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Sep 20 14:52:38 UTC 2023
    - 9K bytes
    - Viewed (0)
  7. src/cmd/compile/internal/types2/return.go

    	for _, s := range list {
    		if hasBreakList(s.Body, label, implicit) {
    			return true
    		}
    	}
    	return false
    }
    
    func hasBreakCommList(list []*syntax.CommClause, label string, implicit bool) bool {
    	for _, s := range list {
    		if hasBreakList(s.Body, label, implicit) {
    			return true
    		}
    	}
    	return false
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Feb 22 19:32:17 UTC 2024
    - 4.4K bytes
    - Viewed (0)
  8. src/go/ast/ast.go

    		Init   Stmt       // initialization statement; or nil
    		Assign Stmt       // x := y.(type) or y.(type)
    		Body   *BlockStmt // CaseClauses only
    	}
    
    	// A CommClause node represents a case of a select statement.
    	CommClause struct {
    		Case  token.Pos // position of "case" or "default" keyword
    		Comm  Stmt      // send or receive statement; nil means default case
    		Colon token.Pos // position of ":"
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Mar 28 21:32:41 UTC 2024
    - 35.6K bytes
    - Viewed (0)
  9. src/cmd/vendor/golang.org/x/tools/go/ast/inspector/typeof.go

    	case *ast.BranchStmt:
    		return 1 << nBranchStmt
    	case *ast.CallExpr:
    		return 1 << nCallExpr
    	case *ast.CaseClause:
    		return 1 << nCaseClause
    	case *ast.ChanType:
    		return 1 << nChanType
    	case *ast.CommClause:
    		return 1 << nCommClause
    	case *ast.Comment:
    		return 1 << nComment
    	case *ast.CommentGroup:
    		return 1 << nCommentGroup
    	case *ast.CompositeLit:
    		return 1 << nCompositeLit
    	case *ast.DeclStmt:
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Dec 18 21:28:13 UTC 2023
    - 4.8K bytes
    - Viewed (0)
  10. src/cmd/vendor/golang.org/x/tools/go/cfg/builder.go

    	for _, clause := range s.Body.List {
    		if comm := clause.(*ast.CommClause).Comm; comm != nil {
    			b.stmt(comm)
    		}
    	}
    
    	done := b.newBlock(KindSelectDone, s)
    	if label != nil {
    		label._break = done
    	}
    
    	var defaultBody *[]ast.Stmt
    	for _, cc := range s.Body.List {
    		clause := cc.(*ast.CommClause)
    		if clause.Comm == nil {
    			defaultBody = &clause.Body
    			continue
    		}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 02 02:20:05 UTC 2024
    - 11.4K bytes
    - Viewed (0)
Back to top