use crate::ir::IR;
use std::slice::IterMut;
#[derive(Debug, Default, PartialEq, Clone)]
pub struct Block {
ir: Vec<IR>,
}
impl Block {
/// Consumes the block and returns the IR data.
pub fn ir(self) -> Vec<IR> {
self.ir
pub fn is_empty(&self) -> bool {
self.ir.is_empty()
pub fn iter_mut(&mut self) -> IterMut<IR> {
self.ir.iter_mut()
pub fn pop(&mut self) -> Option<IR> {
self.ir.pop()
pub fn push(&mut self, ir: IR) {
self.ir.push(ir);
#[derive(Debug, Clone, PartialEq)]
pub struct BlockIdx(usize);
impl From<usize> for BlockIdx {
fn from(i: usize) -> BlockIdx {
BlockIdx(i)
impl From<BlockIdx> for usize {
fn from(i: BlockIdx) -> usize {
i.0
impl From<&BlockIdx> for usize {
fn from(i: &BlockIdx) -> usize {