# Buggy code
def copy_expression(self, expression, true_expression, false_expression):
    if self.condition:
        return

    if isinstance(expression, ConditionalExpression):
        raise Exception("Nested ternary operator not handled")

    if isinstance(expression, (Literal, Identifier, IndexAccess, NewArray)):
        return None

    # case of lib
    # (.. ? .. : ..).add
    if isinstance(expression, MemberAccess):
        next_expr = expression.expression
        if self.apply_copy(next_expr, true_expression, false_expression, f_expression):
            self.copy_expression(
                next_expr, true_expression.expression, false_expression.expression
            )

    elif isinstance(
        expression, (AssignmentOperation, BinaryOperation, TupleExpression)
    ):
        true_expression._expressions = []
        false_expression._expressions = []

        for next_expr in expression.expressions:
            if self.apply_copy(
                next_expr, true_expression, false_expression, f_expressions
            ):
                # always on last arguments added
                self.copy_expression(
                    next_expr,
                    true_expression.expressions[-1],
                    false_expression.expressions[-1],
                )

    elif isinstance(expression, CallExpression):
        next_expr = expression.called

        # case of lib
        # (.. ? .. : ..).add
        if self.apply_copy(next_expr, true_expression, false_expression, f_called):
            self.copy_expression(
                next_expr, true_expression.called, false_expression.called
            )

        true_expression._arguments = []
        false_expression._arguments = []

        for next_expr in expression.arguments:
            if self.apply_copy(next_expr, true_expression, false_expression, f_call):
                # always on last arguments added
                self.copy_expression(
                    next_expr,
                    true_expression.arguments[-1],
                    false_expression.arguments[-1],
                )

    elif isinstance(expression, TypeConversion):
        next_expr = expression.expression
        if self.apply_copy(next_expr, true_expression, false_expression, f_expression):
            self.copy_expression(
                expression.expression,
                true_expression.expression,
                false_expression.expression,
            )

    else:
        raise Exception(
            "Ternary operation not handled {}({})".format(expression, type(expression))
        )


