Fix bug with debug specifications

This commit is contained in:
greg 2019-08-05 03:31:10 -07:00
parent d832583ed9
commit 16bf166fa9

View File

@ -238,22 +238,23 @@ impl ProgrammingLanguageInterface for Schala {
let stage_names = stage_names();
let cur_stage_name = stage_names[n];
let ask = token.debug_requests.iter().find(|ask| ask.is_for_stage(cur_stage_name));
let mut debug_artifact = ask.and_then(|ask| match ask {
DebugAsk::ByStage { token, .. } => token.as_ref(),
_ => None
}).map(|token| {
let parsing = if cur_stage_name != "parsing" {
None
} else {
Some(match &token[..] {
let parsing = match ask {
Some(DebugAsk::ByStage { token, .. }) if cur_stage_name == "parsing" => Some(
token.as_ref().map(|token| match &token[..] {
"compact" => ParsingDebugType::CompactAST,
"expanded" => ParsingDebugType::ExpandedAST,
"trace" => ParsingDebugType::Trace,
_ => ParsingDebugType::CompactAST,
})
};
PassDebugArtifact { parsing, ..Default::default() }
}).unwrap_or(ParsingDebugType::CompactAST)
),
_ => None,
};
let mut debug_artifact = ask.map(|_| PassDebugArtifact {
parsing, ..Default::default()
});
let output = func(input, token.schala, debug_artifact.as_mut());
token.stage_durations.push((cur_stage_name.to_string(), token.sw.elapsed()));