get_local can't fail.
This commit is contained in:
parent
e529e3208b
commit
4821368c52
|
@ -486,9 +486,9 @@ impl<'a, E: Externals> Interpreter<'a, E> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run_get_local(&mut self, context: &mut FunctionContext, index: u32) -> Result<InstructionOutcome, Error> {
|
fn run_get_local(&mut self, context: &mut FunctionContext, index: u32) -> Result<InstructionOutcome, Error> {
|
||||||
context.get_local(index as usize)
|
let value = context.get_local(index as usize);
|
||||||
.map(|value| context.value_stack_mut().push(value))
|
context.value_stack_mut().push(value)?;
|
||||||
.map(|_| InstructionOutcome::RunNextInstruction)
|
Ok(InstructionOutcome::RunNextInstruction)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run_set_local(&mut self, context: &mut FunctionContext, index: u32) -> Result<InstructionOutcome, Error> {
|
fn run_set_local(&mut self, context: &mut FunctionContext, index: u32) -> Result<InstructionOutcome, Error> {
|
||||||
|
@ -1071,10 +1071,10 @@ impl FunctionContext {
|
||||||
Ok(InstructionOutcome::RunNextInstruction)
|
Ok(InstructionOutcome::RunNextInstruction)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_local(&mut self, index: usize) -> Result<RuntimeValue, Error> {
|
pub fn get_local(&mut self, index: usize) -> RuntimeValue {
|
||||||
Ok(self.locals.get(index)
|
self.locals.get(index)
|
||||||
.cloned()
|
.cloned()
|
||||||
.expect("Due to validation local should exists"))
|
.expect("Due to validation local should exists")
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn value_stack(&self) -> &StackWithLimit<RuntimeValue> {
|
pub fn value_stack(&self) -> &StackWithLimit<RuntimeValue> {
|
||||||
|
|
Loading…
Reference in New Issue