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
use std::fmt::{Display, Formatter, Result};
use crate::instruction::TypeId;
#[derive(Clone, Debug, PartialEq)]
pub struct DecArg {
name: String,
ty: TypeId,
}
impl DecArg {
pub fn new(name: String, ty: TypeId) -> DecArg {
DecArg { name, ty }
}
pub fn name(&self) -> &str {
&self.name
}
pub fn get_type(&self) -> &TypeId {
&self.ty
}
}
impl Display for DecArg {
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
write!(f, "{}: {}", self.name, self.ty.id())
}
}