Phase 21.6 solidification: chain green (return/binop/loop/call); add Phase 21.7 normalization plan (methodize static boxes). Update CURRENT_TASK.md and docs.
This commit is contained in:
@ -802,6 +802,30 @@ impl MirInterpreter {
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback: user-defined function dispatch for Global calls
|
||||
// If none of the above extern/provider/global bridges matched,
|
||||
// try to resolve and execute a user function present in this module.
|
||||
{
|
||||
// Use unique-tail resolver against snapshot of self.functions
|
||||
let fname = call_resolution::resolve_function_name(
|
||||
func_name,
|
||||
args.len(),
|
||||
&self.functions,
|
||||
self.cur_fn.as_deref(),
|
||||
);
|
||||
if let Some(fname) = fname {
|
||||
if let Some(func) = self.functions.get(&fname).cloned() {
|
||||
// Load arguments and execute
|
||||
let mut argv: Vec<VMValue> = Vec::new();
|
||||
for a in args { argv.push(self.reg_load(*a)?); }
|
||||
if std::env::var("NYASH_VM_CALL_TRACE").ok().as_deref() == Some("1") {
|
||||
eprintln!("[vm] global-call resolved '{}' -> '{}'", func_name, fname);
|
||||
}
|
||||
return self.exec_function_inner(&func, Some(&argv));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn execute_extern_function(
|
||||
&mut self,
|
||||
extern_name: &str,
|
||||
|
||||
Reference in New Issue
Block a user