Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 27 for forStmt (0.18 sec)

  1. src/cmd/compile/internal/types2/labels.go

    				// whose execution terminates."
    				valid := false
    				if t := b.enclosingTarget(name); t != nil {
    					switch t.Stmt.(type) {
    					case *syntax.SwitchStmt, *syntax.SelectStmt, *syntax.ForStmt:
    						valid = true
    					}
    				}
    				if !valid {
    					check.errorf(s.Label, MisplacedLabel, "invalid break label %s", name)
    					return
    				}
    
    			case syntax.Continue:
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 30 19:19:55 UTC 2024
    - 7.2K bytes
    - Viewed (0)
  2. src/cmd/vendor/golang.org/x/tools/go/cfg/cfg.go

    	KindBody            // function body BlockStmt
    	KindForBody         // body of ForStmt
    	KindForDone         // block after ForStmt
    	KindForLoop         // head of ForStmt
    	KindForPost         // post condition of ForStmt
    	KindIfDone          // block after IfStmt
    	KindIfElse          // else block of IfStmt
    	KindIfThen          // then block of IfStmt
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 02 02:20:05 UTC 2024
    - 7.7K bytes
    - Viewed (0)
  3. src/cmd/compile/internal/types2/return.go

    	case *syntax.SelectStmt:
    		for _, cc := range s.Body {
    			if !check.isTerminatingList(cc.Body, "") || hasBreakList(cc.Body, label, true) {
    				return false
    			}
    
    		}
    		return true
    
    	case *syntax.ForStmt:
    		if _, ok := s.Init.(*syntax.RangeClause); ok {
    			// Range clauses guarantee that the loop terminates,
    			// so the loop is not a terminating statement. See go.dev/issue/49003.
    			break
    		}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Feb 22 19:32:17 UTC 2024
    - 4.4K bytes
    - Viewed (0)
  4. src/go/types/return.go

    		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) {
    			return true
    		}
    	}
    
    	return false
    }
    
    func (check *Checker) isTerminatingList(list []ast.Stmt, label string) bool {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Feb 22 19:32:17 UTC 2024
    - 4.2K bytes
    - Viewed (0)
  5. src/go/types/labels.go

    				// whose execution terminates."
    				valid := false
    				if t := b.enclosingTarget(name); t != nil {
    					switch t.Stmt.(type) {
    					case *ast.SwitchStmt, *ast.TypeSwitchStmt, *ast.SelectStmt, *ast.ForStmt, *ast.RangeStmt:
    						valid = true
    					}
    				}
    				if !valid {
    					check.errorf(s.Label, MisplacedLabel, "invalid break label %s", name)
    					return
    				}
    
    			case token.CONTINUE:
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 30 19:19:55 UTC 2024
    - 7.2K bytes
    - Viewed (0)
  6. src/cmd/vendor/golang.org/x/tools/go/cfg/builder.go

    	case *ast.SwitchStmt:
    		b.switchStmt(s, label)
    
    	case *ast.TypeSwitchStmt:
    		b.typeSwitchStmt(s, label)
    
    	case *ast.SelectStmt:
    		b.selectStmt(s, label)
    
    	case *ast.ForStmt:
    		b.forStmt(s, label)
    
    	case *ast.RangeStmt:
    		b.rangeStmt(s, label)
    
    	default:
    		panic(fmt.Sprintf("unexpected statement kind: %T", s))
    	}
    }
    
    func (b *builder) stmtList(list []ast.Stmt) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 02 02:20:05 UTC 2024
    - 11.4K bytes
    - Viewed (0)
  7. src/cmd/compile/internal/syntax/positions.go

    		// case *ExprStmt:
    		case *SendStmt:
    			m = n.Chan
    		// case *DeclStmt:
    		case *AssignStmt:
    			m = n.Lhs
    		// case *BranchStmt:
    		// case *CallStmt:
    		// case *ReturnStmt:
    		// case *IfStmt:
    		// case *ForStmt:
    		// case *SwitchStmt:
    		// case *SelectStmt:
    
    		// helper nodes
    		case *RangeClause:
    			if n.Lhs != nil {
    				m = n.Lhs
    				continue
    			}
    			m = n.X
    		// case *CaseClause:
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Jun 10 17:49:19 UTC 2024
    - 6.5K bytes
    - Viewed (0)
  8. src/cmd/vendor/golang.org/x/tools/go/analysis/passes/loopclosure/loopclosure.go

    }
    
    func run(pass *analysis.Pass) (interface{}, error) {
    	inspect := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector)
    
    	nodeFilter := []ast.Node{
    		(*ast.File)(nil),
    		(*ast.RangeStmt)(nil),
    		(*ast.ForStmt)(nil),
    	}
    	inspect.Nodes(nodeFilter, func(n ast.Node, push bool) bool {
    		if !push {
    			// inspect.Nodes is slightly suboptimal as we only use push=true.
    			return true
    		}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 02 02:20:05 UTC 2024
    - 10.3K bytes
    - Viewed (0)
  9. src/cmd/compile/internal/rangefunc/rewrite.go

    	}
    	return r.useObj(r.nextVar)
    }
    
    // forRangeFunc checks whether n is a range-over-func.
    // If so, it returns n.(*syntax.ForStmt), true.
    // Otherwise it returns nil, false.
    func forRangeFunc(n syntax.Node) (*syntax.ForStmt, bool) {
    	nfor, ok := n.(*syntax.ForStmt)
    	if !ok {
    		return nil, false
    	}
    	nrange, ok := nfor.Init.(*syntax.RangeClause)
    	if !ok {
    		return nil, false
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:05:44 UTC 2024
    - 41.6K bytes
    - Viewed (0)
  10. src/go/ast/ast.go

    	}
    
    	// A SelectStmt node represents a select statement.
    	SelectStmt struct {
    		Select token.Pos  // position of "select" keyword
    		Body   *BlockStmt // CommClauses only
    	}
    
    	// A ForStmt represents a for statement.
    	ForStmt struct {
    		For  token.Pos // position of "for" keyword
    		Init Stmt      // initialization statement; or nil
    		Cond Expr      // condition; or nil
    		Post Stmt      // post iteration statement; or nil
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Mar 28 21:32:41 UTC 2024
    - 35.6K bytes
    - Viewed (0)
Back to top