From 12d83fad18dba649fa2a785ea63eb4319ad31942 Mon Sep 17 00:00:00 2001 From: Andrew Morris Date: Thu, 6 Jul 2023 20:12:06 +1000 Subject: [PATCH] Still emit assembly even if there are errors --- vstc/src/compile_command.rs | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/vstc/src/compile_command.rs b/vstc/src/compile_command.rs index 9265b5b..c4d41c3 100644 --- a/vstc/src/compile_command.rs +++ b/vstc/src/compile_command.rs @@ -20,21 +20,19 @@ pub fn compile_command(args: &Vec) { std::fs::read_to_string(path).map_err(|err| err.to_string()) }); + if let Some(module) = &compile_result.module { + let mut file = File::create("out.vsm").expect("Couldn't create out.vsm"); + + file + .write(module.to_string().as_bytes()) + .expect("Failed to write out.vsm"); + + file.write(b"\n").expect("Failed to write out.vsm"); + } + for (path, diagnostics) in compile_result.diagnostics.iter() { handle_diagnostics_cli(&path.path, diagnostics); } - - let module = compile_result - .module - .expect("Should have exited if module is None"); - - let mut file = File::create("out.vsm").expect("Couldn't create out.vsm"); - - file - .write(module.to_string().as_bytes()) - .expect("Failed to write out.vsm"); - - file.write(b"\n").expect("Failed to write out.vsm"); } fn show_help() {