Step -> ControlFlow (use ?)

This commit is contained in:
2026-04-21 09:31:41 +08:00
parent 11b0b8a78e
commit b31c2a4906
11 changed files with 86 additions and 128 deletions
+10 -16
View File
@@ -38,13 +38,13 @@ impl<'gc> crate::Vm<'gc> {
kv.sort_by_key(|(k, _)| *k);
let attrs = Gc::new(mc, AttrSet::from_sorted_unchecked(kv));
self.push(Value::new_gc(attrs));
Step::Continue
Step::Continue(())
}
#[inline(always)]
pub(crate) fn op_make_empty_attrs(&mut self) -> Step {
self.push(self.empty_attrs);
Step::Continue
Step::Continue(())
}
#[inline(always)]
@@ -57,9 +57,7 @@ impl<'gc> crate::Vm<'gc> {
let _span_id = reader.read_u32();
let key = reader.read_string_id();
if let Some(step) = self.try_force(0, reader, mc) {
return step;
}
self.try_force(0, reader, mc)?;
let attrs = self.peek(0).restrict().expect("forced");
let Some(attrset) = attrs.as_gc::<AttrSet>() else {
@@ -89,7 +87,7 @@ impl<'gc> crate::Vm<'gc> {
}
},
}
Step::Continue
Step::Continue(())
}
#[inline(always)]
@@ -101,12 +99,8 @@ impl<'gc> crate::Vm<'gc> {
) -> Step {
let _span_id = reader.read_u32();
if let Some(step) = self.try_force(0, reader, mc) {
return step;
}
if let Some(step) = self.try_force(1, reader, mc) {
return step;
}
self.try_force(0, reader, mc)?;
self.try_force(1, reader, mc)?;
let key_val = self.stack[self.stack.len() - 1]
.restrict()
@@ -136,7 +130,7 @@ impl<'gc> crate::Vm<'gc> {
return self.finish_err(Error::eval_error(format!("attribute '{name}' missing")));
}
}
Step::Continue
Step::Continue(())
}
#[inline(always)]
@@ -146,7 +140,7 @@ impl<'gc> crate::Vm<'gc> {
) -> Step {
let offset = reader.read_i32();
reader.set_pc(((reader.pc() as isize) + (offset as isize)) as usize);
Step::Continue
Step::Continue(())
}
#[inline(always)]
@@ -169,13 +163,13 @@ impl<'gc> crate::Vm<'gc> {
}
let list = Gc::new(mc, List { inner: items });
self.push(Value::new_gc(list));
Step::Continue
Step::Continue(())
}
#[inline(always)]
pub(crate) fn op_make_empty_list(&mut self) -> Step {
self.push(self.empty_list);
Step::Continue
Step::Continue(())
}
}