Fix br_if and then tee_local validation. (#76)
This commit is contained in:
parent
6253dd6fdf
commit
522fa20983
|
@ -371,10 +371,7 @@ impl Validator {
|
||||||
|
|
||||||
fn validate_tee_local(context: &mut FunctionValidationContext, index: u32) -> Result<InstructionOutcome, Error> {
|
fn validate_tee_local(context: &mut FunctionValidationContext, index: u32) -> Result<InstructionOutcome, Error> {
|
||||||
let local_type = context.require_local(index)?;
|
let local_type = context.require_local(index)?;
|
||||||
let value_type = context.tee_value(StackValueType::Any)?;
|
context.tee_value(local_type)?;
|
||||||
if local_type != value_type {
|
|
||||||
return Err(Error(format!("Trying to update local {} of type {:?} with value of type {:?}", index, local_type, value_type)));
|
|
||||||
}
|
|
||||||
Ok(InstructionOutcome::ValidateNextInstruction)
|
Ok(InstructionOutcome::ValidateNextInstruction)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -641,10 +638,10 @@ impl<'a> FunctionValidationContext<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn tee_value(&mut self, value_type: StackValueType) -> Result<StackValueType, Error> {
|
fn tee_value(&mut self, value_type: StackValueType) -> Result<(), Error> {
|
||||||
let value = self.pop_value(value_type)?;
|
let _ = self.pop_value(value_type)?;
|
||||||
self.push_value(value)?;
|
self.push_value(value_type)?;
|
||||||
Ok(value)
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn unreachable(&mut self) -> Result<(), Error> {
|
fn unreachable(&mut self) -> Result<(), Error> {
|
||||||
|
|
Loading…
Reference in New Issue