forked from AbleOS/holey-bytes
fixed fmt error reporting
This commit is contained in:
parent
855da58e06
commit
af4d965b8c
|
@ -81,6 +81,11 @@ pub fn run_compiler(root_file: &str, options: Options, out: &mut Vec<u8>) -> std
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !options.optimize && !parsed.errors.is_empty() {
|
||||||
|
log::error!("{}", parsed.errors);
|
||||||
|
return Err(std::io::Error::other("parsing failed"));
|
||||||
|
}
|
||||||
|
|
||||||
if options.fmt {
|
if options.fmt {
|
||||||
for parsed in parsed.ast {
|
for parsed in parsed.ast {
|
||||||
format_ast(parsed)?;
|
format_ast(parsed)?;
|
||||||
|
@ -109,11 +114,6 @@ pub fn run_compiler(root_file: &str, options: Options, out: &mut Vec<u8>) -> std
|
||||||
codegen.assemble(out);
|
codegen.assemble(out);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if !parsed.errors.is_empty() {
|
|
||||||
log::error!("{}", parsed.errors);
|
|
||||||
return Err(std::io::Error::other("parsing failed"));
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut codegen = codegen::Codegen::default();
|
let mut codegen = codegen::Codegen::default();
|
||||||
codegen.files = parsed.ast;
|
codegen.files = parsed.ast;
|
||||||
codegen.push_embeds(parsed.embeds);
|
codegen.push_embeds(parsed.embeds);
|
||||||
|
|
|
@ -141,7 +141,7 @@ impl Nodes {
|
||||||
log::info!("{out}");
|
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"))]
|
#[cfg(all(debug_assertions, feature = "std"))]
|
||||||
{
|
{
|
||||||
// let out = &mut String::new();
|
// let out = &mut String::new();
|
||||||
|
|
Loading…
Reference in a new issue