From 38a90cf1fa80b4560fcda7f1b72796d80df5a637 Mon Sep 17 00:00:00 2001 From: Alex Bethel Date: Fri, 5 Aug 2022 11:49:06 -0500 Subject: [PATCH] Separate out backends in main --- axc/src/main.rs | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/axc/src/main.rs b/axc/src/main.rs index e2f9167..0d3a75b 100644 --- a/axc/src/main.rs +++ b/axc/src/main.rs @@ -258,10 +258,26 @@ fn main() { typeck(&ast)?; let ir = ast2ir(ast); - let c = backends::c::generate_c(&ir); - let mut out_file = File::create("out.c")?; - write!(out_file, "{}", c)?; + match args.target { + Target::CSource => { + let c = backends::c::generate_c(&ir); + + let mut out_file = File::create("out.c")?; + write!(out_file, "{}", c)?; + } + Target::Assembly => todo!(), + Target::ObjectFile => todo!(), + Target::Executable => todo!(), + Target::SharedObject => todo!(), + Target::Spirv => todo!(), + Target::Wat => todo!(), + Target::Wasm => todo!(), + Target::Lua => todo!(), + Target::Python => todo!(), + Target::Go => todo!(), + Target::Ada => todo!(), + } Ok(()) }