- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 49 for GenDecl (0.13 sec)
-
src/go/ast/commentmap_test.go
" 5: *ast.Ident": " the name is p\n", " 8: *ast.GenDecl": "imports\n", " 9: *ast.ImportSpec": "bytes\n", "10: *ast.ImportSpec": "fmt\n", "16: *ast.GenDecl": "T\nalso associated with T\n", "17: *ast.Field": "associated with a, b, c\n", "19: *ast.Field": "associated with x, y\nfloat values\n", "20: *ast.Field": "complex value\n", "25: *ast.GenDecl": "x\nx = 0\nalso associated with x\n",
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Fri Sep 09 15:35:30 UTC 2022 - 3.9K bytes - Viewed (0) -
src/cmd/vendor/golang.org/x/tools/go/ast/astutil/imports.go
var groups [][]*ast.ImportSpec for _, decl := range f.Decls { genDecl, ok := decl.(*ast.GenDecl) if !ok || genDecl.Tok != token.IMPORT { break } group := []*ast.ImportSpec{} var lastLine int for _, spec := range genDecl.Specs { importSpec := spec.(*ast.ImportSpec) pos := importSpec.Path.ValuePos line := fset.Position(pos).Line
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue May 10 21:56:21 UTC 2022 - 13.4K bytes - Viewed (0) -
src/go/token/example_test.go
pos := decl.Pos() relPosition := fset.Position(pos) absPosition := fset.PositionFor(pos, false) // Either a FuncDecl or GenDecl, since we exit on error. kind := "func" if gen, ok := decl.(*ast.GenDecl); ok { kind = gen.Tok.String() } // If the relative and absolute positions differ, show both. fmtPosition := relPosition.String() if relPosition != absPosition {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon Oct 09 22:09:31 UTC 2023 - 1.7K bytes - Viewed (0) -
src/cmd/fix/fix.go
Value: strconv.Quote(ipath), }, } // Find an import decl to add to. var ( bestMatch = -1 lastImport = -1 impDecl *ast.GenDecl impIndex = -1 ) for i, decl := range f.Decls { gen, ok := decl.(*ast.GenDecl) if ok && gen.Tok == token.IMPORT { lastImport = i // Do not add to import "C", to avoid disrupting the // association with its doc comment, breaking cgo.
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon Dec 13 18:45:54 UTC 2021 - 14.6K bytes - Viewed (0) -
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) -
src/cmd/gofmt/simplify.go
ast.Walk(s, f) } func removeEmptyDeclGroups(f *ast.File) { i := 0 for _, d := range f.Decls { if g, ok := d.(*ast.GenDecl); !ok || !isEmpty(f, g) { f.Decls[i] = d i++ } } f.Decls = f.Decls[:i] } func isEmpty(f *ast.File, g *ast.GenDecl) bool { if g.Doc != nil || g.Specs != nil { return false } for _, c := range f.Comments {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu May 19 20:06:14 UTC 2022 - 4.8K bytes - Viewed (0) -
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) -
src/go/printer/performance_test.go
fileNode = file fileSize = int64(len(src)) for _, decl := range file.Decls { // The first global variable, which is pretty short: // // var unresolved = new(ast.Object) if decl, ok := decl.(*ast.GenDecl); ok && decl.Tok == token.VAR { declNode = decl declSize = int64(fset.Position(decl.End()).Offset - fset.Position(decl.Pos()).Offset) break } } } func BenchmarkPrintFile(b *testing.B) {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Fri Sep 09 15:10:10 UTC 2022 - 1.8K bytes - Viewed (0) -
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) -
src/cmd/cgo/ast.go
f.NamePos = make(map[*Name]token.Pos) // In ast1, find the import "C" line and get any extra C preamble. sawC := false for _, decl := range ast1.Decls { switch decl := decl.(type) { case *ast.GenDecl: for _, spec := range decl.Specs { s, ok := spec.(*ast.ImportSpec) if !ok || s.Path.Value != `"C"` { continue } sawC = true if s.Name != nil {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed Jun 07 16:54:27 UTC 2023 - 14.3K bytes - Viewed (0)