mirror of https://github.com/crytic/slither
- Add .used attributes to all operators, it returns all the variables used - Use ABC for Operationpull/58/head
parent
f1a8677629
commit
e4b010af8a
@ -1,9 +1,29 @@ |
||||
import abc |
||||
from slither.core.context.context import Context |
||||
class Operation(Context): |
||||
|
||||
class AbstractOperation(abc.ABC): |
||||
|
||||
@property |
||||
@abc.abstractmethod |
||||
def read(self): |
||||
""" |
||||
Must be ovveriden |
||||
Return the list of variables READ |
||||
""" |
||||
pass |
||||
|
||||
@property |
||||
@abc.abstractmethod |
||||
def used(self): |
||||
""" |
||||
Return the list of variables used |
||||
""" |
||||
pass |
||||
|
||||
class Operation(Context, AbstractOperation): |
||||
|
||||
@property |
||||
def used(self): |
||||
""" |
||||
By default used is all the variables read |
||||
""" |
||||
raise Exception('Not overrided {}'.format(type(self))) |
||||
return self.read |
||||
|
Loading…
Reference in new issue