Function types

This commit is contained in:
2026-06-28 05:45:13 +02:00
parent 3ddb1bc601
commit 76541040c9
6 changed files with 104 additions and 2 deletions
+14
View File
@@ -17,6 +17,15 @@ pub struct Identifier(pub String);
#[derive(Debug, Clone, Serialize, Default)]
pub struct ParamList(pub Vec<VarDecl>);
#[derive(Debug, Clone, Serialize, PartialEq, Eq, Hash)]
pub enum FnKind {
Fn,
UnsafeFn,
FnClosure,
FnOnce,
FnMut,
}
#[derive(Debug, Clone, Serialize, PartialEq, Eq, Hash)]
pub enum TypeExpr {
Ref {
@@ -33,6 +42,11 @@ pub enum TypeExpr {
StaticFn(Vec<TypeExpr>, Option<Box<TypeExpr>>),
Tuple(Vec<TypeExpr>),
Lifetime(Identifier),
Fn {
kind: FnKind,
return_type: Box<TypeExpr>,
params: Vec<TypeExpr>,
},
}
#[derive(Debug, Clone, Serialize)]