pub fn module<'a>(module: &'a fe::Module<'a>) -> Result<ModuleAbis, CompileError> {
    let mut type_defs = TypeDefs::new();

    module
        .body
        .iter()
        .try_fold(ModuleAbis::new(), |mut abis, stmt| {
            match &stmt.node {
                fe::ModuleStmt::TypeDef { name, typ } => {
                    if type_defs.insert(name.node, &typ.node).is_some() {
                        return Err(CompileError::static_str("duplicate type definition"));
                    }
                }
                fe::ModuleStmt::ContractDef { name, body } => {
                    if abis
                        .insert(name.node.to_string(), contract_def(&type_defs, body)?)
                        .is_some()
                    {
                        return Err(CompileError::static_str("duplicate contract definition"));
                    }
                }
                _ => {}
            };

            Ok(abis)
        })
}
/// Parse a map of contract ABIs from the input `module`.
Parse a map of contract ABIs from the input `module`.
Parse a map of contract ABIs from the input ` module ` .
pub fn module<'a>(module: &'a fe::Module<'a>) -> Result<ModuleAbis, CompileError> {
    let mut type_defs = TypeDefs::new();
    module
        .body
        .iter()
        .try_fold(ModuleAbis::new(), |mut abis, stmt| {
            match &stmt.node {
                fe::ModuleStmt::TypeDef { name, typ } => {
                    if type_defs.insert(name.node, &typ.node).is_some() {
                        return Err(CompileError::static_str("duplicate type definition"));
                    }
                }
                fe::ModuleStmt::ContractDef { name, body } => {
                    if abis
                        .insert(name.node.to_string(), contract_def(&type_defs, body)?)
                        .is_some()
                    {
                        return Err(CompileError::static_str("duplicate contract definition"));
                    }
                }
                _ => {}
            };
            Ok(abis)
        })
}
pub fn module < ' a > ( module : & ' a fe :: Module < ' a > ) -> Result < ModuleAbis , CompileError > { let mut type_defs = TypeDefs :: new ( ) ; module . body . iter ( ) . try_fold ( ModuleAbis :: new ( ) , | mut abis , stmt | { match & stmt . node { fe :: ModuleStmt :: TypeDef { name , typ } => { if type_defs . insert ( name . node , & typ . node ) . is_some ( ) { return Err ( CompileError :: static_str ( " " ) ) ; } } fe :: ModuleStmt :: ContractDef { name , body } => { if abis . insert ( name . node . to_string ( ) , contract_def ( & type_defs , body ) ? ) . is_some ( ) { return Err ( CompileError :: static_str ( " " ) ) ; } } _ => { } } ; Ok ( abis ) } ) }
Parse a map of contract ABIs from the input `module`.
Parse a map of contract ABIs from the input ` module ` .
module
&'a fe::Module<'a>
module
&'a fe::Module<'a>