Skip to content

Commit 522fa20

Browse files
authored
Fix br_if and then tee_local validation. (#76)
1 parent 6253dd6 commit 522fa20

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/validation/func.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -371,10 +371,7 @@ impl Validator {
371371

372372
fn validate_tee_local(context: &mut FunctionValidationContext, index: u32) -> Result<InstructionOutcome, Error> {
373373
let local_type = context.require_local(index)?;
374-
let value_type = context.tee_value(StackValueType::Any)?;
375-
if local_type != value_type {
376-
return Err(Error(format!("Trying to update local {} of type {:?} with value of type {:?}", index, local_type, value_type)));
377-
}
374+
context.tee_value(local_type)?;
378375
Ok(InstructionOutcome::ValidateNextInstruction)
379376
}
380377

@@ -641,10 +638,10 @@ impl<'a> FunctionValidationContext<'a> {
641638
}
642639
}
643640

644-
fn tee_value(&mut self, value_type: StackValueType) -> Result<StackValueType, Error> {
645-
let value = self.pop_value(value_type)?;
646-
self.push_value(value)?;
647-
Ok(value)
641+
fn tee_value(&mut self, value_type: StackValueType) -> Result<(), Error> {
642+
let _ = self.pop_value(value_type)?;
643+
self.push_value(value_type)?;
644+
Ok(())
648645
}
649646

650647
fn unreachable(&mut self) -> Result<(), Error> {

0 commit comments

Comments
 (0)