Skip to content

Commit f974b88

Browse files
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
1 parent 28d9b3d commit f974b88

File tree

1 file changed

+0
-14
lines changed

1 file changed

+0
-14
lines changed

expr_test.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -504,20 +504,6 @@ func (p *patcher) Visit(node *ast.Node) {
504504
}
505505

506506
func ExamplePatch() {
507-
/*
508-
type patcher struct{}
509-
510-
func (p *patcher) Visit(node *ast.Node) {
511-
switch n := (*node).(type) {
512-
case *ast.MemberNode:
513-
ast.Patch(node, &ast.CallNode{
514-
Callee: &ast.IdentifierNode{Value: "get"},
515-
Arguments: []ast.Node{n.Node, n.Property},
516-
})
517-
}
518-
}
519-
*/
520-
521507
program, err := expr.Compile(
522508
`greet.you.world + "!"`,
523509
expr.Patch(&patcher{}),

0 commit comments

Comments
 (0)