Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 36 for Fset (0.09 sec)

  1. src/go/printer/printer_test.go

    	const src = `// comment 1
    	// comment 2
    	// comment 3
    	package main
    	`
    
    	fset := token.NewFileSet()
    	f, err := parser.ParseFile(fset, "", src, parser.ParseComments)
    	if err != nil {
    		panic(err) // error in test
    	}
    
    	var buf bytes.Buffer
    	fset = token.NewFileSet() // use the wrong file set
    	Fprint(&buf, fset, f)
    
    	nlines := 0
    	for _, ch := range buf.Bytes() {
    		if ch == '\n' {
    			nlines++
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Jun 03 14:56:25 UTC 2024
    - 20.4K bytes
    - Viewed (0)
  2. src/go/internal/gcimporter/gcimporter_test.go

    	}
    
    	imports := make(map[string]*types.Package)
    	fset := token.NewFileSet()
    	_, err := Import(fset, imports, "net/http", ".", nil)
    	if err != nil {
    		t.Fatal(err)
    	}
    
    	mutex := imports["sync"].Scope().Lookup("Mutex").(*types.TypeName).Type()
    	mset := types.NewMethodSet(types.NewPointer(mutex)) // methods of *sync.Mutex
    	sel := mset.Lookup(nil, "Lock")
    	lock := sel.Obj().(*types.Func)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 17 16:22:59 UTC 2024
    - 21.9K bytes
    - Viewed (0)
  3. src/go/types/issues_test.go

    .*have M5[(]struct{b[.]S; b[.]t}[)]
    .*want M5[(]struct{b[.]S; t}[)]`},
    	}
    
    	fset := token.NewFileSet()
    	test := func(main, b, want string) {
    		re := regexp.MustCompile(want)
    		bpkg := mustTypecheck(b, nil, nil)
    		mast := mustParse(fset, main)
    		conf := Config{Importer: importHelper{pkg: bpkg}}
    		_, err := conf.Check(mast.Name.Name, fset, []*ast.File{mast}, nil)
    		if err == nil {
    			t.Error("Expected failure, but it did not")
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 30 19:19:55 UTC 2024
    - 28.1K bytes
    - Viewed (0)
  4. src/cmd/cover/cover.go

    func (p *Package) annotateFile(name string, fd io.Writer) {
    	fset := token.NewFileSet()
    	content, err := os.ReadFile(name)
    	if err != nil {
    		log.Fatalf("cover: %s: %s", name, err)
    	}
    	parsedFile, err := parser.ParseFile(fset, name, content, parser.ParseComments)
    	if err != nil {
    		log.Fatalf("cover: %s: %s", name, err)
    	}
    
    	file := &File{
    		fset:    fset,
    		name:    name,
    		content: content,
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 14 19:41:17 UTC 2024
    - 34.5K bytes
    - Viewed (0)
  5. src/cmd/vendor/golang.org/x/tools/go/analysis/passes/copylock/copylock.go

    func checkCopyLocksAssign(pass *analysis.Pass, as *ast.AssignStmt) {
    	for i, x := range as.Rhs {
    		if path := lockPathRhs(pass, x); path != nil {
    			pass.ReportRangef(x, "assignment copies lock value to %v: %v", analysisutil.Format(pass.Fset, as.Lhs[i]), path)
    		}
    	}
    }
    
    // checkCopyLocksGenDecl checks whether lock is copied
    // in variable declaration.
    func checkCopyLocksGenDecl(pass *analysis.Pass, gd *ast.GenDecl) {
    	if gd.Tok != token.VAR {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jun 04 16:19:04 UTC 2024
    - 9.9K bytes
    - Viewed (0)
  6. src/go/types/check_test.go

    )
    
    var fset = token.NewFileSet()
    
    func parseFiles(t *testing.T, filenames []string, srcs [][]byte, mode parser.Mode) ([]*ast.File, []error) {
    	var files []*ast.File
    	var errlist []error
    	for i, filename := range filenames {
    		file, err := parser.ParseFile(fset, filename, srcs[i], mode)
    		if file == nil {
    			t.Fatalf("%s: %s", filename, err)
    		}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 22 19:45:33 UTC 2024
    - 14.1K bytes
    - Viewed (0)
  7. src/go/build/read.go

    		for r.err == nil && !r.eof {
    			r.readByte()
    		}
    		info.header = r.buf
    	}
    	if r.err != nil {
    		return r.err
    	}
    
    	if info.fset == nil {
    		return nil
    	}
    
    	// Parse file header & record imports.
    	info.parsed, info.parseErr = parser.ParseFile(info.fset, info.name, info.header, parser.ImportsOnly|parser.ParseComments)
    	if info.parseErr != nil {
    		return nil
    	}
    
    	hasEmbed := false
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 29 16:25:21 UTC 2024
    - 14.1K bytes
    - Viewed (0)
  8. src/go/types/api.go

    // behavior if ignored.
    type Error struct {
    	Fset *token.FileSet // file set for interpretation of Pos
    	Pos  token.Pos      // error position
    	Msg  string         // error message
    	Soft bool           // if set, error is "soft"
    
    	// go116code is a future API, unexported as the set of error codes is large
    	// and likely to change significantly during experimentation. Tools wishing
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 15 19:57:43 UTC 2024
    - 17.2K bytes
    - Viewed (0)
  9. src/cmd/vendor/golang.org/x/tools/internal/analysisinternal/analysis.go

    	"go/token"
    	"go/types"
    	"os"
    	"strconv"
    
    	"golang.org/x/tools/go/analysis"
    	"golang.org/x/tools/internal/aliases"
    )
    
    func TypeErrorEndPos(fset *token.FileSet, src []byte, start token.Pos) token.Pos {
    	// Get the end position for the type error.
    	offset, end := fset.PositionFor(start, false).Offset, start
    	if offset >= len(src) {
    		return end
    	}
    	if width := bytes.IndexAny(src[offset:], " \n,():;[]+-*"); width > 0 {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jun 04 16:19:04 UTC 2024
    - 11.7K bytes
    - Viewed (0)
  10. src/go/internal/gcimporter/iimport.go

    		// name (name with subscript).
    		tparamIndex: make(map[ident]*types.TypeParam),
    
    		fake: fakeFileSet{
    			fset:  fset,
    			files: make(map[string]*fileInfo),
    		},
    	}
    	defer p.fake.setLines() // set lines for files in fset
    
    	for i, pt := range predeclared {
    		p.typCache[uint64(i)] = pt
    	}
    	// Special handling for "any", whose representation may be changed by the
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 19.2K bytes
    - Viewed (0)
Back to top