diff options
author | Tom Hacohen <tom@stosb.com> | 2012-07-31 07:15:33 +0000 |
---|---|---|
committer | Tom Hacohen <tom@stosb.com> | 2012-07-31 07:15:33 +0000 |
commit | 7595ce698daf995914ea80d8fbe0a2c9096559ab (patch) | |
tree | 6fce15226248ca2b80b36caf40b75c3e91170df9 /legacy/eobj | |
parent | 2aa4cd4bd52d48269d7b2d3392393fd51cc9b22f (diff) |
Eo: Fixed an issue with mixins and super calls.
SVN revision: 74617
Diffstat (limited to 'legacy/eobj')
-rw-r--r-- | legacy/eobj/src/lib/eo.c | 8 | ||||
-rw-r--r-- | legacy/eobj/src/tests/mixin/CMakeLists.txt | 2 | ||||
-rw-r--r-- | legacy/eobj/src/tests/mixin/inherit.c | 38 | ||||
-rw-r--r-- | legacy/eobj/src/tests/mixin/inherit.h | 11 | ||||
-rw-r--r-- | legacy/eobj/src/tests/mixin/main.c | 7 | ||||
-rw-r--r-- | legacy/eobj/src/tests/mixin/mixin4.c | 24 | ||||
-rw-r--r-- | legacy/eobj/src/tests/mixin/mixin4.h | 9 |
7 files changed, 98 insertions, 1 deletions
diff --git a/legacy/eobj/src/lib/eo.c b/legacy/eobj/src/lib/eo.c index 2758044592..5e95291854 100644 --- a/legacy/eobj/src/lib/eo.c +++ b/legacy/eobj/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 | |||
285 | if (*kls_itr) | 285 | if (*kls_itr) |
286 | { | 286 | { |
287 | kls_itr++; | 287 | kls_itr++; |
288 | if (*kls_itr) | 288 | while (*kls_itr) |
289 | { | 289 | { |
290 | const op_type_funcs *fsrc = _dich_func_get(*kls_itr, op); | 290 | const op_type_funcs *fsrc = _dich_func_get(*kls_itr, op); |
291 | if (!fsrc->func) | ||
292 | { | ||
293 | kls_itr++; | ||
294 | continue; | ||
295 | } | ||
291 | cur->kls = fsrc->src; | 296 | cur->kls = fsrc->src; |
292 | return cur->kls; | 297 | return cur->kls; |
293 | } | 298 | } |
294 | } | 299 | } |
295 | 300 | ||
301 | cur->kls = NULL; | ||
296 | return NULL; | 302 | return NULL; |
297 | } | 303 | } |
298 | 304 | ||
diff --git a/legacy/eobj/src/tests/mixin/CMakeLists.txt b/legacy/eobj/src/tests/mixin/CMakeLists.txt index 557cbd301a..557a3e6af3 100644 --- a/legacy/eobj/src/tests/mixin/CMakeLists.txt +++ b/legacy/eobj/src/tests/mixin/CMakeLists.txt | |||
@@ -1,9 +1,11 @@ | |||
1 | LIST(APPEND MIXIN_CC_SOURCES | 1 | LIST(APPEND MIXIN_CC_SOURCES |
2 | main.c | 2 | main.c |
3 | simple.c | 3 | simple.c |
4 | inherit.c | ||
4 | mixin.c | 5 | mixin.c |
5 | mixin2.c | 6 | mixin2.c |
6 | mixin3.c | 7 | mixin3.c |
8 | mixin4.c | ||
7 | ) | 9 | ) |
8 | 10 | ||
9 | include_directories( | 11 | include_directories( |
diff --git a/legacy/eobj/src/tests/mixin/inherit.c b/legacy/eobj/src/tests/mixin/inherit.c new file mode 100644 index 0000000000..53c8826953 --- /dev/null +++ b/legacy/eobj/src/tests/mixin/inherit.c | |||
@@ -0,0 +1,38 @@ | |||
1 | #include "Eo.h" | ||
2 | #include "inherit.h" | ||
3 | |||
4 | #include "config.h" | ||
5 | |||
6 | #define MY_CLASS INHERIT_CLASS | ||
7 | |||
8 | static void | ||
9 | _a_get(Eo *obj, void *class_data EINA_UNUSED, va_list *list) | ||
10 | { | ||
11 | int *name = va_arg(*list, int *); | ||
12 | eo_do_super(obj, simple_a_get(name)); | ||
13 | printf("%s\n", __func__); | ||
14 | } | ||
15 | |||
16 | static void | ||
17 | _class_constructor(Eo_Class *klass) | ||
18 | { | ||
19 | const Eo_Op_Func_Description func_desc[] = { | ||
20 | EO_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_A_GET), _a_get), | ||
21 | EO_OP_FUNC_SENTINEL | ||
22 | }; | ||
23 | |||
24 | eo_class_funcs_set(klass, func_desc); | ||
25 | } | ||
26 | |||
27 | static const Eo_Class_Description class_desc = { | ||
28 | EO_VERSION, | ||
29 | "Inherit", | ||
30 | EO_CLASS_TYPE_REGULAR, | ||
31 | EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), | ||
32 | NULL, | ||
33 | 0, | ||
34 | _class_constructor, | ||
35 | NULL | ||
36 | }; | ||
37 | |||
38 | EO_DEFINE_CLASS(inherit_class_get, &class_desc, SIMPLE_CLASS, MIXIN4_CLASS, NULL); | ||
diff --git a/legacy/eobj/src/tests/mixin/inherit.h b/legacy/eobj/src/tests/mixin/inherit.h new file mode 100644 index 0000000000..b6d78fbf0b --- /dev/null +++ b/legacy/eobj/src/tests/mixin/inherit.h | |||
@@ -0,0 +1,11 @@ | |||
1 | #ifndef INHERIT_H | ||
2 | #define INHERIT_H | ||
3 | |||
4 | #include "Eo.h" | ||
5 | #include "simple.h" | ||
6 | #include "mixin4.h" | ||
7 | |||
8 | #define INHERIT_CLASS inherit_class_get() | ||
9 | const Eo_Class *inherit_class_get(void); | ||
10 | |||
11 | #endif | ||
diff --git a/legacy/eobj/src/tests/mixin/main.c b/legacy/eobj/src/tests/mixin/main.c index b7109a108d..c69754da78 100644 --- a/legacy/eobj/src/tests/mixin/main.c +++ b/legacy/eobj/src/tests/mixin/main.c | |||
@@ -1,5 +1,6 @@ | |||
1 | #include "Eo.h" | 1 | #include "Eo.h" |
2 | #include "simple.h" | 2 | #include "simple.h" |
3 | #include "inherit.h" | ||
3 | #include "mixin.h" | 4 | #include "mixin.h" |
4 | #include "mixin2.h" | 5 | #include "mixin2.h" |
5 | #include "mixin3.h" | 6 | #include "mixin3.h" |
@@ -30,6 +31,12 @@ main(int argc, char *argv[]) | |||
30 | fail_if(pd3->count != 9); | 31 | fail_if(pd3->count != 9); |
31 | 32 | ||
32 | eo_unref(obj); | 33 | eo_unref(obj); |
34 | |||
35 | obj = eo_add(INHERIT_CLASS, NULL); | ||
36 | eo_do(obj, simple_a_set(5), simple_a_get(&a)); | ||
37 | fail_if(a != 5); | ||
38 | |||
39 | eo_unref(obj); | ||
33 | eo_shutdown(); | 40 | eo_shutdown(); |
34 | return 0; | 41 | return 0; |
35 | } | 42 | } |
diff --git a/legacy/eobj/src/tests/mixin/mixin4.c b/legacy/eobj/src/tests/mixin/mixin4.c new file mode 100644 index 0000000000..17944bc901 --- /dev/null +++ b/legacy/eobj/src/tests/mixin/mixin4.c | |||
@@ -0,0 +1,24 @@ | |||
1 | #include "Eo.h" | ||
2 | #include "mixin.h" | ||
3 | #include "mixin4.h" | ||
4 | #include "simple.h" | ||
5 | |||
6 | #include "config.h" | ||
7 | |||
8 | #include "../eunit_tests.h" | ||
9 | |||
10 | #define MY_CLASS MIXIN4_CLASS | ||
11 | |||
12 | static const Eo_Class_Description class_desc = { | ||
13 | EO_VERSION, | ||
14 | "Mixin4", | ||
15 | EO_CLASS_TYPE_MIXIN, | ||
16 | EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0), | ||
17 | NULL, | ||
18 | 0, | ||
19 | NULL, | ||
20 | NULL | ||
21 | }; | ||
22 | |||
23 | EO_DEFINE_CLASS(mixin4_class_get, &class_desc, NULL, NULL); | ||
24 | |||
diff --git a/legacy/eobj/src/tests/mixin/mixin4.h b/legacy/eobj/src/tests/mixin/mixin4.h new file mode 100644 index 0000000000..e924332fdc --- /dev/null +++ b/legacy/eobj/src/tests/mixin/mixin4.h | |||
@@ -0,0 +1,9 @@ | |||
1 | #ifndef MIXIN4_H | ||
2 | #define MIXIN4_H | ||
3 | |||
4 | #include "Eo.h" | ||
5 | |||
6 | #define MIXIN4_CLASS mixin4_class_get() | ||
7 | const Eo_Class *mixin4_class_get(void); | ||
8 | |||
9 | #endif | ||