more codegen tweaks.
@@ -768,18 +768,18 @@ fn mark_perm_vars(rule: &'a Rule) -> (VariableFixtures, bool)
}
}
- for (i, term) in clauses.iter().enumerate() {
- if let &TermOrCut::Term(ref term) = term {
- Self::mark_vars_in_term(term.breadth_first_iter(), &mut vs, i + 1)
- }
- }
-
let mut deep_cuts = false;
- for term in clauses {
- if let &TermOrCut::Cut = term {
+ for (i, term) in clauses.iter().enumerate() {
+ match term {
+ &TermOrCut::Cut => {
deep_cuts = true;
- break;
+ },
+ &TermOrCut::Term(ref term) => {
+ Self::mark_vars_in_term(term.breadth_first_iter(),
+ &mut vs,
+ i + 1);
+ }
}
}
@@ -834,9 +834,7 @@ fn lco(body: &mut Code, rule: &'a Rule) -> usize {
dealloc_index
}
- fn mark_unsafe_query_vars(head: &Term,
- vs: &VariableFixtures,
- query: &mut CompiledQuery)
+ fn mark_unsafe_query_vars(head: &Term, vs: &VariableFixtures, query: &mut CompiledQuery)
{
let mut unsafe_vars = HashMap::new();
@@ -909,7 +907,6 @@ pub fn compile_rule(&mut self, rule: &'a Rule) -> Code
}
};
-
self.marker.advance(p0);
if p0.is_clause() {
@@ -1003,7 +1000,8 @@ fn mark_unsafe_fact_vars(fact: &mut CompiledFact, bindings: &HashMap<&Var, VarRe
}
}
- pub fn compile_fact(&mut self, term: &'a Term) -> Code {
+ pub fn compile_fact(&mut self, term: &'a Term) -> Code
+ {
self.marker.advance(term);
self.update_var_count(term.breadth_first_iter());
@@ -1038,7 +1036,8 @@ fn compile_internal_query(&mut self, term: &'a Term, index: usize) -> Code
code
}
- pub fn compile_query(&mut self, term: &'a Term) -> Code {
+ pub fn compile_query(&mut self, term: &'a Term) -> Code
+ {
self.marker.advance(term);
self.update_var_count(term.breadth_first_iter());
