diff options
author | tasn <tasn> | 2012-07-31 07:15:33 +0000 |
---|---|---|
committer | tasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33> | 2012-07-31 07:15:33 +0000 |
commit | 507b52595bcd646ef806f5b6793c5555c70c6562 (patch) | |
tree | 497e4cc727162a96a3da6dd0ec7bfd40794fef1d | |
parent | 59cabd75a82005129d4cdaef29848f2cf900a747 (diff) | |
download | eobj-507b52595bcd646ef806f5b6793c5555c70c6562.tar.gz eobj-507b52595bcd646ef806f5b6793c5555c70c6562.tar.bz2 eobj-507b52595bcd646ef806f5b6793c5555c70c6562.zip |
Eo: Fixed an issue with mixins and super calls.
git-svn-id: http://svn.enlightenment.org/svn/e/trunk/PROTO/eobj@74617 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33
-rw-r--r-- | src/lib/eo.c | 8 | ||||
-rw-r--r-- | src/tests/mixin/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/tests/mixin/inherit.c | 38 | ||||
-rw-r--r-- | src/tests/mixin/inherit.h | 11 | ||||
-rw-r--r-- | src/tests/mixin/main.c | 7 | ||||
-rw-r--r-- | src/tests/mixin/mixin4.c | 24 | ||||
-rw-r--r-- | src/tests/mixin/mixin4.h | 9 |
7 files changed, 98 insertions, 1 deletions
diff --git a/src/lib/eo.c b/src/lib/eo.c index 2758044..5e95291 100644 --- a/src/lib/eo.c +++ b/src/lib/eo.c @@ -285,14 +285,20 @@ _eo_kls_itr_next(const Eo_Class *orig_kls, Eo_Kls_Itr *cur, Eo_Kls_Itr *prev_sta if (*kls_itr) { kls_itr++; - if (*kls_itr) + while (*kls_itr) { const op_type_funcs *fsrc = _dich_func_get(*kls_itr, op); + if (!fsrc->func) + { + kls_itr++; + continue; + } cur->kls = fsrc->src; return cur->kls; } } + cur->kls = NULL; return NULL; } diff --git a/src/tests/mixin/CMakeLists.txt b/src/tests/mixin/CMakeLists.txt index 557cbd3..557a3e6 100644 --- a/src/tests/mixin/CMakeLists.txt +++ b/src/tests/mixin/CMakeLists.txt @@ -1,9 +1,11 @@ LIST(APPEND MIXIN_CC_SOURCES main.c simple.c + inherit.c mixin.c mixin2.c mixin3.c + mixin4.c ) include_directories( diff --git a/src/tests/mixin/inherit.c b/src/tests/mixin/inherit.c new file mode 100644 index 0000000..53c8826 --- /dev/null +++ b/src/tests/mixin/inherit.c @@ -0,0 +1,38 @@ +#include "Eo.h" +#include "inherit.h" + +#include "config.h" + +#define MY_CLASS INHERIT_CLASS + +static void +_a_get(Eo *obj, void *class_data EINA_UNUSED, va_list *list) +{ + int *name = va_arg(*list, int *); + eo_do_super(obj, simple_a_get(name)); + printf("%s\n", __func__); +} + +static void +_class_constructor(Eo_Class *klass) +{ + const Eo_Op_Func_Description func_desc[] = { + EO_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_A_GET), _a_get), + EO_OP_FUNC_SENTINEL + }; + + eo_class_funcs_set(klass, func_desc); +} + +static const Eo_Class_Description class_desc = { + EO_VERSION, + "Inherit", + EO_CLASS_TYPE_REGULAR, + EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), + NULL, + 0, + _class_constructor, + NULL +}; + +EO_DEFINE_CLASS(inherit_class_get, &class_desc, SIMPLE_CLASS, MIXIN4_CLASS, NULL); diff --git a/src/tests/mixin/inherit.h b/src/tests/mixin/inherit.h new file mode 100644 index 0000000..b6d78fb --- /dev/null +++ b/src/tests/mixin/inherit.h @@ -0,0 +1,11 @@ +#ifndef INHERIT_H +#define INHERIT_H + +#include "Eo.h" +#include "simple.h" +#include "mixin4.h" + +#define INHERIT_CLASS inherit_class_get() +const Eo_Class *inherit_class_get(void); + +#endif diff --git a/src/tests/mixin/main.c b/src/tests/mixin/main.c index b7109a1..c69754d 100644 --- a/src/tests/mixin/main.c +++ b/src/tests/mixin/main.c @@ -1,5 +1,6 @@ #include "Eo.h" #include "simple.h" +#include "inherit.h" #include "mixin.h" #include "mixin2.h" #include "mixin3.h" @@ -30,6 +31,12 @@ main(int argc, char *argv[]) fail_if(pd3->count != 9); eo_unref(obj); + + obj = eo_add(INHERIT_CLASS, NULL); + eo_do(obj, simple_a_set(5), simple_a_get(&a)); + fail_if(a != 5); + + eo_unref(obj); eo_shutdown(); return 0; } diff --git a/src/tests/mixin/mixin4.c b/src/tests/mixin/mixin4.c new file mode 100644 index 0000000..17944bc --- /dev/null +++ b/src/tests/mixin/mixin4.c @@ -0,0 +1,24 @@ +#include "Eo.h" +#include "mixin.h" +#include "mixin4.h" +#include "simple.h" + +#include "config.h" + +#include "../eunit_tests.h" + +#define MY_CLASS MIXIN4_CLASS + +static const Eo_Class_Description class_desc = { + EO_VERSION, + "Mixin4", + EO_CLASS_TYPE_MIXIN, + EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), + NULL, + 0, + NULL, + NULL +}; + +EO_DEFINE_CLASS(mixin4_class_get, &class_desc, NULL, NULL); + diff --git a/src/tests/mixin/mixin4.h b/src/tests/mixin/mixin4.h new file mode 100644 index 0000000..e924332 --- /dev/null +++ b/src/tests/mixin/mixin4.h @@ -0,0 +1,9 @@ +#ifndef MIXIN4_H +#define MIXIN4_H + +#include "Eo.h" + +#define MIXIN4_CLASS mixin4_class_get() +const Eo_Class *mixin4_class_get(void); + +#endif |