diff options
| author | Peter LaFosse <peter@vector35.com> | 2021-06-23 09:31:22 -0400 |
|---|---|---|
| committer | Peter LaFosse <peter@vector35.com> | 2021-09-05 10:08:09 -0400 |
| commit | 6de4900db74a341fddfda46f7cb4342fdc31f8e0 (patch) | |
| tree | 790a990b2b9ccd8229a31754d28a74a2db839851 /python/types.py | |
| parent | ea052d32732f62000164f243a1aad0bb7425199e (diff) | |
Refactor Variable class
The Variable class is now broken into 3 separate classes with helper
methods to convert between them.
CoreVariable is implemented as a frozen dataclass and is analogous
to BNVariable
VariableNameAndType is analogous to BNVariableNameAndType
Bothe the above are passive objects and can not be changed directly
The new and improved Variable object is now an active object which
can be operated on directly and changes will take effect immediately
Diffstat (limited to 'python/types.py')
| -rw-r--r-- | python/types.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/python/types.py b/python/types.py index bead9a64..3cd44bd8 100644 --- a/python/types.py +++ b/python/types.py @@ -19,7 +19,8 @@ # IN THE SOFTWARE. import ctypes -from typing import Generator, List, Union +from typing import Generator, List, Union, Mapping, Tuple, Optional +from dataclasses import dataclass # Binary Ninja components from . import _binaryninjacore as core @@ -28,6 +29,7 @@ from . import callingconvention from . import function from . import variable from . import architecture +from . import types from . import log QualifiedNameType = Union[List[str], str, 'QualifiedName', List[bytes]] @@ -588,7 +590,7 @@ class Type(object): name = self._platform.arch.get_reg_name(params[i].location.storage) elif params[i].location.type == VariableSourceType.StackVariableSourceType: name = "arg_%x" % params[i].location.storage - param_location = variable.Variable(None, params[i].location.type, params[i].location.index, + param_location = variable.VariableNameAndType(params[i].location.type, params[i].location.index, params[i].location.storage, name, param_type) result.append(FunctionParameter(param_type, params[i].name, param_location)) core.BNFreeTypeParameterList(params, count.value) |
