Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 44 for GenDecl (0.19 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/go/doc/example.go

    	for _, d := range depDecls {
    		switch d := d.(type) {
    		case *ast.GenDecl:
    			if d.Doc != nil {
    				comments = append(comments, d.Doc)
    			}
    		case *ast.FuncDecl:
    			if d.Doc != nil {
    				comments = append(comments, d.Doc)
    			}
    		}
    	}
    
    	// Synthesize import declaration.
    	importDecl := &ast.GenDecl{
    		Tok:    token.IMPORT,
    		Lparen: 1, // Need non-zero Lparen and Rparen so that printer
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 21.4K bytes
    - Viewed (0)
  4. src/cmd/doc/pkg.go

    	case nil:
    		return ""
    
    	case *ast.GenDecl:
    		// Formats const and var declarations.
    		trailer := ""
    		if len(n.Specs) > 1 {
    			trailer = " " + dotDotDot
    		}
    
    		// Find the first relevant spec.
    		typ := ""
    		for i, spec := range n.Specs {
    			valueSpec := spec.(*ast.ValueSpec) // Must succeed; we can't mix types in one GenDecl.
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Jan 08 20:15:52 UTC 2024
    - 32K 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/cmd/vendor/golang.org/x/tools/go/analysis/passes/copylock/copylock.go

    	nodeFilter := []ast.Node{
    		(*ast.AssignStmt)(nil),
    		(*ast.CallExpr)(nil),
    		(*ast.CompositeLit)(nil),
    		(*ast.FuncDecl)(nil),
    		(*ast.FuncLit)(nil),
    		(*ast.GenDecl)(nil),
    		(*ast.RangeStmt)(nil),
    		(*ast.ReturnStmt)(nil),
    	}
    	inspect.Preorder(nodeFilter, func(node ast.Node) {
    		switch node := node.(type) {
    		case *ast.RangeStmt:
    			checkCopyLocksRange(pass, node)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jun 04 16:19:04 UTC 2024
    - 9.9K bytes
    - Viewed (0)
  7. src/cmd/cgo/ast.go

    	f.NamePos = make(map[*Name]token.Pos)
    
    	// In ast1, find the import "C" line and get any extra C preamble.
    	sawC := false
    	for _, decl := range ast1.Decls {
    		switch decl := decl.(type) {
    		case *ast.GenDecl:
    			for _, spec := range decl.Specs {
    				s, ok := spec.(*ast.ImportSpec)
    				if !ok || s.Path.Value != `"C"` {
    					continue
    				}
    				sawC = true
    				if s.Name != nil {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Jun 07 16:54:27 UTC 2023
    - 14.3K bytes
    - Viewed (0)
  8. src/go/doc/reader.go

    // predeclared) type. The namedType for a type name is always found via
    // reader.lookupType.
    type namedType struct {
    	doc  string       // doc comment for type
    	name string       // type name
    	decl *ast.GenDecl // nil if declaration hasn't been seen yet
    
    	isEmbedded bool        // true if this type is embedded
    	isStruct   bool        // true if this type is a struct
    	embedded   embeddedSet // true if the embedded type is a pointer
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 27.5K bytes
    - Viewed (0)
  9. 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)
  10. src/go/ast/ast.go

    	}
    )
    
    // Pos and End implementations for declaration nodes.
    
    func (d *BadDecl) Pos() token.Pos  { return d.From }
    func (d *GenDecl) Pos() token.Pos  { return d.TokPos }
    func (d *FuncDecl) Pos() token.Pos { return d.Type.Pos() }
    
    func (d *BadDecl) End() token.Pos { return d.To }
    func (d *GenDecl) End() token.Pos {
    	if d.Rparen.IsValid() {
    		return d.Rparen + 1
    	}
    	return d.Specs[0].End()
    }
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Mar 28 21:32:41 UTC 2024
    - 35.6K bytes
    - Viewed (0)
Back to top