Symbol table debug needs to happen before type check

This commit is contained in:
greg 2017-10-08 13:59:44 -07:00
parent bb57da564d
commit 74d3828c71
1 changed files with 6 additions and 6 deletions

View File

@ -62,8 +62,13 @@ impl ProgrammingLanguageInterface for Schala {
} }
}; };
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) { match self.type_context.type_check(&ast) {
Ok(t) => (), Ok(_) => (),
Err(msg) => { Err(msg) => {
output.add_artifact(TraceArtifact::new("type_check", msg)); output.add_artifact(TraceArtifact::new("type_check", msg));
output.add_output(format!("Type error")); output.add_output(format!("Type error"));
@ -71,11 +76,6 @@ impl ProgrammingLanguageInterface for Schala {
} }
} }
if options.debug_symbol_table {
let text = self.type_context.debug_symbol_table();
output.add_artifact(TraceArtifact::new("symbol_table", text));
}
let evaluation_output = self.state.evaluate(ast); let evaluation_output = self.state.evaluate(ast);
let mut acc = String::new(); let mut acc = String::new();
let mut iter = evaluation_output.iter().peekable(); let mut iter = evaluation_output.iter().peekable();