This repository has been archived on 2024-06-24. You can view files and clone it, but cannot push or open issues or pull requests.
huia/huia-compiler/src/block.rs

26 lines
430 B
Rust
Raw Normal View History

2019-03-17 18:52:21 +13:00
use crate::ir::IR;
#[derive(Debug, Default, PartialEq)]
2019-03-17 18:52:21 +13:00
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
}
}