better type assertion ergonomic

This commit is contained in:
2026-04-20 17:57:54 +08:00
parent 581c333070
commit 11b0b8a78e
13 changed files with 399 additions and 258 deletions
+10 -10
View File
@@ -1,6 +1,6 @@
use gc_arena::{Gc, Mutation, RefLock};
use crate::{BytecodeReader, StepResult, ThunkState, Value};
use crate::{BytecodeReader, Step, ThunkState, Value};
impl<'gc> crate::Vm<'gc> {
#[inline(always)]
@@ -8,7 +8,7 @@ impl<'gc> crate::Vm<'gc> {
&mut self,
reader: &mut BytecodeReader<'_>,
mc: &Mutation<'gc>,
) -> StepResult {
) -> Step {
let entry_point = reader.read_u32();
let thunk = Gc::new(
mc,
@@ -18,8 +18,8 @@ impl<'gc> crate::Vm<'gc> {
with_env: self.with_env,
}),
);
self.push_stack(Value::new_gc(thunk));
StepResult::Continue
self.push(Value::new_gc(thunk));
Step::Continue
}
#[inline(always)]
@@ -27,7 +27,7 @@ impl<'gc> crate::Vm<'gc> {
&mut self,
reader: &mut BytecodeReader<'_>,
mc: &Mutation<'gc>,
) -> StepResult {
) -> Step {
let entry_point = reader.read_u32();
let n_locals = reader.read_u32();
let closure = Gc::new(
@@ -39,8 +39,8 @@ impl<'gc> crate::Vm<'gc> {
pattern: None,
},
);
self.push_stack(Value::new_gc(closure));
StepResult::Continue
self.push(Value::new_gc(closure));
Step::Continue
}
#[inline(always)]
@@ -48,7 +48,7 @@ impl<'gc> crate::Vm<'gc> {
&mut self,
reader: &mut BytecodeReader<'_>,
mc: &Mutation<'gc>,
) -> StepResult {
) -> Step {
let entry_point = reader.read_u32();
let n_locals = reader.read_u32();
let req_count = reader.read_u16() as usize;
@@ -89,7 +89,7 @@ impl<'gc> crate::Vm<'gc> {
pattern: Some(pattern),
},
);
self.push_stack(Value::new_gc(closure));
StepResult::Continue
self.push(Value::new_gc(closure));
Step::Continue
}
}