Exemplo n.º 1
0
int
Yap_Unifiable( Term d0, Term d1 )
{
  CACHE_REGS
  tr_fr_ptr trp, trp0 = TR;

  if (!unifiable(d0,d1)) {
    return FALSE;
  }
  trp = TR;
  while (trp != trp0) {
    Term t;

    --trp;
    t = TrailTerm(trp);
    RESET_VARIABLE(t);
  }
  return TRUE;
}
Exemplo n.º 2
0
static Int
p_unifiable( USES_REGS1 )
{
  tr_fr_ptr trp, trp0 = TR;
  Term tf = TermNil;
  if (!unifiable(ARG1,ARG2)) {
    return FALSE;
  }
  trp = TR;
  while (trp != trp0) {
    Term t[2];
    --trp;
    t[0] = TrailTerm(trp);
    t[1] = *(CELL *)t[0];
    tf = MkPairTerm(Yap_MkApplTerm(FunctorEq,2,t),tf);
    RESET_VARIABLE(t[0]);
  }
  return Yap_unify(ARG3, tf);
}
Exemplo n.º 3
0
bool HFRecordEliminator::satisfied(const TEnvPtr& tenv, const HasField& hf, Definitions*) const {
  const Record* r = is<Record>(hf.recordType);
  if (!r) return false;

  std::string fname;
  if (!isFieldName(hf.fieldName, &fname)) return false;

  if (const Record::Member* m = r->mmember(fname)) {
    MonoTypePtr lhst = normIfOpaquePtr(m->type);

    // a little hack to allow for assigning [char] into <std.string>
    if (hf.direction == HasField::Write) {
      if (*lhst == *stdstrty && *hf.fieldType == *chararrty) {
        return true;
      }
    }
    return unifiable(tenv, lhst, hf.fieldType);
  } else {
    return false;
  }
}