Phase 5: Complete destination pattern unification (28 sites, 53 lines)
Unified remaining destination write patterns with new helpers: - write_string() for VMValue::String writes - write_from_box() for VMValue::from_nyash_box() patterns Files updated: - boxes.rs: 8 sites unified (-14 lines) - boxes_plugin.rs: 9 sites unified (-17 lines) - boxes_object_fields.rs: 7 sites unified (-14 lines) - boxes_instance.rs: 2 sites unified (-4 lines) - calls.rs: 2 sites unified (-4 lines) - destination_helpers.rs: +28 lines (new helpers) Impact: 28 sites unified, net -25 lines, improved maintainability 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:
@ -45,4 +45,32 @@ impl MirInterpreter {
|
||||
self.regs.insert(d, value);
|
||||
}
|
||||
}
|
||||
|
||||
/// String値をdestinationに書き込む
|
||||
///
|
||||
/// # Arguments
|
||||
/// * `dst` - 書き込み先のValueId (Noneの場合は何もしない)
|
||||
/// * `value` - 書き込むString
|
||||
#[inline]
|
||||
pub(crate) fn write_string(&mut self, dst: Option<ValueId>, value: String) {
|
||||
if let Some(d) = dst {
|
||||
self.regs.insert(d, VMValue::String(value));
|
||||
}
|
||||
}
|
||||
|
||||
/// Box<dyn NyashBox>をVMValueに変換してdestinationに書き込む
|
||||
///
|
||||
/// # Arguments
|
||||
/// * `dst` - 書き込み先のValueId (Noneの場合は何もしない)
|
||||
/// * `nyash_box` - 書き込むBox (NullBox→Void, IntegerBox→Integer等に自動変換)
|
||||
#[inline]
|
||||
pub(crate) fn write_from_box(
|
||||
&mut self,
|
||||
dst: Option<ValueId>,
|
||||
nyash_box: Box<dyn crate::box_trait::NyashBox>,
|
||||
) {
|
||||
if let Some(d) = dst {
|
||||
self.regs.insert(d, VMValue::from_nyash_box(nyash_box));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user