From 2fa3eb4cc11bcd71716f639deaadfb009cc5a4eb Mon Sep 17 00:00:00 2001 From: Dmitry Selyutin Date: Thu, 22 Jun 2023 18:32:18 +0300 Subject: [PATCH] insndb/core: introduce basic walker --- src/openpower/insndb/core.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/openpower/insndb/core.py b/src/openpower/insndb/core.py index 01a029d1..e5b1b12e 100644 --- a/src/openpower/insndb/core.py +++ b/src/openpower/insndb/core.py @@ -12,6 +12,9 @@ import re as _re import types as _types import typing as _typing +import mdis.dispatcher +import mdis.walker + try: from functools import cached_property except ImportError: @@ -3707,3 +3710,9 @@ class Database: return self.__names.get(key) raise ValueError("instruction or name expected") + + +class Walker(mdis.walker.Walker): + @mdis.dispatcher.Hook(Database) + def dispatch_database(self, node): + yield from self(tuple(node)) -- 2.30.2