Got things compiling again

But this is a bad design for the DebugAsk
This commit is contained in:
greg 2019-06-19 10:41:20 -07:00
parent e3bd108e6c
commit 6d3f5f4b81
2 changed files with 8 additions and 6 deletions

View File

@ -94,17 +94,17 @@ impl Schala {
use DebugAsk::*; use DebugAsk::*;
match request { match request {
Timing => DebugResponse { ask: Timing, value: format!("Invalid") }, Timing => DebugResponse { ask: Timing, value: format!("Invalid") },
ByStage { stage_name } => match &stage_name[..] { ByStage { stage_name, token } => match &stage_name[..] {
"symbol-table" => { "symbol-table" => {
let value = self.symbol_table.borrow().debug_symbol_table(); let value = self.symbol_table.borrow().debug_symbol_table();
DebugResponse { DebugResponse {
ask: ByStage { stage_name: format!("symbol-table") }, ask: ByStage { stage_name: format!("symbol-table"), token },
value value
} }
}, },
s => { s => {
DebugResponse { DebugResponse {
ask: ByStage { stage_name: s.to_string() }, ask: ByStage { stage_name: s.to_string(), token: None },
value: format!("Not-implemented") value: format!("Not-implemented")
} }
} }
@ -277,7 +277,7 @@ impl ProgrammingLanguageInterface for Schala {
where F: Fn(Input, &mut Schala, Option<&mut PassDebugArtifact>) -> Result<Output, String> where F: Fn(Input, &mut Schala, Option<&mut PassDebugArtifact>) -> Result<Output, String>
{ {
let stage_names = stage_names(); 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(|_| let mut debug_artifact = tok.debug_requests.get(&ask).map(|_|
PassDebugArtifact { PassDebugArtifact {
parsing: if stage_names[n] == "parsing" { Some(ParsingDebugType::CompactAST) } else { None }, parsing: if stage_names[n] == "parsing" { Some(ParsingDebugType::CompactAST) } else { None },

View File

@ -56,8 +56,10 @@ impl DirectiveAction {
let meta_response = cur_state.request_meta(meta); let meta_response = cur_state.request_meta(meta);
let response = match meta_response { let response = match meta_response {
LangMetaResponse::ImmediateDebug(DebugResponse { ask: DebugAsk::ByStage { stage_name: this_stage_name, .. }, value }) if this_stage_name == stage_name => LangMetaResponse::ImmediateDebug(DebugResponse { ask, value }) => match ask {
value, 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")), _ => return Some(format!("Invalid language meta response")),
}; };
Some(response) Some(response)