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
31
32
33
34
35
36
37
38
39
40
use super::*;

/// Represents a basic block in a [FunctionDeclaration]
#[derive(Spanned)]
pub struct Block {
    #[span]
    pub span: SourceSpan,
    pub id: crate::Block,
    pub params: Vec<TypedValue>,
    pub body: Vec<Inst>,
}
impl Block {
    pub fn new(
        span: SourceSpan,
        id: crate::Block,
        params: Vec<TypedValue>,
        body: Vec<Inst>,
    ) -> Self {
        Self {
            span,
            id,
            params,
            body,
        }
    }
}
impl fmt::Debug for Block {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        f.debug_struct("Block")
            .field("id", &format_args!("{}", self.id))
            .field("params", &self.params)
            .field("body", &self.body)
            .finish()
    }
}
impl PartialEq for Block {
    fn eq(&self, other: &Self) -> bool {
        self.id == other.id && self.params == other.params && self.body == other.body
    }
}