```{index} single: walkoptree; B function ``` ```{index} single: B::walkoptree; Perl function ``` # walkoptree Recursively walk an optree, calling `$method` on each op. ## Synopsis ```perl B::walkoptree(B::main_root, "visit"); ``` Each op is blessed into its `B::*OP` class and then `$method` is dispatched on it. Children are visited after the parent. Back-end classes such as `B::Concise` define a visit method on their own package and call `walkoptree` to drive tree-traversal without writing the walk themselves.