Checkpoint: pushed through type checking, at least.

This commit is contained in:
2023-10-07 14:36:17 +02:00
parent ca26d0ea40
commit 87d027bf8d
4 changed files with 132 additions and 29 deletions

View File

@@ -77,7 +77,7 @@ impl Arbitrary for Program {
#[derive(Debug)]
pub enum TopLevel {
Statement(Statement),
Function(Variable, Vec<Variable>, Expression),
Function(Variable, Vec<Variable>, Vec<Statement>, Expression),
}
impl<'a, 'b, D, A> Pretty<'a, D, A> for &'b TopLevel
@@ -87,7 +87,7 @@ where
{
fn pretty(self, allocator: &'a D) -> pretty::DocBuilder<'a, D, A> {
match self {
TopLevel::Function(name, args, body) => allocator
TopLevel::Function(name, args, stmts, body) => allocator
.text("function")
.append(allocator.space())
.append(allocator.text(name.as_ref().to_string()))
@@ -378,6 +378,7 @@ where
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum Type {
Primitive(PrimitiveType),
Function(Vec<Type>, Box<Type>),
}
impl<'a, 'b, D, A> Pretty<'a, D, A> for &'b Type