Merge branch 'dev' into dev-ssa

pull/87/head
Josselin 6 years ago
commit 873b23fd43
  1. 9
      slither/slithir/operations/call.py
  2. 10
      slither/slithir/operations/event_call.py
  3. 11
      slither/slithir/operations/high_level_call.py
  4. 11
      slither/slithir/operations/internal_call.py
  5. 12
      slither/slithir/operations/internal_dynamic_call.py
  6. 2
      slither/slithir/operations/low_level_call.py
  7. 11
      slither/slithir/operations/new_array.py
  8. 11
      slither/slithir/operations/new_contract.py
  9. 11
      slither/slithir/operations/new_structure.py
  10. 2
      slither/slithir/operations/solidity_call.py

@ -15,3 +15,12 @@ class Call(Operation):
def arguments(self, v): def arguments(self, v):
self._arguments = v self._arguments = v
# if array inside the parameters
def _unroll(self, l):
ret = []
for x in l:
if not isinstance(x, list):
ret += [x]
else:
ret += self._unroll(x)
return ret

@ -14,15 +14,7 @@ class EventCall(Call):
@property @property
def read(self): def read(self):
def unroll(l): return self._unroll(self.arguments)
ret = []
for x in l:
if not isinstance(x, list):
ret += [x]
else:
ret += unroll(x)
return ret
return unroll(self.arguments)
def __str__(self): def __str__(self):
args = [str(a) for a in self.arguments] args = [str(a) for a in self.arguments]

@ -58,16 +58,7 @@ class HighLevelCall(Call, OperationWithLValue):
@property @property
def read(self): def read(self):
# if array inside the parameters all_read = [self.destination, self.call_gas, self.call_value] + self._unroll(self.arguments)
def unroll(l):
ret = []
for x in l:
if not isinstance(x, list):
ret += [x]
else:
ret += unroll(x)
return ret
all_read = [self.destination, self.call_gas, self.call_value] + unroll(self.arguments)
# remove None # remove None
return [x for x in all_read if x] + [self.destination] return [x for x in all_read if x] + [self.destination]

@ -16,16 +16,7 @@ class InternalCall(Call, OperationWithLValue):
@property @property
def read(self): def read(self):
# if array inside the parameters return list(self._unroll(self.arguments))
def unroll(l):
ret = []
for x in l:
if not isinstance(x, list):
ret += [x]
else:
ret += unroll(x)
return ret
return list(unroll(self.arguments))
@property @property
def function(self): def function(self):

@ -19,17 +19,7 @@ class InternalDynamicCall(Call, OperationWithLValue):
@property @property
def read(self): def read(self):
# if array inside the parameters return self._unroll(self.arguments) + [self.function]
def unroll(l):
ret = []
for x in l:
if not isinstance(x, list):
ret += [x]
else:
ret += unroll(x)
return ret
return unroll(self.arguments) + [self.function]
@property @property
def function(self): def function(self):

@ -52,7 +52,7 @@ class LowLevelCall(Call, OperationWithLValue):
def read(self): def read(self):
all_read = [self.destination, self.call_gas, self.call_value] + self.arguments all_read = [self.destination, self.call_gas, self.call_value] + self.arguments
# remove None # remove None
return [x for x in all_read if x] return self._unroll([x for x in all_read if x])
@property @property
def destination(self): def destination(self):

@ -18,16 +18,7 @@ class NewArray(Call, OperationWithLValue):
@property @property
def read(self): def read(self):
# if array inside the parameters return self._unroll(self.arguments)
def unroll(l):
ret = []
for x in l:
if not isinstance(x, list):
ret += [x]
else:
ret += unroll(x)
return ret
return unroll(self.arguments)
@property @property
def depth(self): def depth(self):

@ -39,16 +39,7 @@ class NewContract(Call, OperationWithLValue):
@property @property
def read(self): def read(self):
# if array inside the parameters return self._unroll(self.arguments)
def unroll(l):
ret = []
for x in l:
if not isinstance(x, list):
ret += [x]
else:
ret += unroll(x)
return ret
return unroll(self.arguments)
def __str__(self): def __str__(self):
value = '' value = ''

@ -17,16 +17,7 @@ class NewStructure(Call, OperationWithLValue):
@property @property
def read(self): def read(self):
# if array inside the parameters return self._unroll(self.arguments)
def unroll(l):
ret = []
for x in l:
if not isinstance(x, list):
ret += [x]
else:
ret += unroll(x)
return ret
return unroll(self.arguments)
@property @property
def structure(self): def structure(self):

@ -16,7 +16,7 @@ class SolidityCall(Call, OperationWithLValue):
@property @property
def read(self): def read(self):
return list(self.arguments) return self._unroll(self.arguments)
@property @property
def function(self): def function(self):

Loading…
Cancel
Save