From 6d3f5f4b811fc9713a9aba22ad0c0006fab4a942 Mon Sep 17 00:00:00 2001 From: greg Date: Wed, 19 Jun 2019 10:41:20 -0700 Subject: [PATCH] Got things compiling again But this is a bad design for the DebugAsk --- schala-lang/language/src/lib.rs | 8 ++++---- schala-repl/src/repl/directive_actions.rs | 6 ++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/schala-lang/language/src/lib.rs b/schala-lang/language/src/lib.rs index f0e3a75..ac83280 100644 --- a/schala-lang/language/src/lib.rs +++ b/schala-lang/language/src/lib.rs @@ -94,17 +94,17 @@ impl Schala { use DebugAsk::*; match request { Timing => DebugResponse { ask: Timing, value: format!("Invalid") }, - ByStage { stage_name } => match &stage_name[..] { + ByStage { stage_name, token } => match &stage_name[..] { "symbol-table" => { let value = self.symbol_table.borrow().debug_symbol_table(); DebugResponse { - ask: ByStage { stage_name: format!("symbol-table") }, + ask: ByStage { stage_name: format!("symbol-table"), token }, value } }, s => { DebugResponse { - ask: ByStage { stage_name: s.to_string() }, + ask: ByStage { stage_name: s.to_string(), token: None }, value: format!("Not-implemented") } } @@ -277,7 +277,7 @@ impl ProgrammingLanguageInterface for Schala { where F: Fn(Input, &mut Schala, Option<&mut PassDebugArtifact>) -> Result { let stage_names = stage_names(); - let ask = DebugAsk::ByStage { stage_name: stage_names[n].to_string() }; + let ask = DebugAsk::ByStage { stage_name: stage_names[n].to_string(), token: None }; let mut debug_artifact = tok.debug_requests.get(&ask).map(|_| PassDebugArtifact { parsing: if stage_names[n] == "parsing" { Some(ParsingDebugType::CompactAST) } else { None }, diff --git a/schala-repl/src/repl/directive_actions.rs b/schala-repl/src/repl/directive_actions.rs index 5dba398..1a112c7 100644 --- a/schala-repl/src/repl/directive_actions.rs +++ b/schala-repl/src/repl/directive_actions.rs @@ -56,8 +56,10 @@ impl DirectiveAction { let meta_response = cur_state.request_meta(meta); let response = match meta_response { - LangMetaResponse::ImmediateDebug(DebugResponse { ask: DebugAsk::ByStage { stage_name: this_stage_name, .. }, value }) if this_stage_name == stage_name => - value, + LangMetaResponse::ImmediateDebug(DebugResponse { ask, value }) => match ask { + DebugAsk::ByStage { stage_name: ref this_stage_name, ref token } if *this_stage_name == stage_name => value, + _ => return Some(format!("Wrong debug stage")) + }, _ => return Some(format!("Invalid language meta response")), }; Some(response)