Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 7 of 7 for checkBranches (0.15 sec)

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

    package syntax
    
    import (
    	"testing"
    )
    
    func TestDump(t *testing.T) {
    	if testing.Short() {
    		t.Skip("skipping test in short mode")
    	}
    
    	ast, _ := ParseFile(*src_, func(err error) { t.Error(err) }, nil, CheckBranches)
    
    	if ast != nil {
    		Fdump(testOut(), ast)
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Mar 30 18:02:31 UTC 2022
    - 424 bytes
    - Viewed (0)
  2. src/cmd/compile/internal/syntax/syntax.go

    package syntax
    
    import (
    	"fmt"
    	"io"
    	"os"
    )
    
    // Mode describes the parser mode.
    type Mode uint
    
    // Modes supported by the parser.
    const (
    	CheckBranches Mode = 1 << iota // check correct use of labels, break, continue, and goto statements
    )
    
    // Error describes a syntax error. Error implements the error interface.
    type Error struct {
    	Pos Pos
    	Msg string
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Apr 01 18:18:07 UTC 2022
    - 3.1K bytes
    - Viewed (0)
  3. src/cmd/compile/internal/syntax/branches.go

    package syntax
    
    import "fmt"
    
    // checkBranches checks correct use of labels and branch
    // statements (break, continue, fallthrough, goto) in a function body.
    // It catches:
    //   - misplaced breaks, continues, and fallthroughs
    //   - bad labeled breaks and continues
    //   - invalid, unused, duplicate, and missing labels
    //   - gotos jumping over variable declarations and into blocks
    func checkBranches(body *BlockStmt, errh ErrorHandler) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Sun Jun 26 00:21:29 UTC 2022
    - 9.8K bytes
    - Viewed (0)
  4. src/cmd/compile/internal/syntax/error_test.go

    				return
    			}
    			// we have a match - eliminate this error
    			delete(declared, pos)
    		} else {
    			t.Errorf("%s:%s: unexpected error: %s", filename, orig, e.Msg)
    		}
    	}, nil, CheckBranches)
    
    	if *print {
    		fmt.Println()
    		return // we're done
    	}
    
    	// report expected but not reported errors
    	for pos, pattern := range declared {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Sep 20 02:13:02 UTC 2022
    - 4.8K bytes
    - Viewed (0)
  5. src/cmd/compile/internal/syntax/nodes.go

    	}
    
    	BranchStmt struct {
    		Tok   token // Break, Continue, Fallthrough, or Goto
    		Label *Name
    		// Target is the continuation of the control flow after executing
    		// the branch; it is computed by the parser if CheckBranches is set.
    		// Target is a *LabeledStmt for gotos, and a *SwitchStmt, *SelectStmt,
    		// or *ForStmt for breaks and continues, depending on the context of
    		// the branch. Target is not set for fallthroughs.
    		Target Stmt
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Sep 20 14:52:38 UTC 2023
    - 9K bytes
    - Viewed (0)
  6. src/cmd/compile/internal/noder/noder.go

    				f, err := os.Open(filename)
    				if err != nil {
    					p.error(syntax.Error{Msg: err.Error()})
    					return
    				}
    				defer f.Close()
    
    				p.file, _ = syntax.Parse(fbase, f, p.error, p.pragma, syntax.CheckBranches) // errors are tracked via p.error
    			}()
    		}
    	}()
    
    	var lines uint
    	var m posMap
    	for _, p := range noders {
    		for e := range p.err {
    			base.ErrorfAt(m.makeXPos(e.Pos), 0, "%s", e.Msg)
    		}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Oct 11 20:40:57 UTC 2023
    - 12.5K bytes
    - Viewed (0)
  7. src/cmd/compile/internal/syntax/parser.go

    	// Don't check branches if there were syntax errors in the function
    	// as it may lead to spurious errors (e.g., see test/switch2.go) or
    	// possibly crashes due to incomplete syntax trees.
    	if p.mode&CheckBranches != 0 && errcnt == p.errcnt {
    		checkBranches(body, p.errh)
    	}
    
    	return body
    }
    
    // ----------------------------------------------------------------------------
    // Expressions
    
    func (p *parser) expr() Expr {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 30 19:19:55 UTC 2024
    - 62.9K bytes
    - Viewed (0)
Back to top