Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 18 for GenDecl (0.13 sec)

  1. src/go/ast/commentmap_test.go

    	" 5: *ast.Ident":      " the name is p\n",
    	" 8: *ast.GenDecl":    "imports\n",
    	" 9: *ast.ImportSpec": "bytes\n",
    	"10: *ast.ImportSpec": "fmt\n",
    	"16: *ast.GenDecl":    "T\nalso associated with T\n",
    	"17: *ast.Field":      "associated with a, b, c\n",
    	"19: *ast.Field":      "associated with x, y\nfloat values\n",
    	"20: *ast.Field":      "complex value\n",
    	"25: *ast.GenDecl":    "x\nx = 0\nalso associated with x\n",
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Sep 09 15:35:30 UTC 2022
    - 3.9K bytes
    - Viewed (0)
  2. src/go/token/example_test.go

    		pos := decl.Pos()
    		relPosition := fset.Position(pos)
    		absPosition := fset.PositionFor(pos, false)
    
    		// Either a FuncDecl or GenDecl, since we exit on error.
    		kind := "func"
    		if gen, ok := decl.(*ast.GenDecl); ok {
    			kind = gen.Tok.String()
    		}
    
    		// If the relative and absolute positions differ, show both.
    		fmtPosition := relPosition.String()
    		if relPosition != absPosition {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Oct 09 22:09:31 UTC 2023
    - 1.7K bytes
    - Viewed (0)
  3. src/cmd/gofmt/simplify.go

    	ast.Walk(s, f)
    }
    
    func removeEmptyDeclGroups(f *ast.File) {
    	i := 0
    	for _, d := range f.Decls {
    		if g, ok := d.(*ast.GenDecl); !ok || !isEmpty(f, g) {
    			f.Decls[i] = d
    			i++
    		}
    	}
    	f.Decls = f.Decls[:i]
    }
    
    func isEmpty(f *ast.File, g *ast.GenDecl) bool {
    	if g.Doc != nil || g.Specs != nil {
    		return false
    	}
    
    	for _, c := range f.Comments {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 19 20:06:14 UTC 2022
    - 4.8K bytes
    - Viewed (0)
  4. src/go/format/format_test.go

    	wantLit := file.Decls[0].(*ast.GenDecl).Specs[0].(*ast.ValueSpec).Values[0].(*ast.BasicLit)
    	wantVal := wantLit.Value
    
    	var buf bytes.Buffer
    	if err = Node(&buf, fset, file); err != nil {
    		t.Fatal("Node failed:", err)
    	}
    	diff(t, buf.Bytes(), []byte(golden))
    
    	// Check if anything changed after Node returned.
    	gotLit := file.Decls[0].(*ast.GenDecl).Specs[0].(*ast.ValueSpec).Values[0].(*ast.BasicLit)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Sat Feb 20 03:54:46 UTC 2021
    - 4.5K bytes
    - Viewed (0)
  5. src/go/printer/performance_test.go

    	fileNode = file
    	fileSize = int64(len(src))
    
    	for _, decl := range file.Decls {
    		// The first global variable, which is pretty short:
    		//
    		//	var unresolved = new(ast.Object)
    		if decl, ok := decl.(*ast.GenDecl); ok && decl.Tok == token.VAR {
    			declNode = decl
    			declSize = int64(fset.Position(decl.End()).Offset - fset.Position(decl.Pos()).Offset)
    			break
    		}
    
    	}
    }
    
    func BenchmarkPrintFile(b *testing.B) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Sep 09 15:10:10 UTC 2022
    - 1.8K bytes
    - Viewed (0)
  6. src/go/doc/filter.go

    	if fields != nil {
    		for _, field := range fields.List {
    			for _, name := range field.Names {
    				if f(name.Name) {
    					return true
    				}
    			}
    		}
    	}
    	return false
    }
    
    func matchDecl(d *ast.GenDecl, f Filter) bool {
    	for _, d := range d.Specs {
    		switch v := d.(type) {
    		case *ast.ValueSpec:
    			for _, name := range v.Names {
    				if f(name.Name) {
    					return true
    				}
    			}
    		case *ast.TypeSpec:
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Apr 01 18:18:07 UTC 2022
    - 2.2K bytes
    - Viewed (0)
  7. src/internal/types/errors/generrordocs.go

    	}
    	_, err = conf.Check("types", fset, []*ast.File{file}, info)
    	if err != nil {
    		log.Fatalf("Check failed: %s", err)
    	}
    	for _, decl := range file.Decls {
    		decl, ok := decl.(*ast.GenDecl)
    		if !ok || decl.Tok != token.CONST {
    			continue
    		}
    		for _, spec := range decl.Specs {
    			spec, ok := spec.(*ast.ValueSpec)
    			if !ok || len(spec.Names) == 0 {
    				continue
    			}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 24 03:14:42 UTC 2023
    - 3K bytes
    - Viewed (0)
  8. src/cmd/cgo/godefs.go

    	// except in the definition (handled at end of function).
    	refName := make(map[*ast.Expr]*Name)
    	for _, r := range f.Ref {
    		refName[r.Expr] = r.Name
    	}
    	for _, d := range f.AST.Decls {
    		d, ok := d.(*ast.GenDecl)
    		if !ok || d.Tok != token.TYPE {
    			continue
    		}
    		for _, s := range d.Specs {
    			s := s.(*ast.TypeSpec)
    			n := refName[&s.Type]
    			if n != nil && n.Mangle != "" {
    				override[n.Mangle] = s.Name.Name
    			}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 20 15:50:06 UTC 2024
    - 3.2K bytes
    - Viewed (0)
  9. src/cmd/internal/goobj/mkbuiltin.go

    				log.Fatal("unexpected function body")
    			}
    			declName := pkg + "." + decl.Name.Name
    			decls[declName] = true
    			fmt.Fprintf(w, "{%q, 1},\n", declName) // functions are ABIInternal (1)
    		case *ast.GenDecl:
    			if decl.Tok == token.IMPORT {
    				continue
    			}
    			if decl.Tok != token.VAR {
    				log.Fatal("unhandled declaration kind", decl.Tok)
    			}
    			for _, spec := range decl.Specs {
    				spec := spec.(*ast.ValueSpec)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 19 23:33:27 UTC 2023
    - 3.8K bytes
    - Viewed (0)
  10. src/go/format/format.go

    		ast.SortImports(fset, file)
    	}
    
    	return format(fset, file, sourceAdj, indentAdj, src, config)
    }
    
    func hasUnsortedImports(file *ast.File) bool {
    	for _, d := range file.Decls {
    		d, ok := d.(*ast.GenDecl)
    		if !ok || d.Tok != token.IMPORT {
    			// Not an import declaration, so we're done.
    			// Imports are always first.
    			return false
    		}
    		if d.Lparen.IsValid() {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 19 12:02:03 UTC 2023
    - 4.3K bytes
    - Viewed (0)
Back to top