diff --git a/TODO.md b/TODO.md index f877047..f2856e1 100644 --- a/TODO.md +++ b/TODO.md @@ -105,17 +105,3 @@ if the only two guard patterns are true and false, then the abbreviated syntax: `'if' discriminator 'then' block_or_expr 'else' block_or_expr` can replace `'if' discriminator '{' 'true' 'then' block_or_expr; 'false' 'then' block_or_expr '}'` - - - - - - - - - - - - - - diff --git a/schala-lang/language/src/lib.rs b/schala-lang/language/src/lib.rs index 4757eee..77d4647 100644 --- a/schala-lang/language/src/lib.rs +++ b/schala-lang/language/src/lib.rs @@ -275,19 +275,14 @@ impl ProgrammingLanguageInterface for Schala { where F: Fn(Input, &mut Schala, Option<&mut PassDebugArtifact>) -> Result { let stage_names = stage_names(); - let mut debug_artifact = if tok.debug_requests.contains(&DebugAsk::ByStage { stage_name: stage_names[n].to_string() }) { - Some(PassDebugArtifact::default()) - } else { - None - }; + let ask = DebugAsk::ByStage { stage_name: stage_names[n].to_string() }; + let mut debug_artifact = tok.debug_requests.get(&ask).map(|_| PassDebugArtifact::default()); let output = func(input, tok.schala, debug_artifact.as_mut()); + tok.stage_durations.push((stage_names[n].to_string(), tok.sw.elapsed())); if let Some(artifact) = debug_artifact { for value in artifact.artifacts.into_iter() { - let resp = DebugResponse { - ask: DebugAsk::ByStage { stage_name: stage_names[n].to_string() }, - value, - }; + let resp = DebugResponse { ask: ask.clone(), value }; tok.debug_responses.push(resp); } }