Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 274 for Fset (0.03 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/token/position_test.go

    func TestFileSetPastEnd(t *testing.T) {
    	fset := NewFileSet()
    	for _, test := range tests {
    		fset.AddFile(test.filename, fset.Base(), test.size)
    	}
    	if f := fset.File(Pos(fset.Base())); f != nil {
    		t.Errorf("got %v, want nil", f)
    	}
    }
    
    func TestFileSetCacheUnlikely(t *testing.T) {
    	fset := NewFileSet()
    	offsets := make(map[string]int)
    	for _, test := range tests {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Jan 31 20:26:14 UTC 2024
    - 14.3K bytes
    - Viewed (0)
  3. src/cmd/vendor/golang.org/x/tools/go/ast/astutil/imports.go

    					}
    				}
    				for _, cg := range f.Comments {
    					if cg.End() < spec.Pos() && fset.Position(cg.End()).Line == fset.Position(spec.Pos()).Line {
    						for fset.Position(gen.TokPos).Line+1 < fset.Position(spec.Pos()).Line {
    							fset.File(gen.TokPos).MergeLine(fset.Position(gen.TokPos).Line)
    						}
    						break
    					}
    				}
    			}
    			if j > 0 {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 10 21:56:21 UTC 2022
    - 13.4K bytes
    - Viewed (0)
  4. src/go/doc/testdata/template.txt

    {{range .}}	{{synopsis .Doc}}
    	{{node .Decl $.FSet}}
    
    {{end}}{{end}}{{/*
    
    */}}{{with .Vars}}
    VARIABLES
    {{range .}}	{{synopsis .Doc}}
    	{{node .Decl $.FSet}}
    
    {{end}}{{end}}{{/*
    
    */}}{{with .Funcs}}
    FUNCTIONS
    {{range .}}	{{synopsis .Doc}}
    	{{node .Decl $.FSet}}
    
    {{end}}{{end}}{{/*
    
    */}}{{with .Types}}
    TYPES
    {{range .}}	{{synopsis .Doc}}
    	{{node .Decl $.FSet}}
    
    {{range .Consts}}	{{synopsis .Doc}}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Sep 08 04:08:51 UTC 2014
    - 1.1K bytes
    - Viewed (0)
  5. src/go/parser/error_test.go

    func getFile(fset *token.FileSet, filename string) (file *token.File) {
    	fset.Iterate(func(f *token.File) bool {
    		if f.Name() == filename {
    			if file != nil {
    				panic(filename + " used multiple times")
    			}
    			file = f
    		}
    		return true
    	})
    	return file
    }
    
    func getPos(fset *token.FileSet, filename string, offset int) token.Pos {
    	if f := getFile(fset, filename); f != nil {
    		return f.Pos(offset)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Sep 27 19:47:49 UTC 2022
    - 5.9K bytes
    - Viewed (0)
  6. src/go/ast/print.go

    // struct fields are never printed.
    func Fprint(w io.Writer, fset *token.FileSet, x any, f FieldFilter) error {
    	return fprint(w, fset, x, f)
    }
    
    func fprint(w io.Writer, fset *token.FileSet, x any, f FieldFilter) (err error) {
    	// setup printer
    	p := printer{
    		output: w,
    		fset:   fset,
    		filter: f,
    		ptrmap: make(map[any]int),
    		last:   '\n', // force printing of line number on first line
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Mar 28 21:32:41 UTC 2024
    - 5.9K bytes
    - Viewed (0)
  7. src/go/doc/example_test.go

    func ExampleGreet_world() {
    	Greet("world")
    }
    `
    
    	// Create the AST by parsing src and test.
    	fset := token.NewFileSet()
    	files := []*ast.File{
    		mustParse(fset, "src.go", src),
    		mustParse(fset, "src_test.go", test),
    	}
    
    	// Compute package documentation with examples.
    	p, err := doc.NewFromFiles(fset, files, "example.com/p")
    	if err != nil {
    		panic(err)
    	}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 10 16:17:51 UTC 2022
    - 9.6K bytes
    - Viewed (0)
  8. src/go/types/example_test.go

    	pkg, err := conf.Check("temperature", fset, []*ast.File{f}, nil)
    	if err != nil {
    		log.Fatal(err)
    	}
    
    	// Print the method sets of Celsius and *Celsius.
    	celsius := pkg.Scope().Lookup("Celsius").Type()
    	for _, t := range []types.Type{celsius, types.NewPointer(celsius)} {
    		fmt.Printf("Method set of %s:\n", t)
    		mset := types.NewMethodSet(t)
    		for i := 0; i < mset.Len(); i++ {
    			fmt.Println(mset.At(i))
    		}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 8.9K bytes
    - Viewed (0)
  9. src/runtime/align_test.go

    	conf := types.Config{Importer: importer.Default()}
    	_, err = conf.Check("runtime", fset, files, &info)
    	if err != nil {
    		t.Fatalf("typechecking runtime failed: %v", err)
    	}
    
    	// Analyze all atomic.*64 callsites.
    	v := Visitor{t: t, fset: fset, types: info.Types, checked: checked}
    	ast.Walk(&v, pkg)
    }
    
    type Visitor struct {
    	fset    *token.FileSet
    	types   map[ast.Expr]types.TypeAndValue
    	checked map[string]bool
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Feb 08 14:52:12 UTC 2023
    - 5.4K bytes
    - Viewed (0)
  10. src/go/types/self_test.go

    	testenv.MustHaveGoBuild(t) // The Go command is needed for the importer to determine the locations of stdlib .a files.
    
    	fset := token.NewFileSet()
    	files, err := pkgFiles(fset, ".")
    	if err != nil {
    		t.Fatal(err)
    	}
    
    	conf := Config{Importer: importer.Default()}
    	_, err = conf.Check("go/types", fset, files, nil)
    	if err != nil {
    		t.Fatal(err)
    	}
    }
    
    func BenchmarkCheck(b *testing.B) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 23 19:39:00 UTC 2023
    - 2.8K bytes
    - Viewed (0)
Back to top