summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorJordan Wiens <jordan@psifertex.com>2021-04-07 18:03:35 -0400
committerJordan Wiens <jordan@psifertex.com>2021-04-07 18:03:35 -0400
commitf8fc31094494eb644c051e26698d10cafdd46bf9 (patch)
tree404837780d85ff9c15bdd9774a30c29ba7bbc68d /python
parent4545000e325235c75cf58576f8b14d227979425a (diff)
adding passive decorator and annotate Variable class
Diffstat (limited to 'python')
-rw-r--r--python/decorators.py13
-rw-r--r--python/function.py3
2 files changed, 15 insertions, 1 deletions
diff --git a/python/decorators.py b/python/decorators.py
new file mode 100644
index 00000000..bd4a82c7
--- /dev/null
+++ b/python/decorators.py
@@ -0,0 +1,13 @@
+def passive(cls):
+ passive_note = '''
+
+ .. note:: This object is a "passive" object. Any changes you make to it will not be reflected in the core and vice-versa. If you wish to update a core version of this object you should use the appropriate API.
+'''
+
+ if hasattr(cls, ".__doc__") and cls.__doc__:
+ cls.__doc__ += passive_note
+ else:
+ cls.__doc__ = passive_note
+
+ return cls
+
diff --git a/python/function.py b/python/function.py
index 0a61acc1..1ea435f8 100644
--- a/python/function.py
+++ b/python/function.py
@@ -33,6 +33,7 @@ from binaryninja import associateddatastore # Required in the main scope due to
from binaryninja import highlight
from binaryninja import log
from binaryninja import types
+from binaryninja import decorators
from binaryninja.enums import (AnalysisSkipReason, FunctionGraphType, BranchType, SymbolType, InstructionTextTokenType,
HighlightStandardColor, HighlightColorStyle, RegisterValueType, ImplicitRegisterExtend,
DisassemblyOption, IntegerDisplayType, InstructionTextTokenContext, VariableSourceType,
@@ -814,7 +815,7 @@ class StackVariableReference(object):
def size(self, value):
self._size = value
-
+@decorators.passive
class Variable(object):
def __init__(self, func, source_type, index, storage, name = None, var_type = None, identifier = None):
self._function = func