diff options
author | Daniel Kolesa <d.kolesa@osg.samsung.com> | 2017-11-01 13:19:33 +0100 |
---|---|---|
committer | Daniel Kolesa <d.kolesa@osg.samsung.com> | 2017-11-01 13:19:33 +0100 |
commit | f851fa511e5b4fabac2002185b426445fc6ae208 (patch) | |
tree | e1978099f037a203d233193792274a34208724f9 /src/lib | |
parent | b4705ea968de21f25434357cff7683673a4cf8ef (diff) |
eolian: add part validation (including dup check with funcs)
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/eolian/database_validate.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/lib/eolian/database_validate.c b/src/lib/eolian/database_validate.c index 6ed286866b..22df42d8ff 100644 --- a/src/lib/eolian/database_validate.c +++ b/src/lib/eolian/database_validate.c | |||
@@ -351,6 +351,26 @@ _validate_function(Eolian_Function *func, Eina_Hash *nhash) | |||
351 | } | 351 | } |
352 | 352 | ||
353 | static Eina_Bool | 353 | static Eina_Bool |
354 | _validate_part(Eolian_Part *part, Eina_Hash *nhash) | ||
355 | { | ||
356 | if (!_validate_doc(part->doc)) | ||
357 | return EINA_FALSE; | ||
358 | |||
359 | const Eolian_Function *ofunc = eina_hash_find(nhash, part->name); | ||
360 | if (ofunc) | ||
361 | { | ||
362 | char buf[512]; | ||
363 | snprintf(buf, sizeof(buf), | ||
364 | "part '%s' conflicts with a function (defined at %s:%d:%d)", | ||
365 | part->name, ofunc->base.file, | ||
366 | ofunc->base.line, ofunc->base.column); | ||
367 | _obj_error(&part->base, buf); | ||
368 | } | ||
369 | |||
370 | return _validate(&part->base); | ||
371 | } | ||
372 | |||
373 | static Eina_Bool | ||
354 | _validate_event(Eolian_Event *event) | 374 | _validate_event(Eolian_Event *event) |
355 | { | 375 | { |
356 | if (event->type && !_validate_type(event->type)) | 376 | if (event->type && !_validate_type(event->type)) |
@@ -381,6 +401,7 @@ _validate_class(Eolian_Class *cl, Eina_Hash *nhash) | |||
381 | Eina_List *l; | 401 | Eina_List *l; |
382 | Eolian_Function *func; | 402 | Eolian_Function *func; |
383 | Eolian_Event *event; | 403 | Eolian_Event *event; |
404 | Eolian_Part *part; | ||
384 | Eolian_Implement *impl; | 405 | Eolian_Implement *impl; |
385 | Eolian_Class *icl; | 406 | Eolian_Class *icl; |
386 | Eina_Bool res = EINA_TRUE; | 407 | Eina_Bool res = EINA_TRUE; |
@@ -413,6 +434,10 @@ _validate_class(Eolian_Class *cl, Eina_Hash *nhash) | |||
413 | if (!(res = _validate_event(event))) | 434 | if (!(res = _validate_event(event))) |
414 | goto freehash; | 435 | goto freehash; |
415 | 436 | ||
437 | EINA_LIST_FOREACH(cl->parts, l, part) | ||
438 | if (!(res = _validate_part(part, nhash))) | ||
439 | goto freehash; | ||
440 | |||
416 | EINA_LIST_FOREACH(cl->implements, l, impl) | 441 | EINA_LIST_FOREACH(cl->implements, l, impl) |
417 | if (!(res = _validate_implement(impl))) | 442 | if (!(res = _validate_implement(impl))) |
418 | goto freehash; | 443 | goto freehash; |