summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorRusty Wagner <rusty.wagner@gmail.com>2025-10-22 20:15:04 -0400
committerRusty Wagner <rusty.wagner@gmail.com>2025-10-22 20:15:04 -0400
commit321fd674a74f84b12151987e15f835202b7ee08a (patch)
tree7662e27eab961b2a95f51e8f2be7598f944aae2f /python
parent186c7aafc9a275e0b5d23e176d46ece6bcfe5ec3 (diff)
Add API to dereference named type references
Diffstat (limited to 'python')
-rw-r--r--python/types.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/python/types.py b/python/types.py
index 853d0836..5ad589e0 100644
--- a/python/types.py
+++ b/python/types.py
@@ -2275,6 +2275,19 @@ class Type:
handle=core.BNTypeWithReplacedNamedTypeReference(self._handle, from_ref.ntr_handle, to_ref.ntr_handle)
return Type.create(handle)
+ def deref_named_type_reference(self, view: 'binaryview.BinaryView') -> 'Type':
+ """
+ Dereferences any named type references to find the underlying type. This may still return a
+ named type reference if there are circular references. If the type isn't a named type
+ reference, the input type is returned unchanged.
+
+ :param BinaryView view: BinaryView object owning this Type
+ :return: Type with named type references resolved
+ :rtype: :py:class:`Type`
+ """
+ handle = core.BNDerefNamedTypeReference(view.handle, self._handle)
+ return Type.create(handle)
+
@staticmethod
def void() -> 'VoidType':
return VoidType.create()