walkBeforeAfter(*n, before, after)
case **ast.FuncType:
walkBeforeAfter(*n, before, after)
+ case **ast.Ident:
+ walkBeforeAfter(*n, before, after)
// pointers to slices
- case *[]ast.Stmt:
+ case *[]ast.Decl:
walkBeforeAfter(*n, before, after)
case *[]ast.Expr:
walkBeforeAfter(*n, before, after)
- case *[]ast.Decl:
+ case *[]*ast.File:
+ walkBeforeAfter(*n, before, after)
+ case *[]*ast.Ident:
walkBeforeAfter(*n, before, after)
case *[]ast.Spec:
walkBeforeAfter(*n, before, after)
- case *[]*ast.File:
+ case *[]ast.Stmt:
walkBeforeAfter(*n, before, after)
// These are ordered and grouped to match ../../pkg/go/ast/ast.go
case *ast.ValueSpec:
walkBeforeAfter(&n.Type, before, after)
walkBeforeAfter(&n.Values, before, after)
+ walkBeforeAfter(&n.Names, before, after)
case *ast.TypeSpec:
walkBeforeAfter(&n.Type, before, after)
for i := range n {
walkBeforeAfter(&n[i], before, after)
}
+ case []*ast.Ident:
+ for i := range n {
+ walkBeforeAfter(&n[i], before, after)
+ }
case []ast.Stmt:
for i := range n {
walkBeforeAfter(&n[i], before, after)
ident.Name = "url_"
return
}
- // Find declared identifiers called url that might be confused.
- // TODO: Why does gofix not walk the Names in a ValueSpec?
- // TODO: Just a bug; fix later as it will have consequences.
- if valSpec, ok := n.(*ast.ValueSpec); ok {
- for _, ident := range valSpec.Names {
- if ident.Name == "url" {
- ident.Name = "url_"
- }
- }
- }
// Parameter and result names.
if fn, ok := n.(*ast.FuncType); ok {
fixed = urlDoFields(fn.Params) || fixed