Search Options

Results per page
Sort
Preferred Languages
Advance

Results 31 - 40 of 44 for GenDecl (0.37 sec)

  1. 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)
  2. 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)
  3. 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)
  4. 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)
  5. src/go/types/generate_test.go

    // insertImportPath inserts the given import path.
    // There must be at least one import declaration present already.
    func insertImportPath(f *ast.File, path string) {
    	for _, d := range f.Decls {
    		if g, _ := d.(*ast.GenDecl); g != nil && g.Tok == token.IMPORT {
    			g.Specs = append(g.Specs, &ast.ImportSpec{Path: &ast.BasicLit{ValuePos: g.End(), Kind: token.STRING, Value: path}})
    			return
    		}
    	}
    	panic("no import declaration present")
    }
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 03:01:18 UTC 2024
    - 16.5K bytes
    - Viewed (0)
  6. src/go/printer/printer.go

    	switch n := n.(type) {
    	case *ast.Field:
    		return n.Doc
    	case *ast.ImportSpec:
    		return n.Doc
    	case *ast.ValueSpec:
    		return n.Doc
    	case *ast.TypeSpec:
    		return n.Doc
    	case *ast.GenDecl:
    		return n.Doc
    	case *ast.FuncDecl:
    		return n.Doc
    	case *ast.File:
    		return n.Doc
    	}
    	return nil
    }
    
    func getLastComment(n ast.Node) *ast.CommentGroup {
    	switch n := n.(type) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Oct 19 12:02:03 UTC 2023
    - 41.6K bytes
    - Viewed (0)
  7. src/go/parser/resolver.go

    				r.walkLHS(lhs)
    				r.shortVarDecl(as)
    			} else {
    				r.walkExprs(lhs)
    			}
    		}
    		ast.Walk(r, n.Body)
    
    	// Declarations
    	case *ast.GenDecl:
    		switch n.Tok {
    		case token.CONST, token.VAR:
    			for i, spec := range n.Specs {
    				spec := spec.(*ast.ValueSpec)
    				kind := ast.Con
    				if n.Tok == token.VAR {
    					kind = ast.Var
    				}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Nov 02 12:56:53 UTC 2023
    - 15.8K bytes
    - Viewed (0)
  8. src/go/parser/parser.go

    		return x.Op == token.TILDE
    	case *ast.ParenExpr:
    		return isTypeElem(x.X)
    	}
    	return false
    }
    
    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: Fri Dec 08 20:07:50 UTC 2023
    - 72.2K bytes
    - Viewed (0)
  9. src/cmd/fix/typecheck.go

    			// Record typeof[fn.Name.Obj] for future references to fn.Name.
    			typeof[fn.Name.Obj] = t
    		}
    	}
    
    	// gather struct declarations
    	for _, decl := range f.Decls {
    		d, ok := decl.(*ast.GenDecl)
    		if ok {
    			for _, s := range d.Specs {
    				switch s := s.(type) {
    				case *ast.TypeSpec:
    					if cfg1.Type[s.Name.Name] != nil {
    						break
    					}
    					if !copied {
    						copied = true
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Nov 16 22:02:42 UTC 2022
    - 20.1K bytes
    - Viewed (0)
  10. src/go/types/decl.go

    	for _, d := range decls {
    		check.walkDecl(d, f)
    	}
    }
    
    func (check *Checker) walkDecl(d ast.Decl, f func(decl)) {
    	switch d := d.(type) {
    	case *ast.BadDecl:
    		// ignore
    	case *ast.GenDecl:
    		var last *ast.ValueSpec // last ValueSpec with type or init exprs seen
    		for iota, s := range d.Specs {
    			switch s := s.(type) {
    			case *ast.ImportSpec:
    				f(importDecl{s})
    			case *ast.ValueSpec:
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 30 19:19:55 UTC 2024
    - 31K bytes
    - Viewed (0)
Back to top