- Sort Score
- Result 10 results
- Languages All
Results 21 - 30 of 44 for GenDecl (0.2 sec)
-
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) -
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) -
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) -
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) -
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) -
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) -
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) -
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) -
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) -
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)