pub fn check_function_call(ns: &mut Namespace, exp: &Expression, symtable: &mut Symtable) {
    match &exp {
        Expression::Load(..) | Expression::StorageLoad(..) | Expression::Variable(..) => {
            used_variable(ns, exp, symtable);
        }

        Expression::InternalFunctionCall {
            loc: _,
            returns: _,
            function,
            args,
        } => {
            for arg in args {
                used_variable(ns, arg, symtable);
            }
            check_function_call(ns, function, symtable);
        }

        Expression::ExternalFunctionCall {
            loc: _,
            returns: _,
            function,
            args,
            value,
            gas,
        } => {
            for arg in args {
                used_variable(ns, arg, symtable);
            }
            if let Some(gas) = gas {
                used_variable(ns, gas, symtable);
            }
            if let Some(value) = value {
                used_variable(ns, value, symtable);
            }
            check_function_call(ns, function, symtable);
        }

        Expression::Constructor {
            loc: _,
            contract_no: _,
            constructor_no: _,
            args,
            gas,
            value,
            salt,
            space,
        } => {
            for arg in args {
                used_variable(ns, arg, symtable);
            }
            if let Some(gas) = gas {
                used_variable(ns, gas, symtable);
            }
            if let Some(expr) = value {
                used_variable(ns, expr, symtable);
            }

            if let Some(expr) = salt {
                used_variable(ns, expr, symtable);
            }

            if let Some(expr) = space {
                used_variable(ns, expr, symtable);
            }
        }

        Expression::ExternalFunctionCallRaw {
            loc: _,
            ty: _,
            address,
            args,
            value,
            gas,
        } => {
            used_variable(ns, args, symtable);
            used_variable(ns, address, symtable);
            if let Some(value) = value {
                used_variable(ns, value, symtable);
            }
            if let Some(gas) = gas {
                used_variable(ns, gas, symtable);
            }
        }

        Expression::ExternalFunction { address, .. } => {
            used_variable(ns, address, symtable);
        }

        Expression::Builtin(_, _, expr_type, args) => match expr_type {
            Builtin::ArrayPush => {
                assigned_variable(ns, &args[0], symtable);
                if args.len() > 1 {
                    used_variable(ns, &args[1], symtable);
                }
            }

            _ => {
                for arg in args {
                    used_variable(ns, arg, symtable);
                }
            }
        },

        Expression::FormatString(_, args) => {
            for (_, expr) in args {
                used_variable(ns, expr, symtable);
            }
        }

        _ => {}
    }
}
/// Mark function arguments as used. If the function is an attribute of another variable, mark the
/// usage of the latter as well
Mark function arguments as used. If the function is an attribute of another variable, mark the
usage of the latter as well
Mark function arguments as used . If the function is an attribute of another variable mark the usage of the latter as well
pub fn check_function_call(ns: &mut Namespace, exp: &Expression, symtable: &mut Symtable) {
    match &exp {
        Expression::Load(..) | Expression::StorageLoad(..) | Expression::Variable(..) => {
            used_variable(ns, exp, symtable);
        }
        Expression::InternalFunctionCall {
            loc: _,
            returns: _,
            function,
            args,
        } => {
            for arg in args {
                used_variable(ns, arg, symtable);
            }
            check_function_call(ns, function, symtable);
        }
        Expression::ExternalFunctionCall {
            loc: _,
            returns: _,
            function,
            args,
            value,
            gas,
        } => {
            for arg in args {
                used_variable(ns, arg, symtable);
            }
            if let Some(gas) = gas {
                used_variable(ns, gas, symtable);
            }
            if let Some(value) = value {
                used_variable(ns, value, symtable);
            }
            check_function_call(ns, function, symtable);
        }
        Expression::Constructor {
            loc: _,
            contract_no: _,
            constructor_no: _,
            args,
            gas,
            value,
            salt,
            space,
        } => {
            for arg in args {
                used_variable(ns, arg, symtable);
            }
            if let Some(gas) = gas {
                used_variable(ns, gas, symtable);
            }
            if let Some(expr) = value {
                used_variable(ns, expr, symtable);
            }
            if let Some(expr) = salt {
                used_variable(ns, expr, symtable);
            }
            if let Some(expr) = space {
                used_variable(ns, expr, symtable);
            }
        }
        Expression::ExternalFunctionCallRaw {
            loc: _,
            ty: _,
            address,
            args,
            value,
            gas,
        } => {
            used_variable(ns, args, symtable);
            used_variable(ns, address, symtable);
            if let Some(value) = value {
                used_variable(ns, value, symtable);
            }
            if let Some(gas) = gas {
                used_variable(ns, gas, symtable);
            }
        }
        Expression::ExternalFunction { address, .. } => {
            used_variable(ns, address, symtable);
        }
        Expression::Builtin(_, _, expr_type, args) => match expr_type {
            Builtin::ArrayPush => {
                assigned_variable(ns, &args[0], symtable);
                if args.len() > 1 {
                    used_variable(ns, &args[1], symtable);
                }
            }
            _ => {
                for arg in args {
                    used_variable(ns, arg, symtable);
                }
            }
        },
        Expression::FormatString(_, args) => {
            for (_, expr) in args {
                used_variable(ns, expr, symtable);
            }
        }
        _ => {}
    }
}
pub fn check_function_call ( ns : & mut Namespace , exp : & Expression , symtable : & mut Symtable ) { match & exp { Expression :: Load ( .. ) | Expression :: StorageLoad ( .. ) | Expression :: Variable ( .. ) => { used_variable ( ns , exp , symtable ) ; } Expression :: InternalFunctionCall { loc : _ , returns : _ , function , args , } => { for arg in args { used_variable ( ns , arg , symtable ) ; } check_function_call ( ns , function , symtable ) ; } Expression :: ExternalFunctionCall { loc : _ , returns : _ , function , args , value , gas , } => { for arg in args { used_variable ( ns , arg , symtable ) ; } if let Some ( gas ) = gas { used_variable ( ns , gas , symtable ) ; } if let Some ( value ) = value { used_variable ( ns , value , symtable ) ; } check_function_call ( ns , function , symtable ) ; } Expression :: Constructor { loc : _ , contract_no : _ , constructor_no : _ , args , gas , value , salt , space , } => { for arg in args { used_variable ( ns , arg , symtable ) ; } if let Some ( gas ) = gas { used_variable ( ns , gas , symtable ) ; } if let Some ( expr ) = value { used_variable ( ns , expr , symtable ) ; } if let Some ( expr ) = salt { used_variable ( ns , expr , symtable ) ; } if let Some ( expr ) = space { used_variable ( ns , expr , symtable ) ; } } Expression :: ExternalFunctionCallRaw { loc : _ , ty : _ , address , args , value , gas , } => { used_variable ( ns , args , symtable ) ; used_variable ( ns , address , symtable ) ; if let Some ( value ) = value { used_variable ( ns , value , symtable ) ; } if let Some ( gas ) = gas { used_variable ( ns , gas , symtable ) ; } } Expression :: ExternalFunction { address , .. } => { used_variable ( ns , address , symtable ) ; } Expression :: Builtin ( _ , _ , expr_type , args ) => match expr_type { Builtin :: ArrayPush => { assigned_variable ( ns , & args [ 0 ] , symtable ) ; if args . len ( ) > 1 { used_variable ( ns , & args [ 1 ] , symtable ) ; } } _ => { for arg in args { used_variable ( ns , arg , symtable ) ; } } } , Expression :: FormatString ( _ , args ) => { for ( _ , expr ) in args { used_variable ( ns , expr , symtable ) ; } } _ => { } } }
Mark function arguments as used.
Mark function arguments as used .
ns
&mut Namespace
exp
&Expression
symtable
&mut Symtable
ns
&mut Namespace
exp
&Expression
symtable
&mut Symtable