summaryrefslogtreecommitdiff
path: root/src/semantic/analysis.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/semantic/analysis.rs')
-rw-r--r--src/semantic/analysis.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/semantic/analysis.rs b/src/semantic/analysis.rs
index 973e703..152ede9 100644
--- a/src/semantic/analysis.rs
+++ b/src/semantic/analysis.rs
@@ -75,7 +75,7 @@ fn trans_decl<'a, 'b, F: frame::Frame>(
level: &mut Level<'b, F>,
venv: &mut TypeEnvironment<'a>,
tenv: &mut TypeEnvironment<'a>,
- decl: &WithLocation<ast::Declaration>) -> Result<Ty> {
+ decl: &WithLocation<ast::Declaration>) -> Result<(translate::Expression, Ty)> {
match decl.declaration {
ast::DeclarationBody::Fun { ref ty, ref params, ref body } => {
let declared_ty = if let &Some(ref ty) = ty {
@@ -103,10 +103,12 @@ fn trans_decl<'a, 'b, F: frame::Frame>(
}
}
- Ok(Ty::Function(arg_types, Box::new(body_ty)))
+ return err!(decl, TypeError::Unimplemented);
+ // Ok(Ty::Function(arg_types, Box::new(body_ty)))
}
ast::DeclarationBody::Ty { ref ty } => {
- trans_ty(venv, tenv, ty)
+ return err!(decl, TypeError::Unimplemented);
+ // trans_ty(venv, tenv, ty)
}
ast::DeclarationBody::Var { ref ty, ref value } => {
let (var_exp, actual_ty) =
@@ -120,7 +122,7 @@ fn trans_decl<'a, 'b, F: frame::Frame>(
});
}
}
- Ok(actual_ty)
+ Ok((tr.alloc_local(level, frame::Escape::Yes), actual_ty))
}
}
}
@@ -139,7 +141,7 @@ fn trans_exp<'a, 'b, F: frame::Frame>(
let mut new_venv = TypeEnvironment::new(Some(venv));
let mut new_tenv = TypeEnvironment::new(Some(tenv));
for decl in decls.iter() {
- let decl_ty = trans_decl(tr, level, &mut new_venv, &mut new_tenv, decl)?;
+ let (decl_exp, decl_ty) = trans_decl(tr, level, &mut new_venv, &mut new_tenv, decl)?;
match decl.declaration {
ast::DeclarationBody::Fun { .. } | ast::DeclarationBody::Var { .. } => {
new_venv.add_binding(decl.name.clone(), decl_ty);