Phase 9.75-B: Convert StreamBox from Arc<Mutex> to RwLock, progress on DebugBox

Co-authored-by: moe-charm <217100418+moe-charm@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-08-14 23:59:11 +00:00
parent ffa09b17fb
commit 5bcaa14b52
8 changed files with 92 additions and 45 deletions

View File

@ -751,14 +751,14 @@ impl VM {
if let Some(array_box) = box_value.as_any().downcast_ref::<crate::boxes::array::ArrayBox>() {
match method {
"length" | "len" => {
let items = array_box.items.lock().unwrap();
let items = array_box.items.read().unwrap();
return Ok(Box::new(IntegerBox::new(items.len() as i64)));
},
"get" => {
// get(index) - get element at index
if let Some(index_box) = _args.get(0) {
if let Some(index_int) = index_box.as_any().downcast_ref::<IntegerBox>() {
let items = array_box.items.lock().unwrap();
let items = array_box.items.read().unwrap();
let index = index_int.value as usize;
if index < items.len() {
return Ok(items[index].clone_box());