Correctly report source compilation diagnostics
This commit is contained in:
parent
44ddda9736
commit
6f8c99ed4c
|
@ -23,17 +23,17 @@ impl Runtime {
|
||||||
let mut diagnostics = Diagnostics::new();
|
let mut diagnostics = Diagnostics::new();
|
||||||
|
|
||||||
let (mut sources, source_paths) = Self::get_sources(source_dir)?;
|
let (mut sources, source_paths) = Self::get_sources(source_dir)?;
|
||||||
let unit = rune::prepare(&mut sources)
|
let result = rune::prepare(&mut sources)
|
||||||
.with_context(&context)
|
.with_context(&context)
|
||||||
.with_diagnostics(&mut diagnostics)
|
.with_diagnostics(&mut diagnostics)
|
||||||
.build()?;
|
.build();
|
||||||
|
|
||||||
if !diagnostics.is_empty() {
|
if !diagnostics.is_empty() {
|
||||||
let mut writer = StandardStream::stderr(ColorChoice::Always);
|
let mut writer = StandardStream::stderr(ColorChoice::Always);
|
||||||
diagnostics.emit(&mut writer, &sources)?;
|
diagnostics.emit(&mut writer, &sources)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
let vm = Vm::new(runtime, Arc::new(unit));
|
let vm = Vm::new(runtime, Arc::new(result?));
|
||||||
|
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
vm,
|
vm,
|
||||||
|
|
Loading…
Reference in New Issue