Skip to content

Commit

Permalink
check whether there is a block after control_if
Browse files Browse the repository at this point in the history
  • Loading branch information
pufferfish101007 committed Aug 16, 2023
1 parent 2e18758 commit d22578b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ impl IrBlockVec for Vec<IrBlock> {
},
BlockOpcode::control_if => {
let substack_id = if let BlockArrayOrId::Id(id) = block_info.inputs.get("SUBSTACK").expect("missing SUBSTACK input for control_if").get_1().unwrap().clone().unwrap() { id } else { panic!("malformed SUBSTACK input") };
vec![IrOpcode::hq_goto_if { step: Some(step_from_top_block(substack_id, block_info.next.clone(), blocks, Rc::clone(&context))), does_yield: false, }, IrOpcode::hq_goto { step: Some(step_from_top_block(block_info.next.clone().unwrap(), None, blocks, Rc::clone(&context))), does_yield: false, }]
vec![IrOpcode::hq_goto_if { step: Some(step_from_top_block(substack_id, block_info.next.clone(), blocks, Rc::clone(&context))), does_yield: false, }, IrOpcode::hq_goto { step: if block_info.next.is_some() { Some(step_from_top_block(block_info.next.clone().unwrap(), None, blocks, Rc::clone(&context))) } else { None }, does_yield: false, }]
}
BlockOpcode::control_if_else => {
let substack_id = if let BlockArrayOrId::Id(id) = block_info.inputs.get("SUBSTACK").expect("missing SUBSTACK input for control_if").get_1().unwrap().clone().unwrap() { id } else { panic!("malformed SUBSTACK input") };
Expand Down

0 comments on commit d22578b

Please sign in to comment.