fix recursive calls to call/N

This commit is contained in:
Mark Thom
2017-07-28 17:02:08 -06:00
parent 8a99b6d3bc
commit 3aa8780086
10 changed files with 955 additions and 2753 deletions

View File

@@ -70,7 +70,7 @@ impl<'a> QueryIterator<'a> {
fn new(term: QueryTermRef<'a>) -> Self {
match term {
QueryTermRef::CallN(child_terms) => {
let state = IteratorState::Clause(0, ClauseType::CallN, child_terms);
let state = IteratorState::Clause(1, ClauseType::CallN, child_terms);
QueryIterator { state_stack: vec![state] }
},
QueryTermRef::Term(term) => Self::from_term(term),
@@ -96,7 +96,9 @@ impl<'a> Iterator for QueryIterator<'a> {
IteratorState::Clause(child_num, ct, child_terms) => {
if child_num == child_terms.len() {
match ct {
ClauseType::CallN | ClauseType::Root =>
ClauseType::CallN =>
self.push_subterm(Level::Shallow, child_terms[0].as_ref()),
ClauseType::Root =>
return None,
ClauseType::Deep(_, _, _) =>
return Some(TermRef::Clause(ct, child_terms))