Start work on typechecking
This commit is contained in:
parent
1daf23b129
commit
d9d6f7dc16
@ -88,8 +88,7 @@ impl<'a> Schala<'a> {
|
|||||||
self.timings.push(("symbol_table", sw.elapsed()));
|
self.timings.push(("symbol_table", sw.elapsed()));
|
||||||
|
|
||||||
// Typechecking
|
// Typechecking
|
||||||
// TODO typechecking not working
|
let _overall_type = self.type_context.typecheck(&ast).map_err(SchalaError::from_type_error);
|
||||||
//let _overall_type = self.type_context.typecheck(&ast).map_err(SchalaError::from_type_error);
|
|
||||||
|
|
||||||
let sw = Stopwatch::start_new();
|
let sw = Stopwatch::start_new();
|
||||||
let reduced_ir = reduced_ir::reduce(&ast, &self.symbol_table, &self.type_context);
|
let reduced_ir = reduced_ir::reduce(&ast, &self.symbol_table, &self.type_context);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use std::{collections::HashMap, convert::From};
|
use std::{collections::HashMap, convert::From};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
ast::TypeIdentifier,
|
ast::{TypeIdentifier, AST},
|
||||||
identifier::{define_id_kind, Id, IdStore},
|
identifier::{define_id_kind, Id, IdStore},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -96,6 +96,11 @@ impl TypeContext {
|
|||||||
pub fn lookup_type(&self, type_id: &TypeId) -> Option<&DefinedType> {
|
pub fn lookup_type(&self, type_id: &TypeId) -> Option<&DefinedType> {
|
||||||
self.defined_types.get(type_id)
|
self.defined_types.get(type_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO return some kind of overall type later?
|
||||||
|
pub fn typecheck(&mut self, ast: &AST) -> Result<(), TypeError> {
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A type defined in program source code, as opposed to a builtin.
|
/// A type defined in program source code, as opposed to a builtin.
|
||||||
|
Loading…
Reference in New Issue
Block a user