fn resolve_top_level_function_call(
    func_call: &pt::YulFunctionCall,
    reachable: bool,
    function_table: &mut FunctionsTable,
    context: &ExprContext,
    symtable: &mut Symtable,
    ns: &mut Namespace,
) -> Result<(YulStatement, bool), ()> {
    match resolve_function_call(function_table, func_call, context, symtable, ns) {
        Ok(YulExpression::BuiltInCall(loc, ty, args)) => {
            let func_prototype = ty.get_prototype_info();
            if func_prototype.no_returns != 0 {
                ns.diagnostics.push(Diagnostic::error(
                    loc,
                    "top level function calls must not return anything".to_string(),
                ));
                return Err(());
            }
            Ok((
                YulStatement::BuiltInCall(loc, reachable, ty, args),
                !func_prototype.stops_execution,
            ))
        }
        Ok(YulExpression::FunctionCall(loc, function_no, args)) => {
            let func = function_table.get(function_no).unwrap();
            if !func.returns.is_empty() {
                ns.diagnostics.push(Diagnostic::error(
                    loc,
                    "top level function calls must not return anything".to_string(),
                ));
                return Err(());
            }
            Ok((
                YulStatement::FunctionCall(loc, reachable, function_no, args),
                true,
            ))
        }

        Ok(_) => {
            unreachable!("sema::yul::resolve_function_call can only return resolved calls")
        }

        Err(_) => Err(()),
    }
}
/// Top-leve function calls must not return anything, so there is a special function to handle them.
Top-leve function calls must not return anything, so there is a special function to handle them.
Top - leve function calls must not return anything so there is a special function to handle them .
fn resolve_top_level_function_call(
    func_call: &pt::YulFunctionCall,
    reachable: bool,
    function_table: &mut FunctionsTable,
    context: &ExprContext,
    symtable: &mut Symtable,
    ns: &mut Namespace,
) -> Result<(YulStatement, bool), ()> {
    match resolve_function_call(function_table, func_call, context, symtable, ns) {
        Ok(YulExpression::BuiltInCall(loc, ty, args)) => {
            let func_prototype = ty.get_prototype_info();
            if func_prototype.no_returns != 0 {
                ns.diagnostics.push(Diagnostic::error(
                    loc,
                    "top level function calls must not return anything".to_string(),
                ));
                return Err(());
            }
            Ok((
                YulStatement::BuiltInCall(loc, reachable, ty, args),
                !func_prototype.stops_execution,
            ))
        }
        Ok(YulExpression::FunctionCall(loc, function_no, args)) => {
            let func = function_table.get(function_no).unwrap();
            if !func.returns.is_empty() {
                ns.diagnostics.push(Diagnostic::error(
                    loc,
                    "top level function calls must not return anything".to_string(),
                ));
                return Err(());
            }
            Ok((
                YulStatement::FunctionCall(loc, reachable, function_no, args),
                true,
            ))
        }
        Ok(_) => {
            unreachable!("sema::yul::resolve_function_call can only return resolved calls")
        }
        Err(_) => Err(()),
    }
}
fn resolve_top_level_function_call ( func_call : & pt :: YulFunctionCall , reachable : bool , function_table : & mut FunctionsTable , context : & ExprContext , symtable : & mut Symtable , ns : & mut Namespace , ) -> Result < ( YulStatement , bool ) , ( ) > { match resolve_function_call ( function_table , func_call , context , symtable , ns ) { Ok ( YulExpression :: BuiltInCall ( loc , ty , args ) ) => { let func_prototype = ty . get_prototype_info ( ) ; if func_prototype . no_returns != 0 { ns . diagnostics . push ( Diagnostic :: error ( loc , " " . to_string ( ) , ) ) ; return Err ( ( ) ) ; } Ok ( ( YulStatement :: BuiltInCall ( loc , reachable , ty , args ) , ! func_prototype . stops_execution , ) ) } Ok ( YulExpression :: FunctionCall ( loc , function_no , args ) ) => { let func = function_table . get ( function_no ) . unwrap ( ) ; if ! func . returns . is_empty ( ) { ns . diagnostics . push ( Diagnostic :: error ( loc , " " . to_string ( ) , ) ) ; return Err ( ( ) ) ; } Ok ( ( YulStatement :: FunctionCall ( loc , reachable , function_no , args ) , true , ) ) } Ok ( _ ) => { unreachable ! ( " " ) } Err ( _ ) => Err ( ( ) ) , } }
Top-leve function calls must not return anything, so there is a special function to handle them.
Top - leve function calls must not return anything so there is a special function to handle them .
func_call
&pt::YulFunctionCall
reachable
bool
function_table
&mut FunctionsTable
context
&ExprContext
symtable
&mut Symtable
ns
&mut Namespace
func_call
&pt::YulFunctionCall
reachable
bool
function_table
&mut FunctionsTable
context
&ExprContext
symtable
&mut Symtable
ns
&mut Namespace