[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 21:32:18 BST 2023


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

--- Comment #172 from Jacob Lifshay <programmerjake at gmail.com> ---
@dataclass()
class A:
    a: int
    b: "list[int]"

visiting {3: A(5, [12, 3])} would do:
with visitor.visit_dict(item={3: A(5, [12, 3])}, path=[]):
    with visitor.visit_dict_entry(item=dict_entry(3, A(5, [12, 3])), path=[3]):
        with visitor.visit_int(item=3, path=[3, 0]):
            pass
        with visitor.visit_A(item=("a", 1), path=[3, 1]):
            with visitor.visit_int(item=5, path=[3, 1, "a"]):
                pass
            with visitor.visit_list(item=[12, 3], path=[3, 1, "b"]):
                with visitor.visit_int(item=12, path=[3, 1, "b", 0]):
                    pass
                with visitor.visit_int(item=3, path=[3, 1, "b", 1]):
                    pass

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


More information about the libre-soc-bugs mailing list