diff options
Diffstat (limited to 'builtins.c')
-rw-r--r-- | builtins.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -229,6 +229,21 @@ canbecalled(Term *t) return 1; } +void +updateclausenr(Term *t, uvlong nr) +{ + /* Change the clause number on the term and its subterms, unless it is a variable */ + if(t->tag == VariableTerm) + return; + + t->clausenr = nr; + if(t->tag == CompoundTerm){ + Term *child; + for(child = t->children; child != nil; child = child->next) + updateclausenr(child, nr); + } +} + int builtincall(Term *goal, Binding **bindings, Module *module) { @@ -238,6 +253,9 @@ builtincall(Term *goal, Binding **bindings, Module *module) if(!canbecalled(callgoal)) Throw(typeerror(L"callable", callgoal)); + updateclausenr(callgoal, clausenr); + clausenr++; + goalstack = addgoals(goalstack, callgoal, module); return 1; } |