fix: MIR builder me resolution for static box methods

- Fixed me ValueId inconsistency in static box methods
- Previously, each me reference generated a new const __me__ ValueId
- Now caches the first me ValueId in variable_map for reuse
- This ensures RefSet and RefGet operate on the same object
- ArrayBox get/set/push now working correctly in VM mode
- Test results: 1, 42, 3 (as expected)

🔧 Technical Details:
- build_me_expression() now stores fallback ValueId in variable_map
- Subsequent me references reuse the same ValueId
- VM BoxCall debug logs confirm ArrayBox methods dispatch correctly

Co-Authored-By: ChatGPT5
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Moe Charm
2025-08-23 21:13:02 +09:00
parent fffbac9aac
commit 2949648e71
10 changed files with 350 additions and 52 deletions

View File

@ -47,6 +47,15 @@ impl NyashInterpreter {
Ok(socket_box.accept())
}
"acceptTimeout" | "accept_timeout" => {
if arguments.len() != 1 {
return Err(RuntimeError::InvalidOperation {
message: format!("acceptTimeout(ms) expects 1 argument, got {}", arguments.len()),
});
}
let ms = self.execute_expression(&arguments[0])?;
Ok(socket_box.accept_timeout(ms))
}
"connect" => {
if arguments.len() != 2 {
return Err(RuntimeError::InvalidOperation {
@ -67,6 +76,15 @@ impl NyashInterpreter {
Ok(socket_box.read())
}
"recvTimeout" | "recv_timeout" => {
if arguments.len() != 1 {
return Err(RuntimeError::InvalidOperation {
message: format!("recvTimeout(ms) expects 1 argument, got {}", arguments.len()),
});
}
let ms = self.execute_expression(&arguments[0])?;
Ok(socket_box.recv_timeout(ms))
}
"readHttpRequest" => {
if !arguments.is_empty() {
return Err(RuntimeError::InvalidOperation {
@ -284,4 +302,4 @@ impl NyashInterpreter {
}),
}
}
}
}