summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorJosh Ferrell <josh@vector35.com>2023-02-13 13:23:49 -0500
committerJosh Ferrell <josh@vector35.com>2023-02-13 13:23:49 -0500
commit38fb1d656559cb4fb95201077d7aaf57d992a8c5 (patch)
tree79e327a8e4d221af90038678ff91f044fcadb724 /python
parent229d6f2e760dd3c03df8bc1dcf25fbfa70b1f801 (diff)
Make Function.function_type transparently use Function.type
Diffstat (limited to 'python')
-rw-r--r--python/function.py18
1 files changed, 7 insertions, 11 deletions
diff --git a/python/function.py b/python/function.py
index d065f454..856d9cca 100644
--- a/python/function.py
+++ b/python/function.py
@@ -960,25 +960,21 @@ class Function:
return None
return highlevelil.HighLevelILFunction(self.arch, result, self)
+ # TODO: Uncomment, move below the property decorator, and mark deprecated after the next stable
#@deprecation.deprecated(details="Use .type instead.")
- # Uncomment, move below the property decorator,
- # and mark deprecated after the next stable
@property
def function_type(self) -> 'types.FunctionType':
"""
Function type object, can be set with either a string representing the function prototype
(`str(function)` shows examples) or a :py:class:`Type` object
"""
- return types.FunctionType(core.BNGetFunctionType(self.handle), platform=self.platform)
+ return self.type
+ # TODO: Uncomment, move below the setter decorator, and mark deprecated after the next stable
+ #@deprecation.deprecated(details="Use .type instead.")
@function_type.setter
- def function_type(self, value: Union['types.FunctionType', str]) -> None: # type: ignore
- if isinstance(value, str):
- (parsed_value, new_name) = self.view.parse_type_string(value)
- self.name = str(new_name)
- self.set_user_type(parsed_value)
- else:
- self.set_user_type(value)
+ def function_type(self, value: Union['types.FunctionType', str]) -> None:
+ self.type = value
@property
def type(self) -> 'types.FunctionType':
@@ -989,7 +985,7 @@ class Function:
return types.FunctionType(core.BNGetFunctionType(self.handle), platform=self.platform)
@type.setter
- def type(self, value: Union['types.FunctionType', str]) -> None: # type: ignore
+ def type(self, value: Union['types.FunctionType', str]) -> None:
if isinstance(value, str):
(parsed_value, new_name) = self.view.parse_type_string(value)
self.name = str(new_name)