Removed is_of_type() of gsi::Class which is not needed and appears to cause problems on M1 ARM

This commit is contained in:
Matthias Koefferlein 2021-05-19 22:40:14 +02:00
parent 7a754b9c6f
commit 6496a71b5b
5 changed files with 15 additions and 26 deletions

View File

@ -341,7 +341,7 @@ add_native_impl("QChildEvent", <<'CODE', <<'DECL')
virtual bool can_upcast (const void *) const { return false; } virtual bool can_upcast (const void *) const { return false; }
// Does not bind to a particular type // Does not bind to a particular type
virtual bool is_of_type (const std::type_info & /*ti*/) const { return false; } virtual bool binds () const { return false; }
virtual const std::type_info &type () const { return typeid (DummyQObject); } virtual const std::type_info &type () const { return typeid (DummyQObject); }
}; };
} }

View File

@ -585,9 +585,9 @@ public:
set_name (name); set_name (name);
} }
virtual bool is_of_type (const std::type_info &ti) const virtual bool binds () const
{ {
return (ti == typeid (X)); return false;
} }
virtual const std::type_info &type () const virtual const std::type_info &type () const
@ -865,15 +865,9 @@ public:
return m_subclass_tester.get () && m_subclass_tester->can_upcast (p); return m_subclass_tester.get () && m_subclass_tester->can_upcast (p);
} }
virtual bool is_of_type (const std::type_info &ti) const virtual bool binds () const
{ {
if (adapted_type_info ()) { return true;
// A class matches the typeinfo of the adapted type. We'll sort this out later
// on the client side.
return (ti == *adapted_type_info ());
} else {
return (ti == typeid (X));
}
} }
virtual const std::type_info &type () const virtual const std::type_info &type () const

View File

@ -816,7 +816,7 @@ bool has_class (const std::string &name)
static void add_class_to_map (const gsi::ClassBase *c) static void add_class_to_map (const gsi::ClassBase *c)
{ {
if (c->declaration () != c) { if (c->declaration () != c || ! c->binds ()) {
// only consider non-extensions // only consider non-extensions
return; return;
} }
@ -833,14 +833,12 @@ static void add_class_to_map (const gsi::ClassBase *c)
sp_tname_to_class = new tname_to_class_map_t (); sp_tname_to_class = new tname_to_class_map_t ();
} }
if (ti && c->is_of_type (*ti)) { if (!sp_ti_to_class->insert (std::make_pair (ti, c)).second) {
if (!sp_ti_to_class->insert (std::make_pair (ti, c)).second) { // Duplicate registration of this class
// Duplicate registration of this class tl::error << "Duplicate registration of class " << c->name () << " (type " << ti->name () << ")";
tl::error << "Duplicate registration of class " << c->name () << " (type " << ti->name () << ")"; tl_assert (false);
tl_assert (false); } else {
} else { sp_tname_to_class->insert (std::make_pair (std::string (ti->name ()), c));
sp_tname_to_class->insert (std::make_pair (std::string (ti->name ()), c));
}
} }
} }

View File

@ -446,12 +446,9 @@ public:
} }
/** /**
* @brief Class implementation: check C++ type of object * @brief Class implementation: returns true if this class binds to a script class
*
* This method returns true, if objects of this class are compatible with
* the given C++ type.
*/ */
virtual bool is_of_type (const std::type_info & /*ti*/) const virtual bool binds () const
{ {
tl_assert (false); tl_assert (false);
return false; return false;

View File

@ -60,7 +60,7 @@
virtual bool can_upcast (const void *) const { return false; } virtual bool can_upcast (const void *) const { return false; }
// Does not bind to a particular type // Does not bind to a particular type
virtual bool is_of_type (const std::type_info & /*ti*/) const { return false; } virtual bool binds () const { return false; }
virtual const std::type_info &type () const { return typeid (DummyQObject); } virtual const std::type_info &type () const { return typeid (DummyQObject); }
}; };
} }