Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 21 for GenDecl (0.47 sec)

  1. 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)
  2. 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)
  3. 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)
  4. 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)
  5. 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)
  6. 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)
  7. src/go/ast/example_test.go

    	// and AST nodes.
    	cmap := ast.NewCommentMap(fset, f, f.Comments)
    
    	// Remove the first variable declaration from the list of declarations.
    	for i, decl := range f.Decls {
    		if gen, ok := decl.(*ast.GenDecl); ok && gen.Tok == token.VAR {
    			copy(f.Decls[i:], f.Decls[i+1:])
    			f.Decls = f.Decls[:len(f.Decls)-1]
    			break
    		}
    	}
    
    	// Use the comment map to filter comments that don't belong anymore
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 15 21:44:50 UTC 2024
    - 6.1K bytes
    - Viewed (0)
  8. src/go/parser/parser_test.go

    	if err != nil {
    		t.Fatal(err)
    	}
    
    	// RHS refers to undefined globals; LHS does not.
    	as := f.Decls[0].(*ast.FuncDecl).Body.List[0].(*ast.DeclStmt).Decl.(*ast.GenDecl).Specs[0].(*ast.ValueSpec)
    	for _, v := range as.Values {
    		id := v.(*ast.Ident)
    		if id.Obj != nil {
    			t.Errorf("rhs %s has Obj, should not", id.Name)
    		}
    	}
    	for _, id := range as.Names {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Jan 31 20:26:14 UTC 2024
    - 24.6K bytes
    - Viewed (0)
  9. src/go/types/labels.go

    	}
    
    	var stmtBranches func(ast.Stmt)
    	stmtBranches = func(s ast.Stmt) {
    		switch s := s.(type) {
    		case *ast.DeclStmt:
    			if d, _ := s.Decl.(*ast.GenDecl); d != nil && d.Tok == token.VAR {
    				recordVarDecl(d.Pos())
    			}
    
    		case *ast.LabeledStmt:
    			// declare non-blank label
    			if name := s.Label.Name; name != "_" {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 30 19:19:55 UTC 2024
    - 7.2K bytes
    - Viewed (0)
  10. src/go/ast/walk.go

    		Walk(v, n.Name)
    		if n.TypeParams != nil {
    			Walk(v, n.TypeParams)
    		}
    		Walk(v, n.Type)
    		if n.Comment != nil {
    			Walk(v, n.Comment)
    		}
    
    	case *BadDecl:
    		// nothing to do
    
    	case *GenDecl:
    		if n.Doc != nil {
    			Walk(v, n.Doc)
    		}
    		walkList(v, n.Specs)
    
    	case *FuncDecl:
    		if n.Doc != nil {
    			Walk(v, n.Doc)
    		}
    		if n.Recv != nil {
    			Walk(v, n.Recv)
    		}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 16 16:34:10 UTC 2024
    - 6.4K bytes
    - Viewed (0)
Back to top