summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorPeter LaFosse <peter@vector35.com>2020-06-18 11:17:23 -0400
committerPeter LaFosse <peter@vector35.com>2020-06-23 09:02:48 -0400
commit16c4864cb9aa3a1d862600fce42256036e9c18e7 (patch)
treeb3fd5bb17e575655e60bc7e50741fe6e07ac08e7 /python
parente0fbcc712f8ca31914d2f1e04b7f8b16eff44d66 (diff)
Add ability to set can_return on mutable function type objects
Diffstat (limited to 'python')
-rw-r--r--python/types.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/python/types.py b/python/types.py
index 94e1f42d..92735fc6 100644
--- a/python/types.py
+++ b/python/types.py
@@ -548,13 +548,26 @@ class Type(object):
@property
def can_return(self):
- """Whether type can return (read-only)"""
+ """Whether type can return"""
if self._mutable:
result = core.BNFunctionTypeBuilderCanReturn(self._handle)
else:
result = core.BNFunctionTypeCanReturn(self._handle)
return BoolWithConfidence(result.value, confidence = result.confidence)
+ @can_return.setter
+ def can_return(self, value):
+ """Whether type can return (read-only)"""
+ if not self._mutable:
+ raise AttributeError("Finalized Type object is immutable, use mutable_copy()")
+ bc = core.BNBoolWithConfidence()
+ bc.value = bool(value)
+ if hasattr(value, 'confidence'):
+ bc.confidence = value.confidence
+ else:
+ bc.confidence = max_confidence
+ core.BNSetFunctionTypeBuilderCanReturn(self._handle, bc)
+
@property
def structure(self):
"""Structure of the type (read-only)"""