Search Options

Results per page
Sort
Preferred Languages
Advance

Results 51 - 60 of 274 for Fset (0.04 sec)

  1. src/go/internal/srcimporter/srcimporter.go

    // os functions. The file set is used to track position information of package
    // files; and imported packages are added to the packages map.
    func New(ctxt *build.Context, fset *token.FileSet, packages map[string]*types.Package) *Importer {
    	return &Importer{
    		ctxt:     ctxt,
    		fset:     fset,
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Aug 23 18:54:32 UTC 2022
    - 8.2K bytes
    - Viewed (0)
  2. src/cmd/vendor/golang.org/x/tools/go/analysis/internal/analysisflags/flags.go

    // with context specified by the -c flag.
    func PrintPlain(fset *token.FileSet, diag analysis.Diagnostic) {
    	posn := fset.Position(diag.Pos)
    	fmt.Fprintf(os.Stderr, "%s: %s\n", posn, diag.Message)
    
    	// -c=N: show offending line plus N lines of context.
    	if Context >= 0 {
    		posn := fset.Position(diag.Pos)
    		end := fset.Position(diag.End)
    		if !end.IsValid() {
    			end = posn
    		}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Jan 22 19:00:13 UTC 2024
    - 12.1K bytes
    - Viewed (0)
  3. src/go/ast/issues_test.go

    		`package p; func _() {`,
    		`package p; func _() { _ = 0`,
    		`package p; func _() { _ = 0 }`,
    	} {
    		fset := token.NewFileSet()
    		f, _ := parser.ParseFile(fset, "", src, parser.AllErrors)
    		if f == nil {
    			panic("invalid test setup: parser didn't return an AST")
    		}
    
    		// find corresponding token.File
    		var tf *token.File
    		fset.Iterate(func(f *token.File) bool {
    			tf = f
    			return true
    		})
    		tfEnd := tf.Base() + tf.Size()
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 25 13:57:33 UTC 2023
    - 3.5K bytes
    - Viewed (0)
  4. src/go/types/api_test.go

    var nopos token.Pos
    
    func mustParse(fset *token.FileSet, src string) *ast.File {
    	f, err := parser.ParseFile(fset, pkgName(src), src, parser.ParseComments)
    	if err != nil {
    		panic(err) // so we don't need to pass *testing.T
    	}
    	return f
    }
    
    func typecheck(src string, conf *Config, info *Info) (*Package, error) {
    	fset := token.NewFileSet()
    	f := mustParse(fset, src)
    	if conf == nil {
    		conf = &Config{
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 94.2K bytes
    - Viewed (0)
  5. src/go/types/commentMap_test.go

    // recorded position is unknown (line, col = 0, 0).
    // If there are no matching comments, the result is nil.
    func commentMap(src []byte, rx *regexp.Regexp) (res map[int][]comment) {
    	fset := token.NewFileSet()
    	file := fset.AddFile("", -1, len(src))
    
    	var s scanner.Scanner
    	s.Init(file, src, nil, scanner.ScanComments)
    	var prev token.Pos // position of last non-comment, non-semicolon token
    
    	for {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jan 17 19:54:27 UTC 2023
    - 3K bytes
    - Viewed (0)
  6. src/go/ast/resolve.go

    // The result is a package node and a [scanner.ErrorList] if there were errors.
    //
    // Deprecated: use the type checker [go/types] instead; see [Object].
    func NewPackage(fset *token.FileSet, files map[string]*File, importer Importer, universe *Scope) (*Package, error) {
    	var p pkgBuilder
    	p.fset = fset
    
    	// complete package scope
    	pkgName := ""
    	pkgScope := NewScope(universe)
    	for _, file := range files {
    		// package names must match
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 19 12:02:03 UTC 2023
    - 5.4K bytes
    - Viewed (0)
  7. src/go/format/format_test.go

    }
    
    func TestNode(t *testing.T) {
    	src, err := os.ReadFile(testfile)
    	if err != nil {
    		t.Fatal(err)
    	}
    
    	fset := token.NewFileSet()
    	file, err := parser.ParseFile(fset, testfile, src, parser.ParseComments)
    	if err != nil {
    		t.Fatal(err)
    	}
    
    	var buf bytes.Buffer
    
    	if err = Node(&buf, fset, file); err != nil {
    		t.Fatal("Node failed:", err)
    	}
    
    	diff(t, buf.Bytes(), src)
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Sat Feb 20 03:54:46 UTC 2021
    - 4.5K bytes
    - Viewed (0)
  8. src/go/ast/walk_test.go

    	// yield for sibling nodes even after yield had returned false. With that
    	// bug, this test failed with a runtime panic.
    	src := "package p\ntype T struct {\n\tF int `json:\"f\"` // a field\n}\n"
    
    	fset := token.NewFileSet()
    	f, err := parser.ParseFile(fset, "", src, 0)
    	if err != nil {
    		panic(err)
    	}
    
    	for n := range ast.Preorder(f) {
    		if id, ok := n.(*ast.Ident); ok && id.Name == "F" {
    			break
    		}
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 16 16:34:10 UTC 2024
    - 916 bytes
    - Viewed (0)
  9. src/cmd/vendor/golang.org/x/tools/internal/aliases/aliases_go122.go

    	//     setting caused by os.Setenv("GODEBUG"), as happens in
    	//     many tests. Therefore any attempt to cache the result
    	//     is just incorrect.
    	fset := token.NewFileSet()
    	f, _ := parser.ParseFile(fset, "a.go", "package p; type A = int", 0)
    	pkg, _ := new(types.Config).Check("p", fset, []*ast.File{f}, nil)
    	_, enabled := pkg.Scope().Lookup("A").Type().(*types.Alias)
    	return enabled
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 03 02:38:00 UTC 2024
    - 2K bytes
    - Viewed (0)
  10. src/go/types/typeset_test.go

    	} {
    		// parse
    		src := "package p; type T interface" + body
    		fset := token.NewFileSet()
    		file, err := parser.ParseFile(fset, "p.go", src, parser.AllErrors)
    		if file == nil {
    			t.Fatalf("%s: %v (invalid test case)", body, err)
    		}
    
    		// type check
    		var conf Config
    		pkg, err := conf.Check(file.Name.Name, fset, []*ast.File{file}, nil)
    		if err != nil {
    			t.Fatalf("%s: %v (invalid test case)", body, err)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jun 07 21:37:14 UTC 2022
    - 2.3K bytes
    - Viewed (0)
Back to top