/// Create a list of functions that can be called in this context. If global is true, then
/// include functions outside of contracts
Create a list of functions that can be called in this context. If global is true, then
include functions outside of contracts
Create a list of functions that can be called in this context . If global is true then include functions outside of contracts
pub fn available_functions(
    name: &str,
    global: bool,
    file_no: usize,
    contract_no: Option<usize>,
    ns: &Namespace,
) -> Vec<usize> {
    let mut list = Vec::new();
    if global {
        if let Some(Symbol::Function(v)) = ns.symbols.get(&(file_no, None, name.to_owned())) {
            list.extend(v.iter().map(|(_, func_no)| *func_no));
        }
    }
    if let Some(contract_no) = contract_no {
        list.extend(
            ns.contracts[contract_no]
                .all_functions
                .keys()
                .filter_map(|func_no| {
                    if ns.functions[*func_no].name == name {
                        Some(*func_no)
                    } else {
                        None
                    }
                }),
        );
    }
    list
}
pub fn available_functions ( name : & str , global : bool , file_no : usize , contract_no : Option < usize > , ns : & Namespace , ) -> Vec < usize > { let mut list = Vec :: new ( ) ; if global { if let Some ( Symbol :: Function ( v ) ) = ns . symbols . get ( & ( file_no , None , name . to_owned ( ) ) ) { list . extend ( v . iter ( ) . map ( | ( _ , func_no ) | * func_no ) ) ; } } if let Some ( contract_no ) = contract_no { list . extend ( ns . contracts [ contract_no ] . all_functions . keys ( ) . filter_map ( | func_no | { if ns . functions [ * func_no ] . name == name { Some ( * func_no ) } else { None } } ) , ) ; } list }
Create a list of functions that can be called in this context.
Create a list of functions that can be called in this context .
name
&str
global
bool
file_no
usize
contract_no
Option<usize>
ns
&Namespace