mirror of
https://github.com/hanzoai/expr.git
synced 2026-09-24 16:58:58 +00:00
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:
@@ -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{}),
|
||||
|
||||
Reference in New Issue
Block a user