pub fn func_body(
    contract_scope: Shared<ContractScope>,
    context: Shared<Context>,
    def: &Spanned<fe::ContractStmt>,
) -> Result<(), SemanticError> {
    if let fe::ContractStmt::FuncDef {
        qual: _,
        name,
        args: _,
        return_type: _,
        body,
    } = &def.node
    {
        let host_func_def = contract_scope
            .borrow()
            .function_def(name.node)
            .unwrap_or_else(|| panic!("Failed to lookup function definition for {}", &name.node));

        // If the return type is an empty tuple we do not have to validate any further
        // at this point because both returning (explicit) or not returning (implicit
        // return) are valid syntax.
        // If the return type is anything else, we do need to ensure that all code paths
        // return or revert.
        if !host_func_def.return_type.is_empty_tuple() {
            validate_all_paths_return_or_revert(&body)?
        }

        traverse_statements(Rc::clone(&host_func_def.scope), Rc::clone(&context), body)?;

        return Ok(());
    }

    unreachable!()
}
/// Gather context information for a function body and check for type errors.
Gather context information for a function body and check for type errors.
Gather context information for a function body and check for type errors .
pub fn func_body(
    contract_scope: Shared<ContractScope>,
    context: Shared<Context>,
    def: &Spanned<fe::ContractStmt>,
) -> Result<(), SemanticError> {
    if let fe::ContractStmt::FuncDef {
        qual: _,
        name,
        args: _,
        return_type: _,
        body,
    } = &def.node
    {
        let host_func_def = contract_scope
            .borrow()
            .function_def(name.node)
            .unwrap_or_else(|| panic!("Failed to lookup function definition for {}", &name.node));
        // If the return type is an empty tuple we do not have to validate any further
        // at this point because both returning (explicit) or not returning (implicit
        // return) are valid syntax.
        // If the return type is anything else, we do need to ensure that all code paths
        // return or revert.
        if !host_func_def.return_type.is_empty_tuple() {
            validate_all_paths_return_or_revert(&body)?
        }
        traverse_statements(Rc::clone(&host_func_def.scope), Rc::clone(&context), body)?;
        return Ok(());
    }
    unreachable!()
}
pub fn func_body ( contract_scope : Shared < ContractScope > , context : Shared < Context > , def : & Spanned < fe :: ContractStmt > , ) -> Result < ( ) , SemanticError > { if let fe :: ContractStmt :: FuncDef { qual : _ , name , args : _ , return_type : _ , body , } = & def . node { let host_func_def = contract_scope . borrow ( ) . function_def ( name . node ) . unwrap_or_else ( | | panic ! ( " " name node ) ) ; // If the return type is an empty tuple we do not have to validate any further // at this point because both returning (explicit) or not returning (implicit // return) are valid syntax. // If the return type is anything else, we do need to ensure that all code paths // return or revert. if ! host_func_def . return_type . is_empty_tuple ( ) { validate_all_paths_return_or_revert ( & body ) ? } traverse_statements ( Rc :: clone ( & host_func_def . scope ) , Rc :: clone ( & context ) , body ) ? ; return Ok ( ( ) ) ; } unreachable ! ( ) }
Gather context information for a function body and check for type errors.
Gather context information for a function body and check for type errors .
contract_scope
Shared<ContractScope>
context
Shared<Context>
def
&Spanned<fe::ContractStmt>
contract_scope
Shared<ContractScope>
context
Shared<Context>
def
&Spanned<fe::ContractStmt>