From af4d965b8ce209a54780c97456527dd8d617da6c Mon Sep 17 00:00:00 2001 From: Jakub Doka Date: Sat, 26 Oct 2024 09:53:14 +0200 Subject: [PATCH] fixed fmt error reporting --- lang/src/fs.rs | 10 +++++----- lang/src/son.rs | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lang/src/fs.rs b/lang/src/fs.rs index 0c8a7f2..0b6354e 100644 --- a/lang/src/fs.rs +++ b/lang/src/fs.rs @@ -81,6 +81,11 @@ pub fn run_compiler(root_file: &str, options: Options, out: &mut Vec) -> std Ok(()) } + if !options.optimize && !parsed.errors.is_empty() { + log::error!("{}", parsed.errors); + return Err(std::io::Error::other("parsing failed")); + } + if options.fmt { for parsed in parsed.ast { format_ast(parsed)?; @@ -109,11 +114,6 @@ pub fn run_compiler(root_file: &str, options: Options, out: &mut Vec) -> std codegen.assemble(out); } } else { - if !parsed.errors.is_empty() { - log::error!("{}", parsed.errors); - return Err(std::io::Error::other("parsing failed")); - } - let mut codegen = codegen::Codegen::default(); codegen.files = parsed.ast; codegen.push_embeds(parsed.embeds); diff --git a/lang/src/son.rs b/lang/src/son.rs index e34b951..2299482 100644 --- a/lang/src/son.rs +++ b/lang/src/son.rs @@ -141,7 +141,7 @@ impl Nodes { log::info!("{out}"); } - fn graphviz_in_browser(&self, tys: &Types, files: &[parser::Ast]) { + fn graphviz_in_browser(&self, _tys: &Types, _files: &[parser::Ast]) { #[cfg(all(debug_assertions, feature = "std"))] { // let out = &mut String::new();