(node *ast.Node)
| 45 | type changeIdent struct{} |
| 46 | |
| 47 | func (changeIdent) Visit(node *ast.Node) { |
| 48 | id, ok := (*node).(*ast.IdentifierNode) |
| 49 | if !ok { |
| 50 | return |
| 51 | } |
| 52 | if id.Value == "foo" { |
| 53 | // A correct way to patch the node: |
| 54 | // |
| 55 | // newNode := &ast.IdentifierNode{Value: "bar"} |
| 56 | // ast.Patch(node, newNode) |
| 57 | // |
| 58 | // But we can do it in a wrong way: |
| 59 | id.Value = "bar" |
| 60 | } |
| 61 | } |
nothing calls this directly
no outgoing calls
no test coverage detected