@@ -457,7 +457,8 @@ impl FuncTranslator {
457
457
fn translate_end_if ( & mut self , frame : IfControlFrame ) -> Result < ( ) , Error > {
458
458
debug_assert ! ( !self . stack. is_control_empty( ) ) ;
459
459
let IfReachability :: Both { else_label } = frame. reachability ( ) else {
460
- return self . translate_end_if_then_or_else_only ( frame) ;
460
+ let reachability = frame. reachability ( ) . into ( ) ;
461
+ return self . translate_end_if_or_else_only ( frame, reachability) ;
461
462
} ;
462
463
let end_of_then_reachable = self . reachable ;
463
464
let len_results = frame. ty ( ) . len_results ( self . engine ( ) ) ;
@@ -481,12 +482,16 @@ impl FuncTranslator {
481
482
Ok ( ( ) )
482
483
}
483
484
484
- /// Translates the end of a Wasm `if` control frame where only one branch is known to be reachable.
485
- fn translate_end_if_then_or_else_only ( & mut self , frame : IfControlFrame ) -> Result < ( ) , Error > {
486
- let end_is_reachable = match frame. reachability ( ) {
487
- IfReachability :: OnlyThen => self . reachable ,
488
- IfReachability :: OnlyElse => true ,
489
- IfReachability :: Both { .. } => unreachable ! ( ) ,
485
+ /// Translates the end of a Wasm `else` control frame where only one branch is known to be reachable.
486
+ fn translate_end_if_or_else_only (
487
+ & mut self ,
488
+ frame : impl ControlFrameBase ,
489
+ reachability : ElseReachability ,
490
+ ) -> Result < ( ) , Error > {
491
+ let end_is_reachable = match reachability {
492
+ ElseReachability :: OnlyThen => self . reachable ,
493
+ ElseReachability :: OnlyElse => true ,
494
+ ElseReachability :: Both => unreachable ! ( ) ,
490
495
} ;
491
496
if end_is_reachable && frame. is_branched_to ( ) {
492
497
let len_values = frame. len_branch_params ( & self . engine ) ;
0 commit comments