miniwalker: add interface assertion (noop)

This commit is contained in:
mappu 2020-04-10 16:20:47 +12:00
parent 8986937340
commit 94fe16f681

View File

@ -34,6 +34,8 @@ func (mw *miniWalker) LeaveChildNode(key string, w walker.Walkable) {}
func (mw *miniWalker) EnterChildList(key string, w walker.Walkable) {} func (mw *miniWalker) EnterChildList(key string, w walker.Walkable) {}
func (mw *miniWalker) LeaveChildList(key string, w walker.Walkable) {} func (mw *miniWalker) LeaveChildList(key string, w walker.Walkable) {}
var _ walker.Visitor = &miniWalker{} // interface assertion
func walk(n node.Node, cb func(node.Node) error) error { func walk(n node.Node, cb func(node.Node) error) error {
mw := miniWalker{cb: cb} mw := miniWalker{cb: cb}
n.Walk(&mw) n.Walk(&mw)