[Libre-soc-bugs] [Bug 1094] insndb instruction database visitor-walker is needed

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Mon Jun 12 13:03:49 BST 2023


https://bugs.libre-soc.org/show_bug.cgi?id=1094

--- Comment #131 from Dmitry Selyutin <ghostmansd at gmail.com> ---
https://libre-soc.org/irclog/%23libre-soc.2023-06-12.log.html#t2023-06-12T12:07:42

Two ideas:
1. Paths or indices can be nodes as well, and be visitable. This allows to
solve the issue on how and what to pass to visitor method.
2. We should support loose matches for visitor handlers, likely traversing MRO.
The visitor below handles any Dict in a generic way but has a special logic for
Operands:

class MagicVisitor(Visitor):
    @visitmethod(Operands)
    def Operands(self, node):
        print("Oh and this is Operands node!", node)
        yield node

    @visitmethod(Dict)
    def Dict(self, node):
        print(node)
        yield node

And basically the default __call__ becomes @visitormethod(object)!

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the libre-soc-bugs mailing list