chore(util/object_ref): disable automatic coercion from object_ref to object *
This commit is contained in:
parent
e7ac7cb542
commit
ef8bbccf9f
3 changed files with 4 additions and 5 deletions
|
|
@ -204,7 +204,7 @@ bool operator==(name const & a, char const * b) {
|
|||
strcmp(a.get_string(), b) == 0;
|
||||
}
|
||||
|
||||
int name::cmp(object * i1, object * i2) {
|
||||
int name::cmp_core(object * i1, object * i2) {
|
||||
buffer<object*> limbs1, limbs2;
|
||||
copy_limbs(i1, limbs1);
|
||||
copy_limbs(i2, limbs2);
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ public:
|
|||
static unsigned get_numeral(object * o) { return unbox(cnstr_obj(o, 1)); }
|
||||
static unsigned hash(object * o) { return cnstr_scalar<unsigned>(o, 2*sizeof(object*)); } // NOLINT
|
||||
static bool eq_core(object * o1, object * o2);
|
||||
static int cmp(object * o1, object * o2);
|
||||
static int cmp_core(object * o1, object * o2);
|
||||
size_t size_core(bool unicode) const;
|
||||
private:
|
||||
friend name read_name(deserializer & d);
|
||||
|
|
@ -106,7 +106,7 @@ public:
|
|||
friend bool operator==(name const & a, char const * b);
|
||||
friend bool operator!=(name const & a, char const * b) { return !(a == b); }
|
||||
/** \brief Total order on hierarchical names. */
|
||||
friend int cmp(name const & a, name const & b) { return cmp(a.raw(), b.raw()); }
|
||||
friend int cmp(name const & a, name const & b) { return cmp_core(a.raw(), b.raw()); }
|
||||
friend bool operator<(name const & a, name const & b) { return cmp(a, b) < 0; }
|
||||
friend bool operator>(name const & a, name const & b) { return cmp(a, b) > 0; }
|
||||
friend bool operator<=(name const & a, name const & b) { return cmp(a, b) <= 0; }
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ public:
|
|||
return *this;
|
||||
}
|
||||
object * raw() const { return m_obj; }
|
||||
operator object*() const { return m_obj; }
|
||||
static void swap(object_ref & a, object_ref & b) { std::swap(a.m_obj, b.m_obj); }
|
||||
};
|
||||
|
||||
|
|
@ -47,7 +46,7 @@ inline object_ref mk_cnstr(unsigned tag, object * o1, object * o2, unsigned scal
|
|||
/* The following definition is a low level hack that relies on the fact that sizeof(object_ref) == sizeof(object *). */
|
||||
inline object_ref const & cnstr_obj_ref(object_ref const & ref, unsigned i) {
|
||||
static_assert(sizeof(object_ref) == sizeof(object *), "unexpected object_ref size"); // NOLINT
|
||||
lean_assert(is_cnstr(ref));
|
||||
lean_assert(is_cnstr(ref.raw()));
|
||||
return reinterpret_cast<object_ref const *>(reinterpret_cast<char*>(ref.raw()) + sizeof(constructor))[i];
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue