forked from enlightenment/efl
eolian: add part validation (including dup check with funcs)
This commit is contained in:
parent
b4705ea968
commit
f851fa511e
|
@ -350,6 +350,26 @@ _validate_function(Eolian_Function *func, Eina_Hash *nhash)
|
|||
return _validate(&func->base);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_validate_part(Eolian_Part *part, Eina_Hash *nhash)
|
||||
{
|
||||
if (!_validate_doc(part->doc))
|
||||
return EINA_FALSE;
|
||||
|
||||
const Eolian_Function *ofunc = eina_hash_find(nhash, part->name);
|
||||
if (ofunc)
|
||||
{
|
||||
char buf[512];
|
||||
snprintf(buf, sizeof(buf),
|
||||
"part '%s' conflicts with a function (defined at %s:%d:%d)",
|
||||
part->name, ofunc->base.file,
|
||||
ofunc->base.line, ofunc->base.column);
|
||||
_obj_error(&part->base, buf);
|
||||
}
|
||||
|
||||
return _validate(&part->base);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
_validate_event(Eolian_Event *event)
|
||||
{
|
||||
|
@ -381,6 +401,7 @@ _validate_class(Eolian_Class *cl, Eina_Hash *nhash)
|
|||
Eina_List *l;
|
||||
Eolian_Function *func;
|
||||
Eolian_Event *event;
|
||||
Eolian_Part *part;
|
||||
Eolian_Implement *impl;
|
||||
Eolian_Class *icl;
|
||||
Eina_Bool res = EINA_TRUE;
|
||||
|
@ -413,6 +434,10 @@ _validate_class(Eolian_Class *cl, Eina_Hash *nhash)
|
|||
if (!(res = _validate_event(event)))
|
||||
goto freehash;
|
||||
|
||||
EINA_LIST_FOREACH(cl->parts, l, part)
|
||||
if (!(res = _validate_part(part, nhash)))
|
||||
goto freehash;
|
||||
|
||||
EINA_LIST_FOREACH(cl->implements, l, impl)
|
||||
if (!(res = _validate_implement(impl)))
|
||||
goto freehash;
|
||||
|
|
Loading…
Reference in New Issue