From 74d3828c71524d6c9ac3fc9c38090a4ae45ceffb Mon Sep 17 00:00:00 2001 From: greg Date: Sun, 8 Oct 2017 13:59:44 -0700 Subject: [PATCH] Symbol table debug needs to happen before type check --- src/schala_lang/mod.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/schala_lang/mod.rs b/src/schala_lang/mod.rs index 875088c..9dc0d11 100644 --- a/src/schala_lang/mod.rs +++ b/src/schala_lang/mod.rs @@ -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) { - Ok(t) => (), + Ok(_) => (), Err(msg) => { output.add_artifact(TraceArtifact::new("type_check", msg)); 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 mut acc = String::new(); let mut iter = evaluation_output.iter().peekable();