fn type_check_src_code(src: &str, func_namespace: Vec<String>) {
        let mut parser = Parser::from_src(src);
        let program = parser.parse_program().unwrap();
        let mut interner = NodeInterner::default();

        let mut func_ids = Vec::new();
        for _ in 0..func_namespace.len() {
            func_ids.push(interner.push_fn(HirFunction::empty()));
        }

        let mut path_resolver = TestPathResolver(HashMap::new());
        for (name, id) in func_namespace.into_iter().zip(func_ids.clone()) {
            path_resolver.insert_func(name, id);
        }

        let def_maps: HashMap<CrateId, CrateDefMap> = HashMap::new();

        let func_meta: Vec<_> = program
            .functions
            .into_iter()
            .map(|nf| {
                let resolver = Resolver::new(&mut interner, &path_resolver, &def_maps);
                resolver.resolve_function(nf).unwrap()
            })
            .collect();

        for ((hir_func, meta), func_id) in func_meta.into_iter().zip(func_ids.clone()) {
            interner.update_fn(func_id, hir_func);
            interner.push_fn_meta(meta, func_id)
        }

        // Type check section
        super::type_check_func(&mut interner, func_ids.first().cloned().unwrap()).unwrap();
    }
// This function assumes that there is only one function and this is the
// func id that is returned
This function assumes that there is only one function and this is the
func id that is returned
This function assumes that there is only one function and this is the func id that is returned
fn type_check_src_code(src: &str, func_namespace: Vec<String>) {
        let mut parser = Parser::from_src(src);
        let program = parser.parse_program().unwrap();
        let mut interner = NodeInterner::default();
        let mut func_ids = Vec::new();
        for _ in 0..func_namespace.len() {
            func_ids.push(interner.push_fn(HirFunction::empty()));
        }
        let mut path_resolver = TestPathResolver(HashMap::new());
        for (name, id) in func_namespace.into_iter().zip(func_ids.clone()) {
            path_resolver.insert_func(name, id);
        }
        let def_maps: HashMap<CrateId, CrateDefMap> = HashMap::new();
        let func_meta: Vec<_> = program
            .functions
            .into_iter()
            .map(|nf| {
                let resolver = Resolver::new(&mut interner, &path_resolver, &def_maps);
                resolver.resolve_function(nf).unwrap()
            })
            .collect();
        for ((hir_func, meta), func_id) in func_meta.into_iter().zip(func_ids.clone()) {
            interner.update_fn(func_id, hir_func);
            interner.push_fn_meta(meta, func_id)
        }
        // Type check section
        super::type_check_func(&mut interner, func_ids.first().cloned().unwrap()).unwrap();
    }
fn type_check_src_code ( src : & str , func_namespace : Vec < String > ) { let mut parser = Parser :: from_src ( src ) ; let program = parser . parse_program ( ) . unwrap ( ) ; let mut interner = NodeInterner :: default ( ) ; let mut func_ids = Vec :: new ( ) ; for _ in 0 .. func_namespace . len ( ) { func_ids . push ( interner . push_fn ( HirFunction :: empty ( ) ) ) ; } let mut path_resolver = TestPathResolver ( HashMap :: new ( ) ) ; for ( name , id ) in func_namespace . into_iter ( ) . zip ( func_ids . clone ( ) ) { path_resolver . insert_func ( name , id ) ; } let def_maps : HashMap < CrateId , CrateDefMap > = HashMap :: new ( ) ; let func_meta : Vec < _ > = program . functions . into_iter ( ) . map ( | nf | { let resolver = Resolver :: new ( & mut interner , & path_resolver , & def_maps ) ; resolver . resolve_function ( nf ) . unwrap ( ) } ) . collect ( ) ; for ( ( hir_func , meta ) , func_id ) in func_meta . into_iter ( ) . zip ( func_ids . clone ( ) ) { interner . update_fn ( func_id , hir_func ) ; interner . push_fn_meta ( meta , func_id ) } // Type check section super :: type_check_func ( & mut interner , func_ids . first ( ) . cloned ( ) . unwrap ( ) ) . unwrap ( ) ; }
This function assumes that there is only one function and this is the
func id that is returned
This function assumes that there is only one function and this is the func id that is returned
src
&str
func_namespace
Vec<String>
src
&str
func_namespace
Vec<String>