- Sort Score
- Result 10 results
- Languages All
Results 1 - 7 of 7 for NewCommentMap (0.29 sec)
-
src/go/ast/commentmap_test.go
return buf.String() } func TestCommentMap(t *testing.T) { fset := token.NewFileSet() f, err := parser.ParseFile(fset, "", src, parser.ParseComments) if err != nil { t.Fatal(err) } cmap := NewCommentMap(fset, f, f.Comments) // very correct association of comments for n, list := range cmap { key := fmt.Sprintf("%2d: %T", fset.Position(n.Pos()).Line, n) got := ctext(list) want := res[key]
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/go/ast/commentmap.go
// via the previous rules // // NewCommentMap tries to associate a comment group to the "largest" // node possible: For instance, if the comment is a line comment // trailing an assignment, the comment is associated with the entire // assignment rather than just the last operand in the assignment. func NewCommentMap(fset *token.FileSet, node Node, comments []*CommentGroup) CommentMap {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu May 23 01:00:11 UTC 2024 - 8.9K bytes - Viewed (0) -
src/go/ast/example_test.go
if err != nil { panic(err) } // Create an ast.CommentMap from the ast.File's comments. // This helps keeping the association between comments // 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 {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed May 15 21:44:50 UTC 2024 - 6.1K bytes - Viewed (0) -
src/cmd/internal/dwarf/putvarabbrevgen_test.go
} } func pvagenerate(t *testing.T) string { var fset token.FileSet f, err := parser.ParseFile(&fset, "./dwarf.go", nil, parser.ParseComments) if err != nil { t.Fatal(err) } cm := ast.NewCommentMap(&fset, f, f.Comments) abbrevs := make(map[string]int) funcs := map[string]ast.Stmt{} for _, decl := range f.Decls { decl, ok := decl.(*ast.FuncDecl) if !ok || decl.Body == nil { continue }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon Feb 26 20:45:07 UTC 2024 - 8.9K bytes - Viewed (0) -
src/cmd/gofmt/rewrite.go
fmt.Println() } */ // rewriteFile applies the rewrite rule 'pattern -> replace' to an entire file. func rewriteFile(fileSet *token.FileSet, pattern, replace ast.Expr, p *ast.File) *ast.File { cmap := ast.NewCommentMap(fileSet, p, p.Comments) m := make(map[string]reflect.Value) pat := reflect.ValueOf(pattern) repl := reflect.ValueOf(replace) var rewriteVal func(val reflect.Value) reflect.Value
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu Jul 27 22:07:13 UTC 2023 - 8.1K bytes - Viewed (0) -
src/cmd/vendor/golang.org/x/tools/internal/stdlib/manifest.go
{"Lbl", Const, 0}, {"MapType", Type, 0}, {"MapType.Key", Field, 0}, {"MapType.Map", Field, 0}, {"MapType.Value", Field, 0}, {"MergeMode", Type, 0}, {"MergePackageFiles", Func, 0}, {"NewCommentMap", Func, 1}, {"NewIdent", Func, 0}, {"NewObj", Func, 0}, {"NewPackage", Func, 0}, {"NewScope", Func, 0}, {"Node", Type, 0}, {"NotNilFilter", Func, 0}, {"ObjKind", Type, 0},
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue Apr 02 02:20:05 UTC 2024 - 534.2K bytes - Viewed (0) -
api/go1.1.txt
pkg go/ast, const Fun = 5 pkg go/ast, const Lbl = 6 pkg go/ast, const Pkg = 1 pkg go/ast, const RECV = 2 pkg go/ast, const SEND = 1 pkg go/ast, const Typ = 3 pkg go/ast, const Var = 4 pkg go/ast, func NewCommentMap(*token.FileSet, Node, []*CommentGroup) CommentMap pkg go/ast, method (CommentMap) Comments() []*CommentGroup pkg go/ast, method (CommentMap) Filter(Node) CommentMap pkg go/ast, method (CommentMap) String() string
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Thu Mar 31 20:37:15 UTC 2022 - 2.6M bytes - Viewed (0)