fn install_function(
        &mut self,
        module: &Module,
        item: &Item,
        f: &ModuleFn,
    ) -> Result<(), ContextError> {
        let item = module.item.join(item);
        self.names.insert(&item);

        let hash = Hash::type_hash(&item);

        let signature = ContextSignature::Function {
            type_hash: hash,
            item: item.clone(),
            args: f.args,
        };

        if let Some(old) = self.functions_info.insert(hash, signature) {
            return Err(ContextError::ConflictingFunction {
                signature: old,
                hash,
            });
        }

        self.constants.insert(
            Hash::instance_function(hash, Protocol::INTO_TYPE_NAME),
            ConstValue::String(item.to_string()),
        );

        self.functions.insert(hash, f.handler.clone());
        self.meta.insert(
            item.clone(),
            CompileMeta {
                item: Arc::new(item.into()),
                kind: CompileMetaKind::Function {
                    type_hash: hash,
                    is_test: false,
                },
                source: None,
            },
        );

        Ok(())
    }
/// Install a function and check for duplicates.
Install a function and check for duplicates.
Install a function and check for duplicates .
fn install_function(
        &mut self,
        module: &Module,
        item: &Item,
        f: &ModuleFn,
    ) -> Result<(), ContextError> {
        let item = module.item.join(item);
        self.names.insert(&item);
        let hash = Hash::type_hash(&item);
        let signature = ContextSignature::Function {
            type_hash: hash,
            item: item.clone(),
            args: f.args,
        };
        if let Some(old) = self.functions_info.insert(hash, signature) {
            return Err(ContextError::ConflictingFunction {
                signature: old,
                hash,
            });
        }
        self.constants.insert(
            Hash::instance_function(hash, Protocol::INTO_TYPE_NAME),
            ConstValue::String(item.to_string()),
        );
        self.functions.insert(hash, f.handler.clone());
        self.meta.insert(
            item.clone(),
            CompileMeta {
                item: Arc::new(item.into()),
                kind: CompileMetaKind::Function {
                    type_hash: hash,
                    is_test: false,
                },
                source: None,
            },
        );
        Ok(())
    }
fn install_function ( & mut self , module : & Module , item : & Item , f : & ModuleFn , ) -> Result < ( ) , ContextError > { let item = module . item . join ( item ) ; self . names . insert ( & item ) ; let hash = Hash :: type_hash ( & item ) ; let signature = ContextSignature :: Function { type_hash : hash , item : item . clone ( ) , args : f . args , } ; if let Some ( old ) = self . functions_info . insert ( hash , signature ) { return Err ( ContextError :: ConflictingFunction { signature : old , hash , } ) ; } self . constants . insert ( Hash :: instance_function ( hash , Protocol :: INTO_TYPE_NAME ) , ConstValue :: String ( item . to_string ( ) ) , ) ; self . functions . insert ( hash , f . handler . clone ( ) ) ; self . meta . insert ( item . clone ( ) , CompileMeta { item : Arc :: new ( item . into ( ) ) , kind : CompileMetaKind :: Function { type_hash : hash , is_test : false , } , source : None , } , ) ; Ok ( ( ) ) }
Install a function and check for duplicates.
Install a function and check for duplicates .
&mut self
module
&Module
item
&Item
f
&ModuleFn
&mut self
module
&Module
item
&Item
f
&ModuleFn