Re-added symbol table infra
This commit is contained in:
parent
92e6830979
commit
fa6c2a6f45
@ -69,6 +69,12 @@ impl ProgrammingLanguageInterface for Schala {
|
||||
}
|
||||
};
|
||||
|
||||
self.type_context.add_top_level_types(&ast);
|
||||
if options.debug_symbol_table {
|
||||
let text = self.type_context.debug_symbol_table();
|
||||
output.add_artifact(TraceArtifact::new("symbol_table", text));
|
||||
}
|
||||
|
||||
match self.type_context.type_check_ast(&ast) {
|
||||
Ok(ty) => {
|
||||
output.add_artifact(TraceArtifact::new("type_check", format!("{:?}", ty)));
|
||||
|
@ -50,6 +50,19 @@ impl TypeContext {
|
||||
pub fn new() -> TypeContext {
|
||||
TypeContext { bindings: HashMap::new() }
|
||||
}
|
||||
}
|
||||
|
||||
impl TypeContext {
|
||||
pub fn add_top_level_types(&mut self, ast: &parsing::AST) {
|
||||
|
||||
|
||||
}
|
||||
pub fn debug_symbol_table(&self) -> String {
|
||||
format!("Symbols: {:?}", self.bindings)
|
||||
}
|
||||
}
|
||||
|
||||
impl TypeContext {
|
||||
pub fn type_check_ast(&mut self, ast: &parsing::AST) -> TypeResult<Type> {
|
||||
use self::Type::*; use self::TConst::*;
|
||||
let mut ret_type = Const(Unit);
|
||||
|
Loading…
Reference in New Issue
Block a user