forked from enlightenment/efl
Eo: Fixed an issue with mixins and super calls.
SVN revision: 74617
This commit is contained in:
parent
2aa4cd4bd5
commit
7595ce698d
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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);
|
|
@ -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
|
|
@ -1,5 +1,6 @@
|
|||
#include "Eo.h"
|
||||
#include "simple.h"
|
||||
#include "inherit.h"
|
||||
#include "mixin.h"
|
||||
#include "mixin2.h"
|
||||
#include "mixin3.h"
|
||||
|
@ -29,6 +30,12 @@ main(int argc, char *argv[])
|
|||
Mixin3_Public_Data *pd3 = eo_data_get(obj, MIXIN3_CLASS);
|
||||
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;
|
||||
|
|
|
@ -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);
|
||||
|
|
@ -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
|
Loading…
Reference in New Issue