stage3: unify to cleanup; MIR return-defer; docs+smokes updated; LLVM(harness): finalize_phis ownership, ret.py simplified, uses-predeclare; cleanup return override green; method-postfix cleanup return WIP (PHI head)
This commit is contained in:
@ -439,6 +439,19 @@ impl PluginLoaderV2 {
|
||||
}
|
||||
Ok(None)
|
||||
}
|
||||
("env.result", "ok") => {
|
||||
// Wrap the first argument as Result.Ok; if missing, use Void
|
||||
let v = args.get(0).map(|b| b.clone_box()).unwrap_or_else(|| Box::new(crate::box_trait::VoidBox::new()));
|
||||
Ok(Some(Box::new(crate::boxes::result::NyashResultBox::new_ok(v))))
|
||||
}
|
||||
("env.result", "err") => {
|
||||
// Wrap the first argument as Result.Err; if missing, synthesize a StringBox("Error")
|
||||
let e: Box<dyn NyashBox> = args
|
||||
.get(0)
|
||||
.map(|b| b.clone_box())
|
||||
.unwrap_or_else(|| Box::new(crate::box_trait::StringBox::new("Error")));
|
||||
Ok(Some(Box::new(crate::boxes::result::NyashResultBox::new_err(e))))
|
||||
}
|
||||
("env.modules", "set") => {
|
||||
if args.len() >= 2 {
|
||||
let key = args[0].to_string_box().value;
|
||||
|
||||
@ -35,8 +35,8 @@ pub extern "C" fn nyash_plugin_invoke_v2_shim(
|
||||
result_len: *mut usize,
|
||||
) -> i32 {
|
||||
if let Some(f) = box_invoke_for_type_id(type_id) {
|
||||
// Safety: Plugin-provided function pointer; adhere to C ABI
|
||||
return unsafe { f(instance_id, method_id, args, args_len, result, result_len) };
|
||||
// BoxInvokeFn is extern "C"; call directly (no additional unsafe needed here)
|
||||
return f(instance_id, method_id, args, args_len, result, result_len);
|
||||
}
|
||||
// E_PLUGIN (-5) when not found
|
||||
-5
|
||||
|
||||
Reference in New Issue
Block a user