@@ -878,6 +878,16 @@ export def compile_queued_functions {
878878
879879 for var fdef in @function_queue.keys() {
880880 let entry = function_queue(fdef)
881+
882+ if not entry.node {
883+ // Create dyn dispatch
884+ let function = compiler::predeclare_function(fdef, const_module)
885+ compiler::generate_vtable_function(function, fdef, compiler_state)
886+ const_module.result.functions(function.name) = function
887+ continue
888+ }
889+
890+ // Compile function
881891 let function = compiler::create_function(entry.node, fdef, entry.node.value.def_.body, entry.node.inner_scope, null, compiler_state, params = entry.node.value.def_.params)
882892
883893 if function and function.defer_functions {
@@ -915,11 +925,9 @@ export def compile_function(value: &scope::Value, context: &scope::Scope, argume
915925 var node = value.node
916926 var module = value.module
917927
918- if not node {
919- // Sneak in a call here so that it gets triggered for functions that don't have a node (i.e generated functions)
920- compiler::create_dyn_dispatch(module.dyn_dispatch_consteval, module.compiler_state)
921-
922- return value
928+ if not node {
929+ queue_function(null, value.fdef)
930+ return value
923931 }
924932
925933 /*var is_repurposed = false // When There's no node and we find a new function we don't need to typecheck anymore
@@ -988,7 +996,6 @@ export def compile_function(value: &scope::Value, context: &scope::Scope, argume
988996
989997 //print("Creating function ", function.name, "\n")
990998
991- // This is a bit ugly but what can we do
992999 queue_function(node, function.fdef)
9931000
9941001 compiler::create_dyn_dispatch(state.module.dyn_dispatch_consteval, state.module.compiler_state)
0 commit comments