MCPcopy
hub / github.com/expr-lang/expr / Visit

Method Visit

expr_test.go:1728–1741  ·  view source on GitHub ↗
(node *ast.Node)

Source from the content-addressed store, hash-verified

1726type stringerPatcher struct{}
1727
1728func (p *stringerPatcher) Visit(node *ast.Node) {
1729 t := (*node).Type()
1730 if t == nil {
1731 return
1732 }
1733 if t.Implements(stringer) {
1734 ast.Patch(node, &ast.CallNode{
1735 Callee: &ast.MemberNode{
1736 Node: *node,
1737 Property: &ast.StringNode{Value: "String"},
1738 },
1739 })
1740 }
1741}
1742
1743func TestPatch(t *testing.T) {
1744 program, err := expr.Compile(

Callers

nothing calls this directly

Calls 3

PatchFunction · 0.92
TypeMethod · 0.65
ImplementsMethod · 0.45

Tested by

no test coverage detected