dada_lang/main_lib/
run.rs1use std::path::Path;
2
3use dada_compiler::{Compiler, RealFs};
4use dada_util::Fallible;
5
6use crate::RunOptions;
7
8use super::Main;
9
10impl Main {
11 pub(super) fn run_command(&mut self, run_options: &RunOptions) -> Fallible<()> {
12 let mut compiler = Compiler::new(RealFs::default(), None);
13 let source_url = Path::new(&run_options.compile_options.input);
14 let source_file = compiler.load_source_file(source_url)?;
15 let bytes = compiler.codegen_main_fn(source_file);
16 let diagnostics = compiler.check_all(source_file);
17
18 for diagnostic in &diagnostics {
19 eprintln!(
20 "{}",
21 diagnostic.render(&compiler, &self.global_options.render_opts())
22 );
23 }
24
25 let _ = bytes;
26
27 Ok(())
28 }
29}