Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 15 for GenDecl (0.12 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/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)
  3. 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)
  4. 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)
  5. 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)
  6. 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)
  7. 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)
  8. src/go/ast/import.go

    // It also removes duplicate imports when it is possible to do so without data loss.
    func SortImports(fset *token.FileSet, f *File) {
    	for _, d := range f.Decls {
    		d, ok := d.(*GenDecl)
    		if !ok || d.Tok != token.IMPORT {
    			// Not an import declaration, so we're done.
    			// Imports are always first.
    			break
    		}
    
    		if !d.Lparen.IsValid() {
    			// Not a block: sorted by default.
    			continue
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 5.7K bytes
    - Viewed (0)
  9. src/go/printer/printer_test.go

    	err = Fprint(&buf, fset, f)
    	if err != nil {
    		t.Fatal(err)
    	}
    	original := buf.String()
    
    	// now remove parentheses from the declaration
    	for i := 0; i != len(f.Decls); i++ {
    		f.Decls[i].(*ast.GenDecl).Lparen = token.NoPos
    	}
    	buf.Reset()
    	err = Fprint(&buf, fset, f)
    	if err != nil {
    		t.Fatal(err)
    	}
    	noparen := buf.String()
    
    	if noparen != original {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Jun 03 14:56:25 UTC 2024
    - 20.4K bytes
    - Viewed (0)
  10. src/go/ast/filter.go

    // filtering.
    func FilterDecl(decl Decl, f Filter) bool {
    	return filterDecl(decl, f, false)
    }
    
    func filterDecl(decl Decl, f Filter, export bool) bool {
    	switch d := decl.(type) {
    	case *GenDecl:
    		d.Specs = filterSpecList(d.Specs, f, export)
    		return len(d.Specs) > 0
    	case *FuncDecl:
    		return f(d.Name.Name)
    	}
    	return false
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 13.3K bytes
    - Viewed (0)
Back to top