From 5b636f5b4312afb467d98d1f6a135cf8e3376b9b Mon Sep 17 00:00:00 2001 From: Josselin Date: Fri, 5 Jul 2019 13:41:16 +0200 Subject: [PATCH] Improve constructor call support --- slither/slithir/convert.py | 6 ++++++ slither/slithir/tmp_operations/tmp_call.py | 9 ++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/slither/slithir/convert.py b/slither/slithir/convert.py index 63284db77..101604d55 100644 --- a/slither/slithir/convert.py +++ b/slither/slithir/convert.py @@ -586,6 +586,12 @@ def extract_tmp_call(ins, contract): if isinstance(ins.called, Event): return EventCall(ins.called.name) + if isinstance(ins.called, Contract): + internalcall = InternalCall(ins.called.constructor, ins.nbr_arguments, ins.lvalue, + ins.type_call) + internalcall.call_id = ins.call_id + return internalcall + raise Exception('Not extracted {} {}'.format(type(ins.called), ins)) diff --git a/slither/slithir/tmp_operations/tmp_call.py b/slither/slithir/tmp_operations/tmp_call.py index 0d7fda1e9..3c8faec3c 100644 --- a/slither/slithir/tmp_operations/tmp_call.py +++ b/slither/slithir/tmp_operations/tmp_call.py @@ -1,14 +1,13 @@ -from slither.slithir.operations.lvalue import OperationWithLValue +from slither.core.declarations import Event, Contract, SolidityVariableComposed, SolidityFunction, Structure from slither.core.variables.variable import Variable -from slither.core.declarations.solidity_variables import SolidityVariableComposed, SolidityFunction -from slither.core.declarations.structure import Structure -from slither.core.declarations.event import Event +from slither.slithir.operations.lvalue import OperationWithLValue class TmpCall(OperationWithLValue): def __init__(self, called, nbr_arguments, result, type_call): - assert isinstance(called, (Variable, + assert isinstance(called, (Contract, + Variable, SolidityVariableComposed, SolidityFunction, Structure,