Skip to main content

luaur_bytecode/methods/
call_inliner_set_fallthrough.rs

1use crate::enums::bc_block_edge_kind::BcBlockEdgeKind;
2use crate::records::bc_block_edge::BcBlockEdge;
3use crate::records::bc_op::BcOp;
4use crate::records::call_inliner::CallInliner;
5use crate::type_aliases::bc_edges::BcEdges;
6
7impl<'a> CallInliner<'a> {
8    pub fn set_fallthrough(&mut self, edges: &mut BcEdges, entry: BcOp) {
9        for e in edges.iter_mut() {
10            if e.kind == BcBlockEdgeKind::Fallthrough {
11                e.target = entry;
12                return;
13            }
14        }
15        edges.push_back(BcBlockEdge {
16            kind: BcBlockEdgeKind::Fallthrough,
17            target: entry,
18        });
19    }
20}