Phase 6 WIP: Type conversion helpers (11 sites, 23 lines)

Added conversion_helpers.rs with unified type conversion:
- load_as_box() for reg_load().to_nyash_box()
- load_as_string() for reg_load().to_string()
- load_as_int/bool() for type-checked loads
- load_args_as_boxes/values() for bulk conversion

Files updated (partial):
- boxes.rs: 2 sites (-6 lines)
- calls.rs: 5 sites (-10 lines)
- boxes_plugin.rs: 1 site (-3 lines)
- externals.rs: 3 sites (-4 lines)

Next: boxes_array, boxes_map, boxes_object_fields, boxes_instance

Tests: Phase 21.0 PASS (2/2, 100%)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
nyash-codex
2025-11-07 00:21:42 +09:00
parent 2429627d04
commit 8488df58a8
6 changed files with 137 additions and 27 deletions

View File

@ -41,10 +41,7 @@ pub(super) fn invoke_plugin_box(
}
let host = crate::runtime::plugin_loader_unified::get_global_plugin_host();
let host = host.read().unwrap();
let mut argv: Vec<Box<dyn NyashBox>> = Vec::with_capacity(args.len());
for a in args {
argv.push(this.reg_load(*a)?.to_nyash_box());
}
let argv = this.load_args_as_boxes(args)?;
match host.invoke_instance_method(&p.box_type, method, p.inner.instance_id, &argv) {
Ok(Some(ret)) => {
this.write_from_box(dst, ret);