add read support for user:term_expansion and user:goal_expansion

This commit is contained in:
Mark Thom
2019-01-05 19:22:38 -07:00
parent 36fdc8e822
commit 042779cff9
7 changed files with 70 additions and 23 deletions

View File

@@ -665,9 +665,9 @@ pub(crate) trait CallPolicy: Any {
machine_st.b0 = machine_st.b;
machine_st.p = match hook {
CompileTimeHook::TermExpansion =>
CompileTimeHook::UserTermExpansion | CompileTimeHook::TermExpansion =>
CodePtr::Local(LocalCodePtr::UserTermExpansion(0)),
CompileTimeHook::GoalExpansion =>
CompileTimeHook::UserGoalExpansion | CompileTimeHook::GoalExpansion =>
CodePtr::Local(LocalCodePtr::UserGoalExpansion(0))
};

View File

@@ -131,14 +131,15 @@ impl<'a, R: Read> TermStream<'a, R> {
#[inline]
pub fn incr_expansion_lens(&mut self, hook: CompileTimeHook, len: usize, queue_len: usize) {
match hook {
CompileTimeHook::TermExpansion => {
CompileTimeHook::UserTermExpansion => {
self.term_expansion_lens.0 += len;
self.term_expansion_lens.1 += queue_len;
},
CompileTimeHook::GoalExpansion => {
CompileTimeHook::UserGoalExpansion => {
self.goal_expansion_lens.0 += len;
self.goal_expansion_lens.1 += queue_len;
}
},
_ => {}
}
}