# Traceback (Exception)
$ slither contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol
INFO:Slither:Compilation warnings/errors on contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:
contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:27:2: Warning: Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead.
function DeDeMasterContract(address _dedeNetworkAddress){
^ (Relevant source part starts here and spans across multiple lines).
contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:61:3: Warning: Use of the "var" keyword is deprecated.
var _dede = DeDeContract(dede);
^-------^
contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:72:3: Warning: Use of the "var" keyword is deprecated.
var _dede = DeDeContract(dede);
^-------^
contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:109:2: Warning: Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead.
function DeDeContract(address _dip, address _scs, address _issuer, uint256 _targetAmount, uint256 _bulletAmount, address _targetAddress, address _bulletAddress, uint256 _validationTime) payable {
^ (Relevant source part starts here and spans across multiple lines).
contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:58:3: Warning: Invoking events without "emit" prefix is deprecated.
Issue(msg.sender, dedeNetworkAddress, _issuer, dede);
^--------------------------------------------------^
contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:69:3: Warning: Invoking events without "emit" prefix is deprecated.
Activate(_dede.dip(), _dede.scs(), _dede.issuer(), dede);
^------------------------------------------------------^
contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:80:3: Warning: Invoking events without "emit" prefix is deprecated.
Nullify(_dede.dip(), _dede.scs(), _dede.issuer(), dede);
^-----------------------------------------------------^
contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:137:4: Warning: "suicide" has been deprecated in favour of "selfdestruct"
suicide(dip); // force send bullet ether to dip
^----------^
contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:141:4: Warning: "suicide" has been deprecated in favour of "selfdestruct"
suicide(scs); // force send target or leftover ether to scs
^----------^
contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:152:3: Warning: "suicide" has been deprecated in favour of "selfdestruct"
suicide(dip);
^----------^
contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:4:2: Warning: No visibility specified. Defaulting to "public".
function totalSupply() constant returns (uint supply);
^----------------------------------------------------^
contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:5:2: Warning: No visibility specified. Defaulting to "public".
function balanceOf(address _owner) constant returns (uint balance);
^-----------------------------------------------------------------^
contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:6:2: Warning: No visibility specified. Defaulting to "public".
function transfer(address _to, uint _value) returns (bool success);
^-----------------------------------------------------------------^
contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:7:2: Warning: No visibility specified. Defaulting to "public".
function transferFrom(address _from, address _to, uint _value) returns (bool success);
^------------------------------------------------------------------------------------^
contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:8:2: Warning: No visibility specified. Defaulting to "public".
function approve(address _spender, uint _value) returns (bool success);
^---------------------------------------------------------------------^
contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:9:2: Warning: No visibility specified. Defaulting to "public".
function allowance(address _owner, address _spender) constant returns (uint remaining);
^-------------------------------------------------------------------------------------^
contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:27:2: Warning: No visibility specified. Defaulting to "public".
function DeDeMasterContract(address _dedeNetworkAddress){
^ (Relevant source part starts here and spans across multiple lines).
contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:32:2: Warning: No visibility specified. Defaulting to "public".
function changeDedeAddress(address newDedeAddress){
^ (Relevant source part starts here and spans across multiple lines).
contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:37:2: Warning: No visibility specified. Defaulting to "public".
function issue(uint256 _targetAmount, uint256 _bulletAmount, address _targetAddress, address _bulletAddress, uint256 _validationTime, address _issuer) payable {
^ (Relevant source part starts here and spans across multiple lines).
contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:60:2: Warning: No visibility specified. Defaulting to "public".
function activate(address dede) payable {
^ (Relevant source part starts here and spans across multiple lines).
contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:71:2: Warning: No visibility specified. Defaulting to "public".
function nullify(address dede){
^ (Relevant source part starts here and spans across multiple lines).
contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:109:2: Warning: No visibility specified. Defaulting to "public".
function DeDeContract(address _dip, address _scs, address _issuer, uint256 _targetAmount, uint256 _bulletAmount, address _targetAddress, address _bulletAddress, uint256 _validationTime) payable {
^ (Relevant source part starts here and spans across multiple lines).
contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:126:2: Warning: No visibility specified. Defaulting to "public".
function activate(address sender) payable {
^ (Relevant source part starts here and spans across multiple lines).
contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol:144:2: Warning: No visibility specified. Defaulting to "public".
function nullify(address sender) {
^ (Relevant source part starts here and spans across multiple lines).

ERROR:root:Error in contracts/0xc6C09Ae980b3d029DEB7419fA1B7859DCe7186D0_DeDeMasterContract.sol
ERROR:root:Traceback (most recent call last):
File "/home/gustavo/.local/lib/python3.6/site-packages/slither_analyzer-0.3.1-py3.6.egg/slither/__main__.py", line 226, in main_impl
(results, number_contracts) = process(filename, args, detector_classes, printer_classes)
File "/home/gustavo/.local/lib/python3.6/site-packages/slither_analyzer-0.3.1-py3.6.egg/slither/__main__.py", line 35, in process
slither = Slither(filename, args.solc, args.disable_solc_warnings, args.solc_args, ast)
File "/home/gustavo/.local/lib/python3.6/site-packages/slither_analyzer-0.3.1-py3.6.egg/slither/slither.py", line 41, in __init__
self._analyze_contracts()
File "/home/gustavo/.local/lib/python3.6/site-packages/slither_analyzer-0.3.1-py3.6.egg/slither/solc_parsing/slitherSolc.py", line 187, in _analyze_contracts
self._analyze_third_part(contracts_to_be_analyzed, libraries)
File "/home/gustavo/.local/lib/python3.6/site-packages/slither_analyzer-0.3.1-py3.6.egg/slither/solc_parsing/slitherSolc.py", line 269, in _analyze_third_part
self._analyze_variables_modifiers_functions(contract)
File "/home/gustavo/.local/lib/python3.6/site-packages/slither_analyzer-0.3.1-py3.6.egg/slither/solc_parsing/slitherSolc.py", line 309, in _analyze_variables_modifiers_functions
contract.analyze_content_functions()
File "/home/gustavo/.local/lib/python3.6/site-packages/slither_analyzer-0.3.1-py3.6.egg/slither/solc_parsing/declarations/contract.py", line 347, in analyze_content_functions
function.analyze_content()
File "/home/gustavo/.local/lib/python3.6/site-packages/slither_analyzer-0.3.1-py3.6.egg/slither/solc_parsing/declarations/function.py", line 825, in analyze_content
st = SplitTernaryExpression(node.expression)
File "/home/gustavo/.local/lib/python3.6/site-packages/slither_analyzer-0.3.1-py3.6.egg/slither/utils/expression_manipulations.py", line 48, in __init__
self.copy_expression(expression, self.true_expression, self.false_expression)
File "/home/gustavo/.local/lib/python3.6/site-packages/slither_analyzer-0.3.1-py3.6.egg/slither/utils/expression_manipulations.py", line 90, in copy_expression
false_expression.expressions[-1])
File "/home/gustavo/.local/lib/python3.6/site-packages/slither_analyzer-0.3.1-py3.6.egg/slither/utils/expression_manipulations.py", line 100, in copy_expression
false_expression.called)
File "/home/gustavo/.local/lib/python3.6/site-packages/slither_analyzer-0.3.1-py3.6.egg/slither/utils/expression_manipulations.py", line 100, in copy_expression
false_expression.called)
File "/home/gustavo/.local/lib/python3.6/site-packages/slither_analyzer-0.3.1-py3.6.egg/slither/utils/expression_manipulations.py", line 79, in copy_expression
false_expression.expression)
File "/home/gustavo/.local/lib/python3.6/site-packages/slither_analyzer-0.3.1-py3.6.egg/slither/utils/expression_manipulations.py", line 90, in copy_expression
false_expression.expressions[-1])
File "/home/gustavo/.local/lib/python3.6/site-packages/slither_analyzer-0.3.1-py3.6.egg/slither/utils/expression_manipulations.py", line 120, in copy_expression
raise Exception('Ternary operation not handled {}({})'.format(expression, type(expression)))
Exception: Ternary operation not handled new DeDeContract(<class 'slither.core.expressions.new_contract.NewContract'>)

# Fixed code
def copy_expression(self, expression, true_expression, false_expression):
    if self.condition:
        return

    if isinstance(expression, ConditionalExpression):
        raise Exception("Nested ternary operator not handled")

    if isinstance(
        expression, (Literal, Identifier, IndexAccess, NewArray, NewContract)
    ):
        return None

    # case of lib
    # (.. ? .. : ..).add
    if isinstance(expression, MemberAccess):
        next_expr = expression.expression
        if self.apply_copy(next_expr, true_expression, false_expression, f_expression):
            self.copy_expression(
                next_expr, true_expression.expression, false_expression.expression
            )

    elif isinstance(
        expression, (AssignmentOperation, BinaryOperation, TupleExpression)
    ):
        true_expression._expressions = []
        false_expression._expressions = []

        for next_expr in expression.expressions:
            if self.apply_copy(
                next_expr, true_expression, false_expression, f_expressions
            ):
                # always on last arguments added
                self.copy_expression(
                    next_expr,
                    true_expression.expressions[-1],
                    false_expression.expressions[-1],
                )

    elif isinstance(expression, CallExpression):
        next_expr = expression.called

        # case of lib
        # (.. ? .. : ..).add
        if self.apply_copy(next_expr, true_expression, false_expression, f_called):
            self.copy_expression(
                next_expr, true_expression.called, false_expression.called
            )

        true_expression._arguments = []
        false_expression._arguments = []

        for next_expr in expression.arguments:
            if self.apply_copy(next_expr, true_expression, false_expression, f_call):
                # always on last arguments added
                self.copy_expression(
                    next_expr,
                    true_expression.arguments[-1],
                    false_expression.arguments[-1],
                )

    elif isinstance(expression, TypeConversion):
        next_expr = expression.expression
        if self.apply_copy(next_expr, true_expression, false_expression, f_expression):
            self.copy_expression(
                expression.expression,
                true_expression.expression,
                false_expression.expression,
            )

    else:
        raise Exception(
            "Ternary operation not handled {}({})".format(expression, type(expression))
        )