public static Surrogate mostGeneralEquivalentSlotref(Surrogate surrogate) {
    { Slot slot = ((Slot)(surrogate.surrogateValue));

      if (slot == null) {
        return (null);
      }
      if (slot.slotDirectEquivalent != null) {
        while (slot.slotDirectEquivalent != null) {
          slot = slot.slotDirectEquivalent;
        }
        if (slot.slotSlotref == null) {
          Surrogate.lookupSlotref(slot.slotOwner, slot.slotName);
        }
      }
      return (slot.slotSlotref);
    }
  }