oppc/pseudocode: allow to check whether node is present
authorDmitry Selyutin <ghostmansd@gmail.com>
Tue, 16 Jan 2024 19:09:45 +0000 (22:09 +0300)
committerDmitry Selyutin <ghostmansd@gmail.com>
Tue, 16 Jan 2024 19:10:07 +0000 (22:10 +0300)
src/openpower/oppc/pc_pseudocode.py

index 074d4c0d9b5f4537c3bc2472919f8c243cfd8335..6804eb26020f11d5dbaa2f095817d3d24f745c79 100644 (file)
@@ -14,6 +14,9 @@ class PseudocodeVisitor(pc_util.Visitor):
     def __iter__(self):
         yield from self.__code[self.__root]
 
+    def __contains__(self, node):
+        return (node in self.__code)
+
     def __getitem__(self, node):
         return self.__code[node]