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

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Sun Jun 18 17:11:56 BST 2023


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

--- Comment #152 from Dmitry Selyutin <ghostmansd at gmail.com> ---
Sorry, typing from phone.

I know that we can use isdataclass in Hook(object). What I was trying to
express that we cannot do Hook(dataclass) because there's no dataclass class.
However, there is Dataclass class in our code, so we can just hook this one:
all our dataclasses inherit it.
Jacob, sorry, I'm not sure why you brought nmutil. I assumed we don't need
nmutil in decoupled mdis module.

I imagined something like this (pay attention to file name):
$ cat insndb/db.py
class Walker(mdis.walker.Walker)
    @mdis.dispatcher.Hook(core.Dataclass)
    def dispatch_dataclass(self, instance):
        for field in dataclasses.fields(instance):
            yield (field.name, getattr(instance, field.name))

Same for similar cases, if that's what you mean by bringing nmutil.
As for underscores — OK, I'll remove underscores.

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


More information about the libre-soc-bugs mailing list