| 19 | } |
| 20 | |
| 21 | fn compile_object(source: &str) -> AssembledOutput { |
| 22 | let mut pipeline = CompilationPipeline::new(); |
| 23 | pipeline.set_write_artifacts(false); |
| 24 | let result = pipeline |
| 25 | .compile(source) |
| 26 | .unwrap_or_else(|e| panic!("failed to compile sample source: {e}")); |
| 27 | let (_asm, tokens) = pipeline.compile_ir_to_assembly_with_tokens(&result.ir_program); |
| 28 | pipeline |
| 29 | .assemble(&tokens) |
| 30 | .unwrap_or_else(|e| panic!("failed to assemble sample source: {e}")) |
| 31 | } |
| 32 | |
| 33 | fn compile_sample() -> (AssembledOutput, Vec<u8>) { |
| 34 | let assembled = compile_object(sample_source()); |