private bool ResolveConflicts(PrologCodeTerm term, int index)
{
PrologVariableDictionaryEntry entry = _dictionary.GetVariable(index);
if (_dictionary.CurrentGoalIndex != 1 || entry == null || entry.LastGoalArgument < index)
{
PrologRegisterTable.Instance.AllocateRegister(index);
return false;
}
if (term is PrologCodePredicate)
{
PrologCodePredicate predicate = (PrologCodePredicate)term;
for (int i = index + 1; i < entry.LastGoalArgument; i++)
{
if (predicate.Name == entry.Name &&
(_dictionary.GetVariable(i) == null || ResolveConflicts(term, i)))
{
entry.TemporaryIndex = i;
_generator.Emit(OpCodes.Put_Value, X(index), X(i));
return true;
}
}
// I WAS HERE
}
//return true; THIS WAS THERE
entry.TemporaryIndex = PrologRegisterTable.Instance.FindRegister();
_generator.Emit(OpCodes.Put_Value, X(index), X(entry.TemporaryIndex));
return true;
}