26 lines
419 B
Rust
26 lines
419 B
Rust
|
use crate::ir::IR;
|
||
|
|
||
|
#[derive(Debug, Default)]
|
||
|
pub struct Block {
|
||
|
ir: Vec<IR>,
|
||
|
}
|
||
|
|
||
|
impl Block {
|
||
|
pub fn push(&mut self, ir: IR) {
|
||
|
self.ir.push(ir);
|
||
|
}
|
||
|
|
||
|
pub fn pop(&mut self) -> Option<IR> {
|
||
|
self.ir.pop()
|
||
|
}
|
||
|
|
||
|
pub fn is_empty(&self) -> bool {
|
||
|
self.ir.is_empty()
|
||
|
}
|
||
|
|
||
|
/// Consumes the block and returns the IR data.
|
||
|
pub fn ir(self) -> Vec<IR> {
|
||
|
self.ir
|
||
|
}
|
||
|
}
|