insndb/core: refactor operands traversal
authorDmitry Selyutin <ghostmansd@gmail.com>
Wed, 13 Sep 2023 17:04:03 +0000 (20:04 +0300)
committerDmitry Selyutin <ghostmansd@gmail.com>
Wed, 13 Sep 2023 17:26:18 +0000 (20:26 +0300)
src/openpower/insndb/core.py

index 29fec72556fabe9542beeb139c2b7a8bf8b06dcd..d2b447156eebfc00fb230757181b6ee55d631632 100644 (file)
@@ -3764,18 +3764,10 @@ class Walker(mdis.walker.Walker):
 
     @mdis.dispatcher.Hook(Record)
     def dispatch_record(self, node):
-        self.__record = node
         for field in _dataclasses.fields(node):
             key = field.name
             value = getattr(node, key)
             yield (value, node, key, mdis.walker.AttributePath)
 
         yield (node.opcodes, node, "opcodes", mdis.walker.AttributePath)
-
-    @mdis.dispatcher.Hook(Operands)
-    def dispatch_operands(self, node):
-        def hook(cls_kwargs):
-            (cls, kwargs) = cls_kwargs
-            return cls(record=self.__record, **kwargs)
-
-        yield from self(tuple(map(hook, node)))
+        yield (node.operands, node, "operands", mdis.walker.AttributePath)