(args: &Args)
| 272 | fs::write(output_path, &elf_bytes)?; |
| 273 | eprintln!("fsc: wrote linked ELF to `{output_path}`"); |
| 274 | |
| 275 | Ok(ExitCode::SUCCESS) |
| 276 | } |
| 277 | |
| 278 | // --- hll-to-ir --- |
| 279 | |
| 280 | fn cmd_hll_to_ir(args: &Args) -> Result<ExitCode, CliError> { |
| 281 | let input = require_single_input(args)?; |
| 282 | let src = fs::read_to_string(input)?; |
| 283 | |
| 284 | let mut pipeline = make_pipeline(args.mode, "_u_"); |
| 285 | pipeline.set_run_semantic_analysis(false); |
| 286 | pipeline.set_artifact_stem(Some(source_stem(input, "module"))); |
| 287 | pipeline.set_current_source_path(Some(input.to_owned())); |
| 288 | |
| 289 | let result = pipeline |
| 290 | .compile(&src) |
| 291 | .map_err(|e| CliError::Compile(e.to_string()))?; |
| 292 | |
| 293 | let ir_text = result.ir_program.to_string(); |
| 294 | |
| 295 | write_or_print(args.output.as_deref(), &ir_text)?; |
| 296 | |
| 297 | for diag in &result.diagnostics { |
| 298 | eprintln!("{}", diag.render(input)); |
| 299 | } |
no test coverage detected