Fix incorrect flattening

pull/328/head
Josselin 5 years ago
parent f4e2505c07
commit 9db6f4396e
  1. 6
      slither/tools/flattening/flattening.py

@ -121,7 +121,8 @@ class Flattening:
self._export_contract(ir.contract_created, exported, list_contract)
if isinstance(ir, TypeConversion):
self._export_from_type(ir.type, contract, exported, list_contract)
if contract.name in exported:
return
exported.add(contract.name)
list_contract.append(self._source_codes[contract])
@ -142,14 +143,15 @@ class Flattening:
if not self.DEFAULT_EXPORT_PATH.exists():
self.DEFAULT_EXPORT_PATH.mkdir(parents=True)
ret = []
if target is None:
for contract in self._slither.contracts_derived:
ret = []
self._export(contract, ret)
else:
contract = self._slither.get_contract_from_name(target)
if contract is None:
logger.error(f'{target} not found')
else:
ret = []
self._export(contract, ret)

Loading…
Cancel
Save