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:
nyash-codex
2025-11-11 22:35:45 +09:00
parent 52b62c5772
commit 9e2fa1e36e
19 changed files with 1309 additions and 35 deletions

View File

@ -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,