feat: Add support for function declarations.
This commit is contained in:
18
src/ast.rs
18
src/ast.rs
@@ -103,3 +103,21 @@ pub enum Type {
|
||||
|
||||
Named { name: Box<str>, name_span: Span },
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
pub enum Declaration {
|
||||
Function {
|
||||
name: Box<str>,
|
||||
name_span: Span,
|
||||
parameters: Vec<Parameter>,
|
||||
return_type: Option<Type>,
|
||||
body: Option<Statement>,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
pub struct Parameter {
|
||||
pub name: Box<str>,
|
||||
pub name_span: Span,
|
||||
pub type_: Type,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user