Do not repeat patcher definition in ExamplePatch() (#792)

I suppose at some point, godoc was not smart enough to display the
definitions used in the body of examples in the documentation. This is
not the case anymore: https://pkg.go.dev/github.com/expr-lang/expr#example-Patch
This commit is contained in:
Vincent Bernat
2025-05-26 10:03:53 +02:00
committed by GitHub
parent 9e10dcd6b4
commit c76a6cf3e8
-14
View File
@@ -504,20 +504,6 @@ func (p *patcher) Visit(node *ast.Node) {
}
func ExamplePatch() {
/*
type patcher struct{}
func (p *patcher) Visit(node *ast.Node) {
switch n := (*node).(type) {
case *ast.MemberNode:
ast.Patch(node, &ast.CallNode{
Callee: &ast.IdentifierNode{Value: "get"},
Arguments: []ast.Node{n.Node, n.Property},
})
}
}
*/
program, err := expr.Compile(
`greet.you.world + "!"`,
expr.Patch(&patcher{}),