(
&self,
source: &str,
stdlib_objects: &[(&str, &AssembledOutput)],
)
| 769 | ); |
| 770 | return Ok(CompilationResult { |
| 771 | tokens_display: out.tokens_display, |
| 772 | ast_display: out.ast_display, |
| 773 | ir_program: out.ir, |
| 774 | diagnostics: warnings, |
| 775 | }); |
| 776 | } |
| 777 | } |
| 778 | |
| 779 | let stem = self |
| 780 | .artifact_stem |
| 781 | .borrow() |
| 782 | .clone() |
| 783 | .unwrap_or_else(|| self.default_artifact_stem(Location::caller(), "ir", source)); |
| 784 | *self.last_artifact_stem.borrow_mut() = Some(sanitize_artifact_component(&stem)); |
| 785 | self.write_text_artifact("ir", &stem, ".ir", &out.ir.to_string()); |
| 786 | |
| 787 | log::info!("Compilation complete"); |
| 788 | Ok(CompilationResult { |
| 789 | tokens_display: out.tokens_display, |
| 790 | ast_display: out.ast_display, |
| 791 | ir_program: out.ir, |
| 792 | diagnostics: out.diagnostics, |
| 793 | }) |
| 794 | } |
| 795 | |
| 796 | /// Run all pipeline stages, returning typed per-stage outputs. `stdlib_objects` |
| 797 | /// is empty when compiling stdlib or kernel sources standalone. |
| 798 | #[track_caller] |
| 799 | pub fn run_full( |
| 800 | &self, |
| 801 | source: &str, |
| 802 | stdlib_objects: &[(&str, &AssembledOutput)], |
| 803 | ) -> PipelineResult { |
| 804 | let resolved = match self.resolve_modules(source) { |
| 805 | Ok(resolved) => resolved, |
| 806 | Err(diagnostics) => { |
| 807 | return PipelineResult { |
| 808 | diagnostics, |
| 809 | lex: None, |
| 810 | parse: None, |
| 811 | ir: None, |
| 812 | asm: None, |
| 813 | binary: None, |
| 814 | assembler_error: None, |
| 815 | exec: None, |
| 816 | }; |
| 817 | } |
| 818 | }; |
| 819 | let compiler = HllCompiler::new(CompileConfig { |
| 820 | target: self.target_mode, |
| 821 | strict: self.run_semantic_analysis, |
| 822 | string_prefix: self.string_prefix.clone(), |
| 823 | type_prelude: self.type_prelude.clone(), |
| 824 | source_prelude: resolved.prelude, |
| 825 | module_aliases: resolved.aliases, |
| 826 | module_mangle_prefix: self |
| 827 | .mangle_modules |
| 828 | .then(|| self.current_module_prefix.clone()) |
no test coverage detected