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

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Wed Jun 21 17:53:30 BST 2023


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

--- Comment #220 from Dmitry Selyutin <ghostmansd at gmail.com> ---
(In reply to Luke Kenneth Casson Leighton from comment #218)
> 
> ahh i love that idea, just be careful the "formatter" does not
> expand out to "and we need another feature, and another".

Updated the code with separate classes. These can be extended as we wish. The
walking process stays the same:

for (node, parent, path, pathcls) in walker(nodes):
    print(parent, pathcls(path), "=>", instance)

The main idea is that path appears as it was; if the users need to format them
or something else not covered by "pure" object we walked, they can use pathcls.

> +    def dispatch_dataclass(self, instance, path=[]):  <- path=()

These are already dropped: we yield only the last path component. However, I'm
still not sure if we're able to build the full path on our own if we have all
parents for each node. I'd really like path to be simple and be connected to
parent (not to the top-level object). Ideas?

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


More information about the libre-soc-bugs mailing list