summaryrefslogtreecommitdiff
path: root/python/function.py
diff options
context:
space:
mode:
authorGlenn Smith <glenn@vector35.com>2022-06-13 15:58:58 -0400
committerGlenn Smith <glenn@vector35.com>2022-06-14 21:05:39 -0400
commit5828dbeb875826285f7334519611e7578a745cd8 (patch)
tree881f93c800e9e58006bda2ec1cf1f99b825fe252 /python/function.py
parent746f20ba84f263dfef071961d980e44660c934ea (diff)
Function.get_variable_by_name
Diffstat (limited to 'python/function.py')
-rw-r--r--python/function.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/python/function.py b/python/function.py
index 2ebc5a0c..619b21f9 100644
--- a/python/function.py
+++ b/python/function.py
@@ -1004,6 +1004,13 @@ class Function:
finally:
core.BNFreeVariableNameAndTypeList(v, count.value)
+ def get_variable_by_name(self, name: str) -> Optional['variable.Variable']:
+ """Get a specific variable or None if it doesn't exist"""
+ for v in self.vars:
+ if v.name == name:
+ return v
+ return None
+
@property
def indirect_branches(self) -> List['variable.IndirectBranchInfo']:
"""List of indirect branches (read-only)"""