diff --git a/reid/src/lib.rs b/reid/src/lib.rs index 372bf93..1e0c2e3 100644 --- a/reid/src/lib.rs +++ b/reid/src/lib.rs @@ -103,13 +103,18 @@ pub fn compile_module( } pub fn perform_all_passes(context: &mut mir::Context) -> Result<(), ReidError> { + #[cfg(debug_assertions)] + dbg!(&context); + #[cfg(debug_assertions)] println!("{}", &context); let state = context.pass(&mut LinkerPass); #[cfg(debug_assertions)] - println!("{:?}\n{}", &context, &context); + println!("{}", &context); + #[cfg(debug_assertions)] + dbg!(&state); if !state.errors.is_empty() { return Err(ReidError::LinkerErrors(state.errors)); @@ -119,10 +124,10 @@ pub fn perform_all_passes(context: &mut mir::Context) -> Result<(), ReidError> { let state = context.pass(&mut TypeInference { refs: &refs }); - #[cfg(debug_assertions)] - dbg!(&state, &refs); #[cfg(debug_assertions)] println!("{}", &context); + #[cfg(debug_assertions)] + dbg!(&state, &refs); if !state.errors.is_empty() { return Err(ReidError::TypeInferenceErrors(state.errors)); @@ -130,10 +135,10 @@ pub fn perform_all_passes(context: &mut mir::Context) -> Result<(), ReidError> { let state = context.pass(&mut TypeCheck { refs: &refs }); - #[cfg(debug_assertions)] - dbg!(&state); #[cfg(debug_assertions)] println!("{}", &context); + #[cfg(debug_assertions)] + dbg!(&state); if !state.errors.is_empty() { return Err(ReidError::TypeCheckErrors(state.errors)); diff --git a/reid/src/mir/display.rs b/reid/src/mir/display.rs index b6a6c78..21e3645 100644 --- a/reid/src/mir/display.rs +++ b/reid/src/mir/display.rs @@ -61,8 +61,8 @@ impl Display for FunctionDefinitionKind { write!(f, "{}", block)?; Ok(()) } - Self::Extern(true) => write!(f, ""), - Self::Extern(false) => write!(f, ""), + Self::Extern(true) => write!(f, ""), + Self::Extern(false) => write!(f, ""), } } } diff --git a/reid/src/mir/pass.rs b/reid/src/mir/pass.rs index 777f783..b0a1cf1 100644 --- a/reid/src/mir/pass.rs +++ b/reid/src/mir/pass.rs @@ -210,7 +210,7 @@ impl Context { let mut scope = Scope::default(); pass.context(self, PassState::from(&mut state, &mut scope)); for module in &mut self.modules { - module.pass(pass, &mut state, &mut scope); + module.pass(pass, &mut state, &mut scope.inner()); } state }