Removed another nested function that didn't yield a trampoline warning.

This commit is contained in:
Cas Cremers 2019-01-04 14:41:29 +01:00
parent 65655a96c7
commit d25445538e

View File

@ -1008,34 +1008,10 @@ struct betg_state
int newdecr; int newdecr;
}; };
int void
unifiesWithKeys (Termlist substlist, Termlist keylist, wrapSubst (const Termlist sl, const struct betg_state *ptr_betgState,
struct betg_state *ptr_betgState) const Termlist keylist)
{ {
int old_length;
int newgoals;
assert (ptr_betgState != NULL);
// TODO this is a hack: in this case we really should not use subterm
// unification but interm instead. However, this effectively does the same
// by avoiding branches that get immediately pruned anyway.
if (!ptr_betgState->newdecr && keylist != NULL)
{
return true;
}
// We need some adapting because the height would increase; we therefore
// have to add recv goals before we know whether it unifies.
old_length = sys->runs[ptr_betgState->run].height;
newgoals =
add_recv_goals (ptr_betgState->run, old_length, ptr_betgState->index + 1);
{
// wrap substitution lists
void wrapSubst (Termlist sl)
{
if (sl == NULL) if (sl == NULL)
{ {
if (switches.output == PROOF) if (switches.output == PROOF)
@ -1067,11 +1043,11 @@ unifiesWithKeys (Termlist substlist, Termlist keylist,
State.sl = sl; State.sl = sl;
State.tvar = sl->term; State.tvar = sl->term;
State.allgood = true; State.allgood = true;
iterateTermOther (ptr_betgState->run, State.tvar, makeDepend, iterateTermOther (ptr_betgState->run, State.tvar, makeDepend, &State);
&State);
if (State.allgood) if (State.allgood)
{ {
wrapSubst (sl->next); // Recursive call
wrapSubst (sl->next, ptr_betgState, keylist);
} }
while (State.neworders > 0) while (State.neworders > 0)
{ {
@ -1079,10 +1055,33 @@ unifiesWithKeys (Termlist substlist, Termlist keylist,
dependPopEvent (); dependPopEvent ();
} }
} }
}
int
unifiesWithKeys (Termlist substlist, Termlist keylist,
struct betg_state *ptr_betgState)
{
int old_length;
int newgoals;
assert (ptr_betgState != NULL);
// TODO this is a hack: in this case we really should not use subterm
// unification but interm instead. However, this effectively does the same
// by avoiding branches that get immediately pruned anyway.
if (!ptr_betgState->newdecr && keylist != NULL)
{
return true;
} }
wrapSubst (substlist); // We need some adapting because the height would increase; we therefore
} // have to add recv goals before we know whether it unifies.
old_length = sys->runs[ptr_betgState->run].height;
newgoals =
add_recv_goals (ptr_betgState->run, old_length, ptr_betgState->index + 1);
// wrap substitution lists
wrapSubst (substlist, ptr_betgState, keylist);
// undo // undo
goal_remove_last (newgoals); goal_remove_last (newgoals);