-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbreak_tree.rs
More file actions
30 lines (27 loc) · 826 Bytes
/
break_tree.rs
File metadata and controls
30 lines (27 loc) · 826 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use tracing::debug;
use crate::{
ir::{ast::ToIR, block::NodeIndex},
parser::ast::break_tree::BreakTree,
};
use super::IRConstructor;
impl ToIR for BreakTree {
fn to_ir(&self, constructor: &mut IRConstructor) -> Option<NodeIndex> {
debug!(
"Generating IR for break statement with active loops: {:?}",
constructor.active_loop_exits
);
let jump = constructor.create_jump();
constructor.register_entry_point(
*constructor.active_loop_exits.last().unwrap(),
constructor.current_block(),
jump,
);
debug!(
"Modifying entry_points of {:?}",
constructor
.graph
.get_block_mut(*constructor.active_loop_exits.last().unwrap())
);
None
}
}