@@ -391,11 +391,11 @@ export def walk_Def(node: &parser::Node, state: &typechecking::State) {
391391 }
392392 }
393393
394- var tpe = typechecking::function (parser::identifier_to_str(name), parameter_t, return_t, state.module, extern, test = test).resolve()
394+ var fdef = typechecking::function_def (parser::identifier_to_str(name), parameter_t, return_t, state.module, extern, test = test) !&FunctionDef
395395 //tpe.node = node
396396 let current_function = errors::current_function
397397 let current_signature = errors::current_signature
398- errors::current_function = tpe.type_name
398+ errors::current_function = fdef.name
399399 errors::current_signature = node.signature_hash
400400
401401 if body {
@@ -410,9 +410,9 @@ export def walk_Def(node: &parser::Node, state: &typechecking::State) {
410410 node.svalue = scope::create_function(state.scope, name, function.value)
411411 } else {
412412 if body {
413- node.svalue = scope::create_function(state.scope, name, share, tpe.id , scope::Phase::DEFINED, node, local_type_defs, impl = impl)
413+ node.svalue = scope::create_function(state.scope, name, share, @fdef , scope::Phase::DEFINED, node, local_type_defs, impl = impl)
414414 } else {
415- node.svalue = scope::create_function(state.scope, name, share, tpe.id , scope::Phase::DECLARED, node, local_type_defs)
415+ node.svalue = scope::create_function(state.scope, name, share, @fdef , scope::Phase::DECLARED, node, local_type_defs)
416416 }
417417 }
418418 if node.svalue {
@@ -424,7 +424,7 @@ export def walk_Def(node: &parser::Node, state: &typechecking::State) {
424424
425425 if not function {
426426 function = [
427- tpe = tpe.id ,
427+ fdef = @fdef ,
428428 module = state.module,
429429 locals = map::make(typechecking::TypeId),
430430 unmangled = parser::identifier_to_str(name),
@@ -476,7 +476,7 @@ export def walk_Def(node: &parser::Node, state: &typechecking::State) {
476476
477477 errors::current_function = current_function
478478 errors::current_signature = current_signature
479- node.tpe = tpe.id
479+ node.fdef = fdef
480480}
481481
482482export def walk_TypeDecl(node: &parser::Node, state: &typechecking::State) {
@@ -573,8 +573,8 @@ export def walk_TypeDecl(node: &parser::Node, state: &typechecking::State) {
573573 return_t.push(builtins::string_)
574574
575575 let ident = parser::make_identifier("to_string")
576- let ftpe = typechecking::function ("to_string", parameter_t, return_t)
577- let v = scope::create_function(state.scope, ident, parser::ShareMarker::EXPORT, ftpe , local_type_defs = make_local_type_defs())
576+ let fdef = typechecking::function_def ("to_string", parameter_t, return_t)
577+ let v = scope::create_function(state.scope, ident, parser::ShareMarker::EXPORT, fdef , local_type_defs = make_local_type_defs())
578578 v.identifier = ident
579579 left.svalue = scope::create_type(state.scope, name, share, tpe, scope::Phase::DEFINED, null)
580580 typechecking::register(tpe, enum_tpe)
@@ -831,7 +831,7 @@ export def compile_function(value: &scope::Value, context: &scope::Scope, argume
831831 var function = node.value.def_.function
832832 if function.is_typechecked and not is_repurposed { return value }
833833
834- let is_polymorph = typechecking::is_polymorph(function.tpe.resolve() .parameter_t)
834+ let is_polymorph = typechecking::is_polymorph(function.fdef.sig .parameter_t)
835835 if not is_polymorph {
836836 compiler::predeclare_function(function, overwrite = true)
837837 const_module.result.functions(function.name) = function
@@ -868,10 +868,10 @@ export def compile_function(value: &scope::Value, context: &scope::Scope, argume
868868
869869 //print("Creating function ", function.tpe.type_name, "\n")
870870
871- // This is a big ugly but what can we do
871+ // This is a bit ugly but what can we do
872872 let debug = toolchain::debug_sym
873873 toolchain::debug_sym = false
874- compiler::create_function(node, node.tpe , node.value.def_.body, node.inner_scope, null, compiler_state, params = node.value.def_.params)
874+ compiler::create_function(node, function.fdef , node.value.def_.body, node.inner_scope, null, compiler_state, params = node.value.def_.params)
875875 toolchain::debug_sym = debug
876876
877877 if function.defer_functions {
0 commit comments