mirror of https://github.com/KLayout/klayout.git
[consider merging] more consistent behavior of RBA/pya: enum classes are properly made available (was for example RBA::Qt::Qt_Keys instead of RBA::Qt_Keys and pya.Qt.Keys was no fully initialized type object)
This commit is contained in:
parent
5fd54fa40a
commit
7ff9b4d8e6
|
|
@ -651,11 +651,26 @@ static void collect_classes (const gsi::ClassBase *cls, std::list<const gsi::Cla
|
||||||
{
|
{
|
||||||
unsorted_classes.push_back (cls);
|
unsorted_classes.push_back (cls);
|
||||||
|
|
||||||
for (tl::weak_collection<gsi::ClassBase>::const_iterator cc = cls->begin_child_classes (); cc != cls->end_child_classes (); ++cc) {
|
for (auto cc = cls->begin_child_classes (); cc != cls->end_child_classes (); ++cc) {
|
||||||
collect_classes (cc.operator-> (), unsorted_classes);
|
collect_classes (cc.operator-> (), unsorted_classes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool all_parts_available (const gsi::ClassBase *cls, const std::set<const gsi::ClassBase *> &taken)
|
||||||
|
{
|
||||||
|
if (cls->declaration () && cls->declaration () != cls && taken.find (cls->declaration ()) == taken.end ()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto cc = cls->begin_child_classes (); cc != cls->end_child_classes (); ++cc) {
|
||||||
|
if (! all_parts_available (cc.operator-> (), taken)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
std::list<const gsi::ClassBase *>
|
std::list<const gsi::ClassBase *>
|
||||||
ClassBase::classes_in_definition_order (const char *mod_name)
|
ClassBase::classes_in_definition_order (const char *mod_name)
|
||||||
{
|
{
|
||||||
|
|
@ -687,7 +702,7 @@ ClassBase::classes_in_definition_order (const char *mod_name)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((*c)->declaration () && (*c)->declaration () != *c && taken.find ((*c)->declaration ()) == taken.end ()) {
|
if (! all_parts_available (*c, taken)) {
|
||||||
// can't produce this class yet - it's a reference to another class which is not produced yet.
|
// can't produce this class yet - it's a reference to another class which is not produced yet.
|
||||||
more_classes.push_back (*c);
|
more_classes.push_back (*c);
|
||||||
continue;
|
continue;
|
||||||
|
|
|
||||||
|
|
@ -337,7 +337,7 @@ public:
|
||||||
|
|
||||||
for (auto cc = cls->begin_child_classes (); cc != cls->end_child_classes (); ++cc) {
|
for (auto cc = cls->begin_child_classes (); cc != cls->end_child_classes (); ++cc) {
|
||||||
if (! cc->name ().empty ()) {
|
if (! cc->name ().empty ()) {
|
||||||
PyTypeObject *child_class = make_class (cc.operator-> (), as_static);
|
PyTypeObject *child_class = make_class (cc->declaration (), as_static);
|
||||||
PythonRef attr ((PyObject *) child_class, false /*borrowed*/);
|
PythonRef attr ((PyObject *) child_class, false /*borrowed*/);
|
||||||
set_type_attr (type, cc->name ().c_str (), attr);
|
set_type_attr (type, cc->name ().c_str (), attr);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1654,7 +1654,7 @@ public:
|
||||||
for (auto cc = cls->begin_child_classes (); cc != cls->end_child_classes (); ++cc) {
|
for (auto cc = cls->begin_child_classes (); cc != cls->end_child_classes (); ++cc) {
|
||||||
if (! cc->name ().empty ()) {
|
if (! cc->name ().empty ()) {
|
||||||
if (! is_registered (cc->declaration (), false)) {
|
if (! is_registered (cc->declaration (), false)) {
|
||||||
make_class (cc->declaration (), false, klass, cc->declaration ());
|
make_class (cc->declaration (), false, klass, cls);
|
||||||
} else {
|
} else {
|
||||||
VALUE child_class = ruby_cls (cc->declaration (), false);
|
VALUE child_class = ruby_cls (cc->declaration (), false);
|
||||||
rb_define_const (klass, cc->name ().c_str (), child_class);
|
rb_define_const (klass, cc->name ().c_str (), child_class);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue