drop_expansions whenever a compilation error occurs

This commit is contained in:
Mark Thom
2019-01-16 19:05:07 -07:00
parent 2f75270da9
commit 090f04c7e1

View File

@@ -437,12 +437,11 @@ impl ListingCompiler {
}
}
pub
fn compile_listing<R: Read>(wam: &mut Machine, src: R, mut indices: IndexStore) -> EvalSession
fn compile_work<R: Read>(compiler: &mut ListingCompiler, wam: &mut Machine, src: R,
mut indices: IndexStore)
-> EvalSession
{
let mut compiler = ListingCompiler::new(&wam.code_repo);
let mut results = try_eval_session!(compiler.gather_items(wam, src, &mut indices)
.map_err(|e| compiler.drop_expansions(wam, e)));
let mut results = try_eval_session!(compiler.gather_items(wam, src, &mut indices));
let module_code = try_eval_session!(compiler.generate_code(results.worker_results, wam,
&mut indices.code_dir));
@@ -465,6 +464,17 @@ fn compile_listing<R: Read>(wam: &mut Machine, src: R, mut indices: IndexStore)
EvalSession::EntrySuccess
}
#[inline]
pub fn compile_listing<R: Read>(wam: &mut Machine, src: R, indices: IndexStore) -> EvalSession
{
let mut compiler = ListingCompiler::new(&wam.code_repo);
match compile_work(&mut compiler, wam, src, indices) {
EvalSession::Error(e) => EvalSession::Error(compiler.drop_expansions(wam, e)),
result => result
}
}
fn setup_indices(wam: &mut Machine, indices: &mut IndexStore) -> Result<(), SessionError> {
if let Some(builtins) = wam.indices.take_module(clause_name!("builtins")) {
let flags = wam.machine_flags();