feat(env): move env out of vm,

This commit is contained in:
2025-05-23 19:19:20 +08:00
parent 5291e49313
commit b41fd38bcc
10 changed files with 62 additions and 41 deletions

View File

@@ -10,8 +10,9 @@ use super::common::*;
use super::public as p;
use crate::bytecode::OpCodes;
use crate::env::VmEnv;
use crate::error::*;
use crate::vm::{VM, VmEnv};
use crate::vm::VM;
mod attrset;
mod func;
@@ -231,7 +232,7 @@ impl<'jit, 'vm> Value<'jit, 'vm> {
pub fn lt(&mut self, other: Self) {
use Const::*;
*self = VmConst(Bool(match (&*self, other) {
*self = VmConst(Bool(match (&*self, other) {
(VmConst(Int(a)), VmConst(Int(b))) => *a < b,
(VmConst(Int(a)), VmConst(Float(b))) => (*a as f64) < b,
(VmConst(Float(a)), VmConst(Int(b))) => *a < b as f64,
@@ -241,7 +242,7 @@ impl<'jit, 'vm> Value<'jit, 'vm> {
(_, x @ Value::Catchable(_)) => {
*self = x;
return;
},
}
_ => todo!(),
}))
}