diff --git a/schala-lang/src/lib.rs b/schala-lang/src/lib.rs index c478b05..dc53b22 100644 --- a/schala-lang/src/lib.rs +++ b/schala-lang/src/lib.rs @@ -79,6 +79,7 @@ fn parsing(_handle: &mut Schala, input: Vec, comp: Option<&mu let (ast, trace) = parsing::parse(input); comp.map(|comp| { + println!("DEBUG OPTS: {:?}", comp.cur_debug_options); //TODO need to control which of these debug stages get added comp.add_artifact(TraceArtifact::new_parse_trace(trace)); comp.add_artifact(TraceArtifact::new("ast", format!("{:#?}", ast))); diff --git a/schala-repl/src/language.rs b/schala-repl/src/language.rs index 4d18131..90979de 100644 --- a/schala-repl/src/language.rs +++ b/schala-repl/src/language.rs @@ -29,6 +29,7 @@ impl Default for ExecutionMethod { #[derive(Debug, Default)] pub struct UnfinishedComputation { artifacts: Vec<(String, TraceArtifact)>, + pub cur_debug_options: Vec, } #[derive(Debug)] @@ -161,11 +162,13 @@ macro_rules! pass_chain_helper { let pass_name = stringify!($pass); let output = { let ref debug_map = $options.debug_passes; - //let (debug_handle: Option<&mut UnfinishedComputation>, debug_opts) = if debug_set.contains_key(pass_name) { - //let (debug_handle: Option<&mut UnfinishedComputation>, debug_opts: Vec) = match debug_map.get(pass_name) { - let (debug_handle, debug_opts) = match debug_map.get(pass_name) { - Some(PassDebugDescriptor { opts }) => (Some(&mut $comp), Some(opts.clone())), - _ => (None, None) + let debug_handle = match debug_map.get(pass_name) { + Some(PassDebugDescriptor { opts }) => { //(Some(&mut $comp), Some(opts.clone())), + let ptr = &mut $comp; + ptr.cur_debug_options = opts.clone(); + Some(ptr) + } + _ => None }; $pass($state, $input, debug_handle) };