better type assertion ergonomic
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
use crate::{BytecodeReader, Mutation, StepResult, Value};
|
||||
use crate::{BytecodeReader, Mutation, Step, Value};
|
||||
|
||||
impl<'gc> crate::Vm<'gc> {
|
||||
#[inline(always)]
|
||||
pub(crate) fn op_load_local(&mut self, reader: &mut BytecodeReader<'_>) -> StepResult {
|
||||
pub(crate) fn op_load_local(&mut self, reader: &mut BytecodeReader<'_>) -> Step {
|
||||
let idx = reader.read_u32() as usize;
|
||||
self.push_stack(self.env.borrow().locals[idx]);
|
||||
StepResult::Continue
|
||||
self.push(self.env.borrow().locals[idx]);
|
||||
Step::Continue
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub(crate) fn op_load_outer(&mut self, reader: &mut BytecodeReader<'_>) -> StepResult {
|
||||
pub(crate) fn op_load_outer(&mut self, reader: &mut BytecodeReader<'_>) -> Step {
|
||||
let layer = reader.read_u8();
|
||||
let idx = reader.read_u32() as usize;
|
||||
let mut cur = self.env;
|
||||
@@ -18,8 +18,8 @@ impl<'gc> crate::Vm<'gc> {
|
||||
cur = prev;
|
||||
}
|
||||
let val = cur.borrow().locals[idx];
|
||||
self.push_stack(val);
|
||||
StepResult::Continue
|
||||
self.push(val);
|
||||
Step::Continue
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
@@ -27,11 +27,11 @@ impl<'gc> crate::Vm<'gc> {
|
||||
&mut self,
|
||||
reader: &mut BytecodeReader<'_>,
|
||||
mc: &Mutation<'gc>,
|
||||
) -> StepResult {
|
||||
) -> Step {
|
||||
let idx = reader.read_u32() as usize;
|
||||
let val = self.pop_stack();
|
||||
let val = self.pop();
|
||||
self.env.borrow_mut(mc).locals[idx] = val;
|
||||
StepResult::Continue
|
||||
Step::Continue
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
@@ -39,12 +39,12 @@ impl<'gc> crate::Vm<'gc> {
|
||||
&mut self,
|
||||
reader: &mut BytecodeReader<'_>,
|
||||
mc: &Mutation<'gc>,
|
||||
) -> StepResult {
|
||||
) -> Step {
|
||||
let count = reader.read_u32() as usize;
|
||||
self.env
|
||||
.borrow_mut(mc)
|
||||
.locals
|
||||
.extend(std::iter::repeat_n(Value::default(), count));
|
||||
StepResult::Continue
|
||||
Step::Continue
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user