2023-04-24 01:04:44 +00:00
|
|
|
use super::with;
|
|
|
|
|
|
|
|
#[derive(Copy, Clone, Debug)]
|
|
|
|
pub struct Ty(pub usize);
|
|
|
|
|
|
|
|
impl Ty {
|
|
|
|
pub fn kind(&self) -> TyKind {
|
|
|
|
with(|context| context.ty_kind(*self))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-07-05 18:50:13 -03:00
|
|
|
#[derive(Clone, Debug)]
|
2023-04-24 01:04:44 +00:00
|
|
|
pub enum TyKind {
|
2023-06-28 11:31:28 -03:00
|
|
|
RigidTy(RigidTy),
|
|
|
|
}
|
|
|
|
|
2023-07-05 18:50:13 -03:00
|
|
|
#[derive(Clone, Debug)]
|
2023-06-28 11:31:28 -03:00
|
|
|
pub enum RigidTy {
|
2023-04-24 01:04:44 +00:00
|
|
|
Bool,
|
2023-07-05 19:01:11 -03:00
|
|
|
Char,
|
2023-07-05 19:06:49 -03:00
|
|
|
Int(IntTy),
|
2023-07-05 19:26:52 -03:00
|
|
|
Uint(UintTy),
|
2023-07-05 19:30:24 -03:00
|
|
|
Float(FloatTy),
|
2023-04-24 01:04:44 +00:00
|
|
|
Tuple(Vec<Ty>),
|
|
|
|
}
|
2023-07-05 19:06:49 -03:00
|
|
|
|
|
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
|
|
|
pub enum IntTy {
|
|
|
|
Isize,
|
|
|
|
I8,
|
|
|
|
I16,
|
|
|
|
I32,
|
|
|
|
I64,
|
|
|
|
I128,
|
|
|
|
}
|
2023-07-05 19:26:52 -03:00
|
|
|
|
|
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
|
|
|
pub enum UintTy {
|
|
|
|
Usize,
|
|
|
|
U8,
|
|
|
|
U16,
|
|
|
|
U32,
|
|
|
|
U64,
|
|
|
|
U128,
|
|
|
|
}
|
2023-07-05 19:30:24 -03:00
|
|
|
|
|
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
|
|
|
pub enum FloatTy {
|
|
|
|
F32,
|
|
|
|
F64,
|
|
|
|
}
|