Search Options

Results per page
Sort
Preferred Languages
Advance

Results 31 - 40 of 51 for GenDecl (0.16 sec)

  1. 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)
  2. src/cmd/vendor/golang.org/x/tools/go/cfg/builder.go

    			// Calls to panic, os.Exit, etc, never return.
    			b.current = b.newBlock(KindUnreachable, s)
    		}
    
    	case *ast.DeclStmt:
    		// Treat each var ValueSpec as a separate statement.
    		d := s.Decl.(*ast.GenDecl)
    		if d.Tok == token.VAR {
    			for _, spec := range d.Specs {
    				if spec, ok := spec.(*ast.ValueSpec); ok {
    					b.add(spec)
    				}
    			}
    		}
    
    	case *ast.LabeledStmt:
    		label = b.labeledBlock(s.Label, s)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 02 02:20:05 UTC 2024
    - 11.4K bytes
    - Viewed (0)
  3. src/go/printer/nodes.go

    		p.print("BadDecl")
    	case *ast.GenDecl:
    		p.genDecl(d)
    	case *ast.FuncDecl:
    		p.funcDecl(d)
    	default:
    		panic("unreachable")
    	}
    }
    
    // ----------------------------------------------------------------------------
    // Files
    
    func declToken(decl ast.Decl) (tok token.Token) {
    	tok = token.ILLEGAL
    	switch d := decl.(type) {
    	case *ast.GenDecl:
    		tok = d.Tok
    	case *ast.FuncDecl:
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Oct 17 18:53:17 UTC 2023
    - 52.6K bytes
    - Viewed (0)
  4. src/cmd/go/internal/modindex/build_read.go

    	if info.parseErr != nil {
    		return nil
    	}
    
    	hasEmbed := false
    	for _, decl := range info.parsed.Decls {
    		d, ok := decl.(*ast.GenDecl)
    		if !ok {
    			continue
    		}
    		for _, dspec := range d.Specs {
    			spec, ok := dspec.(*ast.ImportSpec)
    			if !ok {
    				continue
    			}
    			quoted := spec.Path.Value
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Feb 23 10:10:21 UTC 2023
    - 13K bytes
    - Viewed (0)
  5. src/cmd/vendor/golang.org/x/tools/go/ast/astutil/rewrite.go

    			a.apply(n, "TypeParams", nil, tparams)
    		}
    		a.apply(n, "Type", nil, n.Type)
    		a.apply(n, "Comment", nil, n.Comment)
    
    	case *ast.BadDecl:
    		// nothing to do
    
    	case *ast.GenDecl:
    		a.apply(n, "Doc", nil, n.Doc)
    		a.applyList(n, "Specs")
    
    	case *ast.FuncDecl:
    		a.apply(n, "Doc", nil, n.Doc)
    		a.apply(n, "Recv", nil, n.Recv)
    		a.apply(n, "Name", nil, n.Name)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Dec 18 21:28:13 UTC 2023
    - 12.2K bytes
    - Viewed (0)
  6. src/go/printer/testdata/parser.go

    	p.declare(spec, p.topScope, ast.Var, idents...)
    
    	return spec
    }
    
    func (p *parser) parseGenDecl(keyword token.Token, f parseSpecFunction) *ast.GenDecl {
    	if p.trace {
    		defer un(trace(p, "GenDecl("+keyword.String()+")"))
    	}
    
    	doc := p.leadComment
    	pos := p.expect(keyword)
    	var lparen, rparen token.Pos
    	var list []ast.Spec
    	if p.tok == token.LPAREN {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Jul 20 20:19:51 UTC 2023
    - 50.5K bytes
    - Viewed (0)
  7. 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)
  8. src/cmd/compile/internal/ssa/_gen/rulegen.go

    			return false
    		}
    		return true
    	}
    	post := func(c *astutil.Cursor) bool {
    		switch node := c.Node().(type) {
    		case *ast.GenDecl:
    			if len(node.Specs) == 0 {
    				// Don't leave a broken or empty GenDecl behind,
    				// such as "import ()".
    				c.Delete()
    			}
    		}
    		return true
    	}
    	file = astutil.Apply(file, pre, post).(*ast.File)
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Sat Sep 02 22:09:21 UTC 2023
    - 48.7K bytes
    - Viewed (0)
  9. src/go/build/read.go

    	if info.parseErr != nil {
    		return nil
    	}
    
    	hasEmbed := false
    	for _, decl := range info.parsed.Decls {
    		d, ok := decl.(*ast.GenDecl)
    		if !ok {
    			continue
    		}
    		for _, dspec := range d.Specs {
    			spec, ok := dspec.(*ast.ImportSpec)
    			if !ok {
    				continue
    			}
    			quoted := spec.Path.Value
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 29 16:25:21 UTC 2024
    - 14.1K bytes
    - Viewed (0)
  10. src/cmd/cover/cover_test.go

    	if err != nil {
    		t.Fatal(err)
    	}
    
    	prevEnd := 0
    	for _, decl := range astFile.Decls {
    		var name string
    		switch d := decl.(type) {
    		case *ast.FuncDecl:
    			name = d.Name.Name
    		case *ast.GenDecl:
    			if len(d.Specs) == 0 {
    				// An empty group declaration. We still want to check that
    				// directives can be associated with it, so we make up a name
    				// to match directives in the test data.
    				name = "_empty"
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Jun 07 16:54:28 UTC 2023
    - 18.4K bytes
    - Viewed (0)
Back to top