pub fn fun_env<'a>(
    builder: &'a TypeBuilder<'a>,
    provider: &'a dyn decl_provider::DeclProvider,
    f: &'a ast::FunDef,
) -> Env<'a> {
    let genv = empty_global_env(builder, provider, f.name.0.filename().clone());
    let mut env = Env::new(&f.name.0, genv);
    // Terrible hacky conversion from hint, via provider!
    let ty = match provider.get_fun(&f.name.1) {
        None => unimplemented!(),
        Some(f) => {
            let fty = f.type_;
            let ety_env = builder.env_with_self();
            let fty = typing_phase::localize(ety_env, &mut env, fty);
            match fty.get_node() {
                Ty_::Tfun(x) => x.ret.type_,
                x => unimplemented!("{:#?}", x),
            }
        }
    };
    env.set_return_type(ty);
    env
}
// Given a decl provider, a type builder, and the AST for a function definition,
// produce the initial environment for checking a top-level function
Given a decl provider, a type builder, and the AST for a function definition,
produce the initial environment for checking a top-level function
Given a decl provider a type builder and the AST for a function definition produce the initial environment for checking a top - level function
pub fn fun_env<'a>(
    builder: &'a TypeBuilder<'a>,
    provider: &'a dyn decl_provider::DeclProvider,
    f: &'a ast::FunDef,
) -> Env<'a> {
    let genv = empty_global_env(builder, provider, f.name.0.filename().clone());
    let mut env = Env::new(&f.name.0, genv);
    // Terrible hacky conversion from hint, via provider!
    let ty = match provider.get_fun(&f.name.1) {
        None => unimplemented!(),
        Some(f) => {
            let fty = f.type_;
            let ety_env = builder.env_with_self();
            let fty = typing_phase::localize(ety_env, &mut env, fty);
            match fty.get_node() {
                Ty_::Tfun(x) => x.ret.type_,
                x => unimplemented!("{:#?}", x),
            }
        }
    };
    env.set_return_type(ty);
    env
}
pub fn fun_env < ' a > ( builder : & ' a TypeBuilder < ' a > , provider : & ' a dyn decl_provider :: DeclProvider , f : & ' a ast :: FunDef , ) -> Env < ' a > { let genv = empty_global_env ( builder , provider , f . name . 0 . filename ( ) . clone ( ) ) ; let mut env = Env :: new ( & f . name . 0 , genv ) ; // Terrible hacky conversion from hint, via provider! let ty = match provider . get_fun ( & f . name . 1 ) { None => unimplemented ! ( ) , Some ( f ) => { let fty = f . type_ ; let ety_env = builder . env_with_self ( ) ; let fty = typing_phase :: localize ( ety_env , & mut env , fty ) ; match fty . get_node ( ) { Ty_ :: Tfun ( x ) => x . ret . type_ , x => unimplemented ! ( " " x ) , } } } ; env . set_return_type ( ty ) ; env }
Given a decl provider, a type builder, and the AST for a function definition,
produce the initial environment for checking a top-level function
Given a decl provider a type builder and the AST for a function definition produce the initial environment for checking a top - level function
builder
&'a TypeBuilder<'a>
provider
&'a dyn decl_provider::DeclProvider
f
&'a ast::FunDef