add module-level goal_expansion and term_expansion

This commit is contained in:
Mark Thom
2019-01-05 22:02:06 -07:00
parent 042779cff9
commit da731ad1f9
4 changed files with 105 additions and 42 deletions

View File

@@ -132,12 +132,10 @@ impl CodeRepo {
pub fn truncate_terms(&mut self, key: PredicateKey, len: usize, queue_len: usize)
-> (Predicate, VecDeque<TopLevel>)
{
//TODO: fix this! this is causing a test to fail. because term_expansions, when
//removed by rollback_expansion_code, aren't jump-labeled properly by generate_code.
self.term_dir.get_mut(&key)
.map(|entry| (Predicate((entry.0).0.clone()[len ..].to_vec()), //drain(len ..).collect()),
.map(|entry| (Predicate((entry.0).0.drain(len ..).collect()),
entry.1.drain(queue_len ..).collect()))
.unwrap_or((Predicate(vec![]), VecDeque::from(vec![])))
.unwrap_or((Predicate::new(), VecDeque::from(vec![])))
}
pub fn add_in_situ_result(&mut self, result: &CompiledResult, in_situ_code_dir: &mut InSituCodeDir,